« Return to Thread: Syntax for generic parameter declaration

Re: Syntax for generic parameter declaration

by Rodrigo B. de Oliveira :: Rate this Message:

Reply to Author | View in Thread


I had these notes hanging around here:

class Whatever of T:
    given T(), T isa IEnumerable # combining in the same line
    given T() # single constraint per line is also possible
    given T isa struct

I like the way they read. And given was a planned keyword.

How do you like it?

On 5/22/07, Avish <some.avish@...> wrote:

>
> Hello.
>
> Is there a proposed syntax for generic parameter declarations?  It's
> easy enough to declare generic parameters without constraints:
>
>   public class MyGenericClass of T:
>     pass
>
>   public class MyGenericClass[of T1, T2]:
>     pass
>
> But I have no idea what the syntax should be for constraints.
> In C#, generic parameter constraints are introduced after their type
> declaration, by using the where keyword:
>
>   public class MyGenericClass<T1, T2>
>     where T1 : struct
>     where T2 : IComparable, new()
>
> How would this be written in Boo?
>
>
> >
>


--
bamboo

--~--~---------~--~----~------------~-------~--~----~
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