Foo.of(Bar).new works today … since it's about instantiating generic types … this discussion was only about generic methods.
From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Ryan Riley Sent: Friday, January 09, 2009 2:33 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Generic method synxtax How would this look for instantiating a generic object? my_object = Foo.method(:new).of(Bar).call That seems strange. Perhaps we need to possibilities: the above for generic methods and the following for generic classes: my_object = Foo.of(Bar).new # where Foo would be defined as Foo<T> in C# my_clone = my_object.clone # where clone would have a C# signature of T Clone<T>() or should that be: my_clone = my_object.method(:clone).of(Bar).call? # and allow my_object.clone to have an overloaded # C# signature of object Clone()? ~Ryan On Fri, Jan 9, 2009 at 3:45 PM, Tomas Matousek <tomas.matou...@microsoft.com<mailto:tomas.matou...@microsoft.com>> wrote: Mine has also an issue that just occurred to me. If you do: class C content.load of(Texture2D), "foo" end "of" resolves to Module#of which would return a C<Texture2D> if C was a generic type or throws an exception. So that's not good either. We would need a different method name for generic method constructor than for generic type. Maybe "method_of"? As for your idea: content.of(T).load is looks backwards. The content is not of T… the load is. I think this would be confusing. Until we figure out some nice clean solution that works in 100% cases, I would implement the following as the first step for generic method support: content.method(:load).of(Texture2D).call("mytexture") (Note, you can do the same in Ruby for regular methods: "foo".method(:center).call(100)) anything else is just a convenience and anyone could define it via standard Ruby means. Tomas
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core