[Ironruby-core] IronRuby C# Extensions

Ivan Porto Carrero ivan at flanders.co.nz
Sun Oct 11 18:06:14 EDT 2009


for the initializer to know which classes to use when generating and what to
generate I guess
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)



On Sun, Oct 11, 2009 at 11:00 PM, Shay Friedman <shay.friedman at gmail.com>wrote:

> Thanks for the replies guys.
>
> By the way, if the initializer is required, why are the attributes needed
> too? (or they aren't?)
>
> Thanks,
> Shay.
>
>
> On Sun, Oct 11, 2009 at 10:06 PM, Jimmy Schementi <
> Jimmy.Schementi at microsoft.com> wrote:
>
>>  To clarify things a bit more, the real difference between the two ways
>> is performance and cleanness of the .NET code. My guidance would be to
>> initially build a ruby front-end API, and call into .NET when needed; the
>> cleanest solution IMO but depends on slow reflection for calling into .NET
>> code. If you find that the .NET integration is too slow for that particular
>> library, then you can move your code over to the generated-initializers
>> model that IronRuby's libraries use.
>>
>>  ~js
>>  ------------------------------
>> *From:* ironruby-core-bounces at rubyforge.org [
>> ironruby-core-bounces at rubyforge.org] on behalf of Shri Borde [
>> Shri.Borde at microsoft.com]
>> *Sent:* Sunday, October 11, 2009 12:44 PM
>>
>> *To:* ironruby-core at rubyforge.org
>> *Subject:* Re: [Ironruby-core] IronRuby C# Extensions
>>
>>   Tomas, assuming you wanted your library to be C# code only for whatever
>> reason, wouldn’t you need to use RubyModuleAttribute etc for various reasons
>> (other than performance) to make the library look really Ruby-friendly and
>> also be multi-ScriptRuntime-aware? For example, if you wanted a class
>> constant, you couldn’t just declare a C# “const” variable as that would be
>> appdomain-wide and also read-only. So you have to tag it with
>> “RubyContantAttribute”, right?
>>
>>
>>
>> *From:* ironruby-core-bounces at rubyforge.org [mailto:
>> ironruby-core-bounces at rubyforge.org] *On Behalf Of *Tomas Matousek
>> *Sent:* Sunday, October 11, 2009 11:48 AM
>> *To:* ironruby-core at rubyforge.org
>> *Subject:* Re: [Ironruby-core] IronRuby C# Extensions
>>
>>
>>
>> Ideally Reflection would be fast and we wouldn’t need any workarounds to
>> load built-ins fast. But that’s not the case, so we use initializers.
>>
>>
>>
>> As for the scenarios you mentioned:
>>
>> 1. Porting Ruby native extensions
>>
>> Why not to write them in Ruby with calls to .NET Framework assemblies? Is
>> there anything that makes this difficult?
>>
>>
>> 2. Create an IronRuby library in C# in order to improve performance of a
>> certain operation
>>
>> Couldn’t you write the parts whose perf matter in C# code that doesn’t
>> have all the Ruby bells and whistles and keep your library written in Ruby?
>>
>>
>>
>> Tomas
>>
>>
>>
>> *From:* ironruby-core-bounces at rubyforge.org [mailto:
>> ironruby-core-bounces at rubyforge.org] *On Behalf Of *Shay Friedman
>> *Sent:* Sunday, October 11, 2009 10:26 AM
>> *To:* ironruby-core at rubyforge.org
>> *Subject:* Re: [Ironruby-core] IronRuby C# Extensions
>>
>>
>>
>> By the way, if we're at the subject... Ivan does have a point there, but
>> why were the standard libraries written this way?
>>
>> Thanks,
>> Shay.
>>
>> On Sun, Oct 11, 2009 at 7:19 PM, Shay Friedman <shay.friedman at gmail.com>
>> wrote:
>>
>> Right, but this way you have more control on the "translation" of your Dll
>> to IronRuby.
>>
>> Shay.
>>
>>
>>
>> On Sun, Oct 11, 2009 at 7:14 PM, Ivan Porto Carrero <ivan at flanders.co.nz>
>> wrote:
>>
>> But wouldn't you be able to accomplish these scenarios just by requiring a
>> C# built dll?
>>
>>
>> ---
>> Met vriendelijke groeten - Best regards - Salutations
>> Ivan Porto Carrero
>> Blog: http://flanders.co.nz
>> Twitter: http://twitter.com/casualjim
>> Author of IronRuby in Action (http://manning.com/carrero)
>>
>>    On Sun, Oct 11, 2009 at 7:03 PM, Shay Friedman <
>> shay.friedman at gmail.com> wrote:
>>
>> 2 samples I can think of -
>> 1. Porting Ruby native extensions
>> 2. Create an IronRuby library in C# in order to improve performance of a
>> certain operation
>>
>> Shay.
>>
>>
>>
>> On Sun, Oct 11, 2009 at 6:57 PM, Ivan Porto Carrero <ivan at flanders.co.nz>
>> wrote:
>>
>> Just require an assembly should work just as well I guess.
>>
>>
>>
>> When would you need to use the RubyClass etc attributes and the
>> initializer? What is the added value of those?
>> ---
>> Met vriendelijke groeten - Best regards - Salutations
>> Ivan Porto Carrero
>> Blog: http://flanders.co.nz
>> Twitter: http://twitter.com/casualjim
>> Author of IronRuby in Action (http://manning.com/carrero)
>>
>>
>>
>>  On Sun, Oct 11, 2009 at 6:51 PM, Shay Friedman <shay.friedman at gmail.com>
>> wrote:
>>
>> Is it possible to consider allowing to load extensions without the need of
>> a library initializer? (another argument in the load_assembly method for
>> example)
>> Currently, the library initializer makes the whole thing much more
>> complicated...
>>
>> Thanks,
>> Shay.
>>
>>
>>
>> On Sun, Oct 11, 2009 at 6:27 PM, Tomas Matousek <
>> Tomas.Matousek at microsoft.com> wrote:
>>
>> Basically to avoid reflection when loading the classes and modules.
>>
>> Tomas
>>
>>
>> -----Original Message-----
>> From: ironruby-core-bounces at rubyforge.org [mailto:
>> ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman
>> Sent: Sunday, October 11, 2009 9:14 AM
>> To: ironruby-core at rubyforge.org
>> Subject: Re: [Ironruby-core] IronRuby C# Extensions
>>
>> I found out I needed an initializer...
>>
>> I have a question - why do we need initializers if we define everything on
>> the attributes?
>>
>> Thanks,
>> Shay.
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>>
>>   --
>>
>> --------------------------------------------------
>> Shay Friedman
>> Author of IronRuby Unleashed
>> http://www.IronShay.com
>> Follow me: http://twitter.com/ironshay
>>
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>>
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>>
>>
>> --
>> --------------------------------------------------
>> Shay Friedman
>> Author of IronRuby Unleashed
>> http://www.IronShay.com
>> Follow me: http://twitter.com/ironshay
>>
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>>
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>>
>>
>> --
>> --------------------------------------------------
>> Shay Friedman
>> Author of IronRuby Unleashed
>> http://www.IronShay.com
>> Follow me: http://twitter.com/ironshay
>>
>>
>>
>>
>> --
>> --------------------------------------------------
>> Shay Friedman
>> Author of IronRuby Unleashed
>> http://www.IronShay.com
>> Follow me: http://twitter.com/ironshay
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>>
>
>
> --
> --------------------------------------------------
> Shay Friedman
> Author of IronRuby Unleashed
> http://www.IronShay.com
> Follow me: http://twitter.com/ironshay
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091012/9ec0450d/attachment.html>


More information about the Ironruby-core mailing list