[Grace-core] [Minigrace] type issues in minigrace

Kim Bruce kim at cs.pomona.edu
Sat May 26 11:56:00 PDT 2012


I think the key thing here is that we have to make sure that we don't have syntax that can be interpreted in multiple ways as that will kill novices.

There should only be one way of interpreting
	type T = {apply: Number->Number}
and it should be an object type with method named apply, that goes from numbers to numbers.  If necessary we should change the syntax so that happens.

Michael, can you tell us the other interpretations and perhaps make suggestions on the syntax or even just the grammar that will avoid the problem?

Kim



On May 25, 2012, at 9:19 PM, Michael Homer wrote:

> On May 26, 2012 3:33 PM, "Andrew P Black" <black at cs.pdx.edu> wrote:
>> 
>> 
>> On 25 May 2012, at 18:56, Michael Homer wrote:
>>>> 
>>>> 
>>>> type T = {Number->Number}
>>>> ...
>>> More than that - it's actually a perfectly valid type, to which this
>>> object belongs:
>>>  object {
>>>    method Number -> Number { 1 }
>>>  }
>> 
>> I recall discussing, at some pint n the distant past, whether we should encircle case conventions.  Like method names must begin with a lower case letter.   If we want students to do stuff like that, it's probably better to enforce it.
> But types (I think) can appear inside objects or other types, and so
> have to appear as method names there. At least you'd need to be able
> to write the type of that even if using it as the name of a method you
> wrote wasn't allowed.
>>>> type T = {apply: Number->Number}
>>>> 
>>> The runtime error is because the type has three viable method names in
>>> a row ("apply", ":", and "Number"),
>> 
>> Is : a valid method name?  I thug that it was reserved to mean "here comes a type annotation".   Is it really wise to try and use it for both purposes?
> It's not supposed to be, type-context parsing just doesn't pay enough
> attention to what kind of token it's getting to reject it. I do have :
> as a valid operator character when it's combined with others, but
> perhaps it shouldn't be that either.
> -Michael
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list