Is Transcript's English orientation a plus or minus?

Frank Leahy frank at backtalk.com
Sun Feb 8 21:29:52 EST 2004


On Monday, February 9, 2004, at 01:45  AM, 
use-revolution-request at lists.runrev.com wrote:

> Of course with Transcript, the = operator means the same thing that 
> the ==
> operator means in other languages. That probably can't be changed 
> anymore or
> everything wouldn't be backwards compatible. So some other kind of
> assignment operator would be needed like

A parser works by looking for "tokens", such as "put" or "set" or "if". 
  When the parser sees the "if" token, it could decide that the "=" 
between the "if" and the "then" is a comparison operator (as opposed to 
an assignment operator).  Similarly, when the parser sees "x = 1 + 2" 
at the beginning of a line, it could recognize this = as meaning 
assignment (as opposed to comparison).

In other words, there's no reason these two couldn't be defined to be 
identical in xTalk:

if a = b then
   put 1 into x
end if

if a = b then
   x = 1
end if

(this latter is the same in VB, for example)

 > Some languages overload = to mean 'defined as' in some contexts and
 >'equals' in others.  Mathematics is in the same situation and some
 >folks use a different symbol to mean 'defined as'.
 >
 >Dar Scott

See the note above -- the context can be used to tell the parser 
whether = means assignment or comparison.

 >Yes, but *only* if it allows both syntaxes. Over the years that I've
 > watched languages evolve, they too often leave a syntax behind as they
 > evolve to a new one. Dot notation isn't hard to learn, but it, again,

The first versions of Lingo (Director), which was quite similar to 
HyperTalk, supported both "put" and assignment = syntax, so you could 
write either "put 1 into x" or "x = 1".  There's no reason xTalk 
couldn't do the same.

 > x = y + z (instead of put y + z into x)
 > x += 1 (instead of add 1 to x)
 > x.myProperty = foo (instead of set myProperty of x to foo)"
 >
 > Sorry, Frank, but I just flat disagree. Those syntaxes -- in 
particular
 > the far-too-cryptic and unreadably annoying "x += 1" -- are 
off-putting
 > to all but professional programmers with backgrounds in C/C++/Java. 
And

Disagreeing right back at you.  If you want professionals to use Rev, 
then you need standard assignment statement syntax -- without them 
Revolution looks like a hobbyist language rather than a real working 
language ("oh, it's just HyperTalk, and we all know that wasn't a 
'real' language/development environment")  And since it's perfectly 
possible to support "x = 1" without affecting the current "put" and 
"set" statements, I would argue that they should consider adding it.

[changing topics]

 >Removing exceptions can simplify xTalk and enhance its power.

You mean try/catch/end try?  It might simplify things, but it sure 
won't enhance anybody's power.  There are numerous places that common 
functions can fail in xTalk (e.g. set the fileName of an image to an 
alias file -- oops)  Since xTalk has no consistent failure reporting 
mechanism, exceptions are really the only reasonable way to handle 
exceptional conditions without having tons of if statements littered 
throughout your code. (What, you mean you don't handle error 
conditions?  Shame on you :-)


 >For example, if 'f()' is a built-in function then we can apply it as
 >'f()' or 'the f'.  By why limit this to built-in?  Why not allow this
 > for custom functions, too?

I'd second this idea as well.

-- Frank





More information about the use-livecode mailing list