[Ironruby-core] A nicer syntax for generic extension methods

Miguel Madero me at miguelmadero.com
Wed Feb 3 15:38:55 EST 2010

This might help, there's a library in the VS directory
samples/CSharpSamples.zip/LinqSamples/DynamicQuery take a look, under the
covers it's creating expressions LINQ Expressions.

In C# you will just chain methods like:
myCollection.Where("property=myValue").OrderBy("anotherProp desc");

 I think this library could be extended to "easily" create any type of
expression in IR. This could be useful to consume existing libraries that
already expect an expression.

On Thu, Feb 4, 2010 at 5:05 AM, Ryan Riley <ryan.riley at panesofglass.org>wrote:

> On Wed, Feb 3, 2010 at 10:59 AM, Ivan Porto Carrero <
> ivan at whiterabbitconsulting.eu> wrote:
>> hashes?
> Just an example, though perhaps not the best. :)
>  but may i ask why you're so hell-bent on linq?
> I mostly want some way to use the Reactive Extensions for asynchronous
> programming and OpenXML SDK for working with Office docs. In particular, I'm
> thinking of working with IR on top of other C# and/or F# libraries which
> might be using one or both of those libraries. If I were to write it in all
> Ruby, I'd probably look at eventmachine for an event loop processor.
> I'm definitely open to other solutions.
>> Linq is a really bad match to ruby with the expressions. it would require
>> some significant amount of work to get that to work correctly.  AFAIK there
>> is no way in IronRuby to build expressions except use the raw API, but
>> nothing is in there yet that makes this easier to do.
> L2S uses expressions, but I don't think everything uses them. If all that's
> required is a delegate, that's not so hard and can be be accomplished with a
> wrapping Ruby method that accepts a block and wraps the block into a Func to
> pass into the LINQ method. Given some of the previous posts, I think
> creating a general module to wrap these methods shouldn't be too difficult.
> Thoughts?
>  Anyway you can reuse anonymous types did you know that? Alex James learnt
>> the trick from Wes Dyer
>> http://blogs.msdn.com/alexj/archive/2007/11/22/t-castbyexample-t-object-o-t-example.aspx
> Yeah, I knew about that, but I don't really want to touch casting by
> example in Ruby. It might not be bad, but why bother when I can use
> something from Ruby?
> Ryan
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core

Miguel A. Madero Reyes
www.miguelmadero.com (blog)
me at miguelmadero.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100204/10bccb99/attachment.html>

More information about the Ironruby-core mailing list