variable existence checking

Tony Balinski ajbj at free.fr
Fri Jun 8 15:05:22 CEST 2007


Quoting "A.V.Kuznetsov" <kuzn at umps.mephi.ru>:

> Hi,
>
> the discussion went out. To avoid losing of the feature,
> can I add it to the Niki's Feature Wishlist?

You can... but if you ever hope to have it see the light of day, help with the
design, and maybe even supply code.

This is a big deal in the NEdit macro language. So far, any unset variable can
only do one thing: receive a value. Anything else causes the macro to fail.
With my ?? proposed operator this would be extended to testing for existence.
The typeof "function" would require that the unset "value" can be passed to a
function (unless it's implemented as a keyword!). One small step to assigning
a variable with the content of another; Boolean tests (any expression with
unset variables are false); participation in arithmetic (unset == 0 say, as in
Awk)...

Actually, I like JavaScript's way of handling this, but I don't know (I
haven't made up my own mind) if this is what we need in NEdit. I like NEdit
macros breaking "early" because I didn't code something properly. I also don't
like the idea of making the behaviour change according to a setting: then you
can never have macros that are compatible between users. If we change this, we
change it for everybody.

I'd still like to see other things there first: most of my syntax enhancements
in fact! And proper macro memory management: I've a load of source code that I
never integrated to do this, because the job is pretty huge, and I don't have
too much contiguous time available outside the day job.

Tony


More information about the Discuss mailing list