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

Michael Homer mwh at ecs.vuw.ac.nz
Sat May 26 13:26:29 PDT 2012


On May 27, 2012 6:56 AM, "Kim Bruce" <kim at cs.pomona.edu> wrote:
>
> 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?
According to the specification, the only way of interpreting that should be
a syntax error. The parser was just inadequately picky and gave it a weird
interpretation instead. Method signatures in types have the form:
  apply(_ : Number) -> Number
, just like method declarations do. It shouldn't, and now doesn't, allow
multiple names on one line.

The type syntax is ambiguous between anonymous types and blocks, but they
appear in different contexts. Something like:
  { x -> Number }
could be either, but you'd know by whether it appeared where you expect a
type or not.
-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailhost.cecs.pdx.edu/mailman/private/grace-core/attachments/20120527/bd558cbc/attachment.html>


More information about the Grace-core mailing list