Let's let Tomas implement content.method(:load).of(Texture2D).call(“mytexture”) 
... and then we can play around with the different syntax in context. Then it's 
pick-the-syntax-you-want =)

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Ryan Riley
Sent: Friday, January 09, 2009 1:51 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Generic method synxtax

I like Tomas's idea the best. Generics are not native to Ruby, so most people 
using them will likely have a C#/VB background, which means Tomas's syntax 
would be more familiar.

The "_of" syntax isn't bad, but forcing a ".do" or ".call" at the end isn't 
ideal, even if it does have a bit of a Ruby flavor.

Adding a ".of()" to the class is okay, but many classes may have generic 
methods even when the class itself is not a generic. (I'm thinking primarily of 
static and extension method classes here.)

Passing the generic types as the first parameters seems the most explicit and 
understandable translation to me.

~ Ryan
On Fri, Jan 9, 2009 at 3:12 PM, Jimmy Schementi 
<jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>> wrote:

Here are the ideas that stand out to me:



I like Tomas's idea, since it reads like C#/VB, but adding an argument to the 
front urks me:



content.load of(Texture2D), "mytexture"



Shri, having the "_of" appended to a generic method name and requiring a ".do" 
after it is how you would work with lambdas (except you do ".call"), but since 
we're talking about .NET methods, not .NET delegates. So, I'd like the syntax 
to look more like a method call. Also, as Tomas says, mangling gets more 
complicated ...



content.load_of(Texture2D).call "mytexture"



How about adding an "of" method to the class/object, to put the class in a 
generic "mode"? The method probably shouldn't be called "of", but you get the 
idea. It reads different than C#, but seems the most Rubyesk without changing 
the arguments.



content.of(Texture2D).load "mytexture"



Thoughts? If no one likes my idea, I think Tomas's is a fine compromise.

~js

--
Ryan Riley
ryan.ri...@panesofglass.org<mailto:ryan.ri...@panesofglass.org>
http://panesofglass.org/
http://wizardsofsmart.net/
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to