The paradigm of containers and self-referenced names

Ken Ray kray at sonsothunder.com
Thu Mar 24 16:10:56 EST 2005


On 3/24/05 2:28 PM, "Mark Wieder" <mwieder at ahsoftware.net> wrote:

> JLG> For those of us who have used all the various forms of xtalk over lo
> JLG> these many years, the lack of variable typing and the ability to use
> JLG> variables without first declaring them is a major breakthrough feature
> JLG> of a modern programming language.
> 
> Actually I'd like variable typing as well <g>. But only when I want
> it. Otherwise I also like the freedom and the fact that the engine
> converts everything for me. No more ugly casts. Not declaring
> variables before use, though... consider
> 
> on Gimme val1, val2
> 
>   put val1 * 10 into val3
>   put val2 * 5 into val5
>   return val3 + val4
> end Gimme
> 
> where I accidentally typed "val5" instead of "val4" (slip of the
> finger). You're not going to find this error (if you find it at all)
> until runtime. The simple addition of the line
> 
> local val3, val4
> 
> and enabling variable checking allows you to catch the error at the
> time you click the "Apply" button. Why not let the compiler help you?

Because for every variable you wish to use, even temporarily, you need to
type both the variable name *again*, along with the word "local"... that is,
you have an aggreagate of a lot more typing.

Personally, I am quite happy that Rev doesn't enforce variable declarations,
but I'm also quite happy that Rev allows those that want it to turn it on.
This is one of the reasons I haven't made the leap from VB to VB.NET... VB
is like Rev - you can turn explicit delcarations on or off with "Option
Explicit", but you can't in VB.NET... you *must* declare everything there.

I'm more like Jacque in this... I use declarations infrequently and only
when needed (in fact, I'd even love to make a global declaration once then
never again, regardless of what script you're in, but that's me...).

I think it is the flexibliity to turn it on or off as suits the developer
that makes Rev a more comfortable programming environment.
 
> JLG> Is it sloppy programming to use a language as it was intended?
> 
> Possibly. Look at (shudder) COBOL. Who in their right mind would
> invent a "continue" statement?

And I *still* think that allowing for unquoted string literals is a bad
idea. Even though every xTalk language has allowed for it, it is so prone to
problems that if this small feature of xTalk were gone, I wouldn't miss it.
But in reality I don't miss it anyway, since I don't use unquoted string
literals myself. It's more for helping others who have mistakenly done
things like:

 put "apple" into tFruit
 put theFruit into theSelectedFruit

and wondering why "theSelectedFruit" holds the string "theFruit"
(personally, I think it should hold an empty string). But what can you do...
at some point this becomes purely academic unless it is logged into Bugzilla
and voted on vociferously.

:-)

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list