[Nickle] Nickle bug(?), feature(?), misfeature(?)

Bart Massey bart at po8.org
Wed Sep 22 10:10:10 PDT 2004

In message <E1CA9g2-0000pz-Pa at evo.keithp.com> Keith wrote:
> If you
> want to just have a raw interpreter running, use
> NICKLESTART=/dev/stdin nickle

Or, on machines without /dev/stdin, /dev/tty will work.  Thanks!

> > The "try" statement doesn't currently create a new scope for
> > its body statement.  Upon reflection, I claim this is a
> > feature, as it allows
> It may be a feature, but it's rather inconsistent with every other 
> statement form...

That's OK: the question is whether we'd rather have it be
inconsistent or inconvenient :-).  It's at least not
inconsistent with C, which has no "try" statement to worry
about :-) :-).  This is something that drives me nuts in
Java, so IMHO it is worth fixing.  I would estimate that
probably 90% of my usages of Java "try" are to initialize
some variable, and the little dance you need to do is really
annoying and error-prone.

I committed a patch to get "try" with a block body to be the
same as it is now with a statement body.  Let's try it and
see if it drives folks nuts?  I'm guessing it won't, since
the inconsistent behavior of simple and compound statements
was never reported :-).  For me, at least, it will make
"try" much more usable.

Another possibility would be to make "try" be an expression
form rather than a statement form, but offhand this seems
ugly in the extreme.

> > This points out that we may be creating two scopes for every
> > body: one for the statement and one for the curly braces.
> > Does the compiler omit empty scopes in the static chain?
> Scopes are free -- they're purely a lexical notion; once compiled, they 
> have no effect.

Scopes are free, but closures are not.  After looking at the
code, I think I see the light: you're storing variables for
blocks in the closure of the enclosing frame, I think.
Thanks for the clarification.


More information about the Nickle mailing list