« Return to Thread: Syntax for generic parameter declaration

Re: Syntax for generic parameter declaration

by George-94 :: Rate this Message:

Reply to Author | View in Thread


The variant
public class MyGenericClass[of T1 is struct, T2 is (IComparable[of
T2], constructor)] is the best. But 'is' has little different meaning
in Boo, so may be

public class MyGenericClass[of T1 (struct), T2  (IComparable[of
T2], constructor)]  ?

On 23 май, 15:35, Wraith <wrai...@...> wrote:

> Is there a specific reason to follow the c# and VB idioms of declaring
> constraints after all the types? IL does this inline for each argument
> which could be cleaner and may well be easier to describe in a
> grammar. Something like:
>
> public class MyGenericClass[of T1 is struct, T2 is (IComparable[of
> T2], constructor)]
>
> I can't say i like the brackets much but it needs some way to separate
> the generic argument listing mode from the constraint listing mode or
> you end up guessing what sort of thing the current identifier is. YOu
> could leave out the commas and use spaces to separate entries but it
> seems somehow unbooish to have a naked whitespace separated list.
>
> Is there any plan to allow explicit covariant and contravariant
> constraints on delegates and interfaces? I think the IL +/- syntax
> works adequately for this as well though you could just add the two as
> keywords for the constraints list.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: Syntax for generic parameter declaration