[Grace-core] Some comments from Tijs on parsing Grace

Prof. Andrew P. Black black at cs.pdx.edu
Sat Jul 23 05:06:14 PDT 2016


> how [does if(_)then(_)else(_)] distinguish between blocks & booleans.  I said something like: "they see if theere's an ifTrueIfFalse method …”

In minigrace, it’s worse than that.  Not only is if(_)then(_)else(_) compiled inline, but the condition has to be the built-in class boolean, or inherit therefrom.  If they aren’t, then we request them to apply themselves.  We could in principle define if(_)then(_)else(_) in terms of ifTrue(_) and ifFalse(_), but I don’t want to do that because of the performance implications.

No one has yet filed a bug report saying that their re-implementation of Booleans didn’t work, so this is low on my list of priorities.

> - method parameters should be mentioned in the spec (as "defs", i.e. unassignable). currently they aren’t

Yes, good catch.  Who should add this?

> -- [[ ]] generics are "syntactic vinegar!!" (and the opposite of Gracefulness)

Yes, indeed.   I think that if your goal at the Grace Workshop was to discourage people from using Grace, you did a good job here.   You could just as easily have used examples like this

	max⟦Number⟧(x, y)

that would have looked good.  If your emacs mode doesn’t yet replace [[ by ⟦ and ]] by ⟧ it should!  

As I mentioned to you after the workshop, the way that Emerald dealt with type parameters was to distinguish syntactically (in the method definition) between explicit type parameters and implicit type parameters.  This is from Emerald TR CRL 91-1



So, in the max example, if the declared type of the first argument is T, the second argument is required to 
conform to T, and the result is guaranteed to conform to T — no type arguments necessary.  You might say that this is insufficiently general, 
in that the first argument might have more operations than the second, and you would be right: it’s an 80% solution.

	Andrew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20160723/07276d68/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.pdf
Type: application/pdf
Size: 641666 bytes
Desc: not available
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20160723/07276d68/attachment-0001.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20160723/07276d68/attachment-0003.html>


More information about the Grace-core mailing list