[Grace-core] Syntax questions
James Noble
kjx at ecs.vuw.ac.nz
Mon Nov 8 18:30:02 PST 2010
Hi Kim
Quick responses....
Just done a viva..
Sent from my iPhone
On 9/11/2010, at 14:39, Kim Bruce <kim at cs.pomona.edu> wrote:
> My student Eric (copied on this message) is starting to write Grace
> code, but we have not nailed down some of the specific syntax yet.
> Here are some questions and proposed answers:
>
>
> 1. How do we write function types? S => T or S -> T
> Proposed answer: S => T (like Scala)
Sure. This is the *type* right, not the function...
> 2. How do we write anonymous n-ary functions? (x:S,...) =>
> {...} or {(x:S,...) => ...}
> Proposed answer: (x:S,...) => {...}
That's OK sure - why not with arcs inside the braces without the parens?
>
> Default abbreviation: 0-ary functions can be written as () =>
> {...} or in the abbreviated form {...}
Yes very important whatever happens with layout.
> 3. Pattern matching notation: myExp match {case ...
> => ...; ...} or match myExp {case ... => ...; ...}
> No strong feelings. The first is Scala syntax.
I prefer the second, makes Grace syntax more consistent.
> 4. Built-in simple IO: how do we write simple reads and writes?
> We could have a default system I/O object, io, that is visible
> anywhere and then write output as either: io.printline(s) or
> s.printline(io). Similarly with print, read, readline.
> Are you OK with these names, and which order should we write them?
> Proposed answer: io.printline(s) as that makes it easier to read
> if we construct complex strings to print.
Sure.
> I'm still concerned about our numeric types. See comments on the
> wiki in the Built-In Types section. However, if we could just clear
> these questions up rather quickly, then Eric can make some progress.
This is just my 5c
Hope it helps
J
> Kim
> _______________________________________________
> 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