Dependence on Programming Experts

Alex Tweedly alex at tweedly.net
Thu Jul 13 13:49:33 EDT 2006


Rob Cozens wrote:

> Moi:
>
>>         if recordNumber = 1 then set the disabled of button "Previous 
>> Record" to false
>>         else  set the disabled of button "Previous Record" to true
>
>
> Should be:
>
>         if recordNumber = 1 then set the disabled of button "Previous 
> Record" to true
>         else  set the disabled of button "Previous Record" to false
>
> But that wasn't my main point.
>
> In my reply to Josh, I noted his request would break existing syntax.  
> IMO that should end the discussion.

(I may have got lost in the length of this thread, but ...) I don't see 
what would break existing syntax.

The proposal I remember is to allow
   <container> = <expression>
anywhere a statement is allowed  - i.e. as a statement on a (logical) 
line, or following an IF <expr> THEN ...

Your example was
   set the disabled of button "Previous Record" to (recordNumber = 1)
i.e.
   SET <container> TO <expression>

which wouldn't look much like the new (optional) syntax to any parser I 
can think of. The fact that "recordnumber = 1" *could* be an expression, 
or *could* be a statement shouldn't be a problem - the context will 
*always* tell you which it is; currently Transcript doesn't allow 
expressions to be written where a statement is required, so there is no 
ambiguity.

The only somewhat odd, almost ambiguous, case would be
   x = y = 5
which could mean the same as
   put (y=5) into x
or *could*, if RR chose, mean the same as
  x=5; y=5
(i.e. as it does in other languages). But that's an ambiguity in a 
newly-allowed case, and so can be resolved and documented from the start.

If there is any case that you can find that is ambiguous to a standard 
recursive descent parser, please tell us. (I assume RR uses a parser 
that is at least as capable as a trad recursive descent one - probably 
it's more capable).

FWIW (i.e. nothing :-), I would love to have the option of writing  
"x=1" instead of "put 1 into x".  There isn't a day, barely an hour, 
that goes by when I'm working in Rev that I don't trip over that. I keep 
thinking I'll "get over it", but I think I just passed the two-year mark 
as a Rev user, so I have to admit I'm not going to get used to it as 
long as I sometimes use other languages as well. If I could ever become 
solely a Rev coder I might have a chance - but as long as the range of 
problems I am interested in is so wide that Rev isn't the best tool for 
them all, that's not going to happen.

BTW - (with wicked grin on face) - if we did convince RR to allow
   x = 1
should we also ask for
  x += 1    # I'd say "yes"
and how about
  x++        # I'd say "no, let's retain some modicum of good taste :-)"

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.10/387 - Release Date: 12/07/2006




More information about the use-livecode mailing list