23

Closed

Support for LINQ extension methods

description

I'm using an extension method to extend IEnumerable<MyType<T>>.

file attachments

Closed Jun 15, 2011 at 2:59 AM by jdhardy
Fixed in 2.7.

comments

felixpollan wrote Jul 3, 2008 at 3:34 PM

I'm tryng to implement a fluent interface pattern, to allow me wrote something like this
series = Model.GetSeries("EXCH:EUR/USD").From(DateTime(2008,5,22)).To(DateTime(2008,6,5))

series.Transform(Transformers.Rebase(1)).Transform(Transformers.LogReturn).Transform(Transformers.Smoothing)

where trasformer is a global object in the scope, series is an IEnumerable<MyType<t>>, and the Transform operator returns an IEnumerable<MyType<T>>.

This does not work. Pyrhon seems to guess return types before executing the code, and loose the extension method Transform

sborde wrote Aug 1, 2008 at 5:35 PM

We don't currently support LINQ style extension methods. We will look at this for a future release.

wrote Aug 1, 2008 at 5:35 PM

wrote Aug 8, 2008 at 10:21 PM

wrote Dec 11, 2008 at 8:47 AM

kfarmer wrote Dec 11, 2008 at 8:51 AM

Extension methods are just too dang important not to prioritize. Note the impending avalance of extension methods coming in .NET 4 -- ASP.NET MVC, Parallel Extensions, the already-existing LINQ to SQL and Entity Framework, et cetera. Solving this within the DLR would be preferable, but I'd be happy enough to see it in IP first.

wrote Dec 25, 2008 at 9:59 PM

wrote Jan 6, 2009 at 11:26 PM

wrote Feb 2, 2009 at 7:03 PM

wrote May 1, 2009 at 11:26 PM

wrote Sep 22, 2009 at 9:32 PM

wrote Sep 24, 2009 at 5:28 PM

wrote Jan 27, 2010 at 2:20 AM

wrote Jan 29, 2010 at 12:57 AM

wrote Feb 9, 2010 at 12:52 AM

wrote Mar 10, 2010 at 3:39 AM

wrote Mar 13, 2010 at 3:26 AM

HankFay wrote Mar 13, 2010 at 3:28 AM

Agreed: if IP can't do Linq that's bad enough; but not to be able to do parallel would be death by not-so-benign neglect.

wrote Mar 23, 2010 at 6:27 PM

wrote Apr 6, 2010 at 3:45 PM

wrote Apr 6, 2010 at 5:30 PM

wrote May 31, 2010 at 7:00 PM

wrote Jun 24, 2010 at 8:30 PM

wrote Jun 25, 2010 at 5:58 AM

wrote Jun 27, 2010 at 9:31 PM

wrote Aug 5, 2010 at 7:22 PM

wrote Dec 11, 2010 at 8:14 PM

rjnienaber wrote Dec 11, 2010 at 8:14 PM

Extension methods still don't seem to be usable in 2.7b1. I put together a small test case which reproduces the problem.

tristanz wrote Dec 21, 2010 at 2:37 AM

This is implemented in IronRuby already, so it the pattern should be there. See using_clr_extensions in:

https://github.com/IronLanguages/main/blob/master/Languages/Ruby/Libraries/Builtins/KernelOps.cs

wrote Jan 13, 2011 at 8:56 PM

wrote Jan 19, 2011 at 4:53 AM

wrote Feb 10, 2011 at 7:02 AM

wrote Feb 10, 2011 at 7:02 AM

rjnienaber wrote Feb 10, 2011 at 7:02 AM

Updated test case

wrote Mar 18, 2011 at 2:15 PM

wrote Apr 10, 2011 at 1:18 AM

wrote May 3, 2011 at 2:04 AM

wrote Jun 14, 2011 at 7:42 PM

jdhardy wrote Jun 15, 2011 at 2:28 AM

You can use clr.ImportExtensions() to use extension methods now, but there are bugs in the type inference for generics that prevents chaining them.

jdhardy wrote Jun 15, 2011 at 2:31 AM

Marking as fixed. See #30379 for the chaining issue.

wrote Jun 15, 2011 at 2:58 AM

wrote Jun 15, 2011 at 2:59 AM

wrote Feb 22, 2013 at 1:15 AM

wrote May 16, 2013 at 12:06 PM