[Grace-core] [Minigrace] In praise of consistency
Michael Homer
mwh at ecs.vuw.ac.nz
Thu May 17 17:35:14 PDT 2012
On Fri, May 18, 2012 at 12:11 PM, Andrew P. Black <black at cs.pdx.edu> wrote:
> I've been playing with James' example
>
> print "hello".reversed on output.mainStream
>
> This _looks_ ambiguous to me: I though that it meant
>
> request method print()on() (1)
> from (implicit) receiver self
> with arg1 = "hello".reversed
> and agr2 = output.mainStream
>
> So, the rule I proposed in today's meeting — that we require parenthesis whenever there is an ambiguity — would require parens, right? And that would solve the problem, right. Unfortunately, no.
>
> The problem is that while it's easy to come up with a parenthesisation for the second interpretation:
>
> print ( "hello".reversed on output.mainStream ) ,
>
> I can't see a way of adding parenthesis that will make it mean the first.
Surely:
print("hello".reversed)on(output.mainStream)
The rule that came up when I asked exactly this with multi-part names
last year [1] was that arguments had to be parenthesised. That was
later extended to include delimited/literal arguments. Anything else
is ambiguous - particularly, identifiers and method requests can't be
unparenthesised or you don't know whether the next word of the name
goes, or sometimes even if whether is a mixfix name or not.
-Michael
[1] The thread starts here:
https://mailhost.cecs.pdx.edu/mailman/private/grace-core/2011-May/000261.html
More information about the Grace-core
mailing list