qwertie / ecsharp

Home of LoycCore, the LES language of Loyc trees, the Enhanced C# parser, the LeMP macro preprocessor, and the LLLPG parser generator.
http://ecsharp.net
Other
172 stars 25 forks source link

[Idea exploration] Partial generic type specification and concise generic method definition #114

Closed dadhi closed 3 years ago

dadhi commented 3 years ago
class A<T>
{
   L Add<X>($L list, Func<T, X> f) where L : IList<X> => list.Add(f(this));

  L Create<L<$X>>() where L : IList<X>
  {
     return new List()::list |> Add<int>(#, x => int.Parse(x)) |> #.Add(42);
  }
}
dadhi commented 3 years ago

Sorry, too early.