[Grace-core] [Minigrace] In praise of consistency

Michael Homer mwh at ecs.vuw.ac.nz
Tue May 29 15:08:46 PDT 2012


On Wed, May 30, 2012 at 4:57 AM, Andrew P. Black <black at cs.pdx.edu> wrote:
>
> On 18 May 2012, at 18:48 , Michael Homer wrote:
>
>> They already have two entirely different meanings: one is precedence
>> grouping and one is application, and that isn't avoidable unless
>> application uses something else.
>
> I believe that this is the discussion we are having.  I don't think that the parenthesis
> should mean adding arguments to a method request.   You do.
But then you go on to say...
>> As soon as something has more than
>> one argument you're going to have to parenthesise them.
>
> Yes, I agree with that.  I was trying to think of this as a single argument that's a tuple, but
> right now we don't have tuples.
These were one point - parentheses already mean application when there
are multiple arguments. They also mean grouping in a different
context. If removing an argument makes them mean something different
that seems like more of a problem.

Tuple-passing was in the spec at one point, but it gets very
confusing. In particular, it seemed that Tuple had to be the top type
or else single arguments wouldn't behave properly. There's no type
information to disambiguate.
>
>> One of the major problems is that you don't know you're in a mixfix
>> name until after the argument is parsed, but you will need to know it
>> in order to parse the argument.
>
> Is that really true?  If so, we need to fix our method request syntax.
It seems to be inherent. You can't figure out where the argument stops
unless you know where the next part of the method request starts, or
you parse it until it stops on its own.
>> Something like:
>>  print x.y(z) a b
>> could be:
>>  print (x.y(z))a(b)
>
> Yes, that's requesting print()a() using my "as far right as possible" rule
But why is x.y not going as far right as possible first? It could just
as well take the a, and you don't know either that the a is coming or
that there is a print()a() method when you're parsing it.

Or what is:
  print is 5 between 4 and 7
  print is 5 between 4 and 7 on output.mainStream
? I think you must be making them a syntax error because "5" is not an
identifier. So I guess really there is a juxtaposed-argument context,
in which you can only make non-mixfix requests without any arguments.
It seems more complicated than others, but it does allow 'print
"hello".reversed' and other simple calls in-place if that's important.
I don't know where operators end up in that.
-Michael


More information about the Grace-core mailing list