[Grace-core] A little bit of the String library
Andrew P. Black
black at cs.pdx.edu
Sat May 21 08:48:05 PDT 2011
Folks,
While on a train, with a few hours to kill (and electricity!) I started writing a little bit of Grace code — a start at the String library — because I need more example code to test the parser. My code is attached.
I almost immediately found that I was raising language design questions to which I didn't know the answers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Grace String.gce
Type: application/octet-stream
Size: 2459 bytes
Desc: not available
URL: <https://mailhost.cecs.pdx.edu/mailman/private/grace-core/attachments/20110521/6329e1b2/attachment.obj>
-------------- next part --------------
I'm defining a "StringTrait" object from which other objects will inherit. Do we have a way of putting "abstract methods" in an object? I used the (new) keyword "required" in place of a method body. Should the whole object be explicitly flagged as abstract in some way, or if this inferred from the existence of required methods?
|| for String concatenation?
I wanted to use // for integer division. But we have already taken it to mean "comment". Switch to "--" for comments?
Can we say
const (a, b, c) := method that answers a tuple
I think that we have to allow this. Are the parens necessary? I think that
const a, b, c := method that answers a tuple
parses unambiguously, but maybe it's harder to read?
raise <exception object> for raising exceptions? Or signal? Or throw (I don't like throw, it makes me think of, well, I would rather not say.)
I wanted an enumeration type TotalComparison = greater | less | equal. I defined it as three objects and a comprises clause. This is a type issue, which we know that we haven't yet talked about. Thoughts?
As yet, I haven't put any of these into the grammar.
Andrew
More information about the Grace-core
mailing list