« Return to Thread: Syntax for generic parameter declaration

Re: Syntax for generic parameter declaration

by Avishay Lavie :: Rate this Message:

Reply to Author | View in Thread


I thought about having the constraints right after the parameters, but
I really don't like the braces to indicate multiple constraints.

How about:

  public class MyGenericClass[of T1, T2]
    when T1 is struct
    when T2 is IComparable, callable

This uses existing reserved words, although I'm not sure about using
"callable" to indicate a default constructor constraint.

On May 22, 4:15 pm, Daniel Grunwald <dan...@...> wrote:
> This is the syntax VB uses:
> Public Class MyGenericClass(Of T1 As Structure, T2 As {IComparable, New})
>
> As Boo is also using "of" and "as", we could use something similar.


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