gracelang / language

Design of the Grace language and its libraries
GNU General Public License v2.0
6 stars 1 forks source link

type arguments to classes and methods #107

Closed KimBruce closed 8 years ago

KimBruce commented 8 years ago

Now that we've changed the syntax for type arguments, is there any reason to block generic parameters from being alone in a method part. E.g., why shouldn't the following be a legal class header?

class matrix [[T]] size (rows: Number,cols: Number) defaultValue (dvalue:T) -> 
                     Matrix[[T]]

Currently minigrace gives an error message: Syntax error: a class must have a '{' after the method header.

kjx commented 8 years ago

Because type arguments are usually optional? Different parts of method names currently have to be separated by delimited arguments.

Or are you proposing to make such type arguments mandatory?

Sent from my iPhone

On 5/06/2016, at 13:53, Kim Bruce notifications@github.com wrote:

why shouldn't the following be a legal class header?

KimBruce commented 8 years ago

That's a good point. It is just much nicer looking to put the type parameters before a method part with parameters.