Re: Namespaces
- Posted by Kat <gertie at PELL.NET> Oct 24, 2000
- 641 views
On 24 Oct 2000, at 10:26, Cuny, David@DSS wrote: > Kat wrote: > > >> declare x = 10, y, z = 10 > > > > If you add the declare, you can't do the dynamic > > name generation, cause the programmer would have to > > know all the names of all the vars as she is writing > > the code. > > Yes, they are mutually exclusive. <chatty.mode= still on> You could do a pre-processor if you are prone to typoing your var names. Or, the language could be told to notify the programmer in debug mode when vars are made or assigned, like this: I typed: //set -s %var hello and this appeared: *** Set %var to hello Yeas, it really did appear, how handy is that? > I rather like the dynamic assignment, and if Robert added something like: > > without declarations > > it could be added to Euphoria without (I think) breaking any code. Euphoria > could still allow declarations (for speed and type checking), and allow > 'lazy' programmers to mix in on-the-fly variables. I didn't consider it being lazy as much as it's using the native compiled language to do something faster than the interpreted code. If i used a loop to search a random length array used to hold the vars, i'd expect it to run 10x or more slower. Tests last yr generally bear this out, i switched to the "lazy" way pronto. Storing the parameters of the variable in the name also makes lookup in native code possible and quite a bit faster than nested search loops in interpreted code, especially when you don't know how many parms there are going to be, so you don't know just how deep to write the nested searches,, or even *what* you are searching for.. the *what* would make recursive search routines difficult, imho. I did make one mistake in an earlier email, i think... i'll clarify.. i can use indexed vars with wildmatches in them against a known var name, but doing a wildmatch on a "family" of vars won't return all of them without a loop. Kat