jastrachan | 2 Apr 10:26 2004
Picon

Re: a plethora of optionals

On 1 Apr 2004, at 22:32, Chris Poirier wrote:
> Hi Jon,
>
>> I felt Chris Poririer's examples were contrived examples outlining the
>> negative edge of what happens if you don't have semi-colons. This is 
>> why
>> it connects almost directly to my "philosophical" discussion about
>> enabling/directing: Are we going to force everyone to use semi-colons
>> because it is possible to write really weird code with it? That is to 
>> me
>> a directing attitude and in my opinion does not belong in Groovy. Can 
>> we
>> write a parser that handles the lack of semi-colons? In that case, we
>> should just go for it because at the end of the day it makes the code 
>> so
>> much cleaner.
>
> I only wish they were contrived, but they are real examples from real
> code.  And it's not that they were weird that bugs me, it's that it
> required a romp through the compiler to figure out where the disconnect
> was.
>
> Ruby has several advantages we lack: it uses braces only for two things
> (hashes and closures), and never one in the other's place; it has no
> type markers /ever/; variables all have builtin writability and scope
> markers; and there is no operator/keyword syntax for dealing with types
> (types are just objects, meta operations are just methods).  Ruby
> produces its symbol tables on the fly, and you can never refer to
> objects not explicitly created (and of particular importance, you can
> never refer to classes you haven't explicitly imported).  These are 
> very
> significant simplications, and trying to behave like we have them when
> we don't won't work.
>
>
>> I don't believe it confuses a lot of people. Ruby has exactly the same
>> solution as Groovy does now, and it works perfectly fine. Most people
>> pick up Ruby really fast, and they actually feel Ruby is very 
>> intuitive.
>> If someone gets confused by the lack of semi-colons, they could just 
>> as
>> well use them.
>
> Once again, you are over-simplifying.  The problem is not that
> semi-colons are optional, it's that they /appear/ to be optional, and
> almost are, in some cases, but not quite.  Ruby has simpler syntax, and
> it's rules about when an EOL is an EOS are simpler because of it.  In
> Ruby, for a line to continue, it must end in an operator that requires
> more symbols.
>
> At present, our EOL/EOS rules are very unpredictable because they are
> intricately special-cased (in part because of all the interactions
> between optional things).  We allow the continuation operator to follow
> on the next line, and that is a massive complication.  (It may need to
> go.)

I didn't think we ever added this?

> But, even ignoring that, our language is littered with (also
> optional) typing operators that complicate everything.

Agreed - we absolutely need to go through these issues in depth to 
ensure that we have a simple & understandable language.

> So, the problem is not that the semi-colon can be used when there is a
> problem.  It is that the semi-colon may not be enough, because the
> compiler may infer additional statements, in spite of them.
>
> Finally, if I have trouble predicting what the parser will do, having
> spend the last month working on it, I think there is a reasonable
> likelihood that other people will, too.

Agreed. Though this is the whole point of the JSR - to define a formal 
language specification and by doing so if we can't understand or 
describe the rules simply ourselves then we have to change the rules :)

James
-------
http://radio.weblogs.com/0112098/

Gmane