Re: when did expr foo return foo instead of an generating an error?



On Aug 18, 7:11 pm, "Donal K. Fellows"
<donal.k.fell...@xxxxxxxxxxxxxxxx> wrote:
On 18/08/2011 09:02, jon.seymour wrote:

I wondering in which version of tcl expr foo, for an arbitrary foo,
returned foo instead of generating an error. [ 8.0 generates an error,
8.4 returns foo ]

It doesn't work for arbitrary foo. Just selected values — specifically,
things that are "integers", "floats", and "booleans" — and that's it.
Arbitrary barewords are just errors (we might assign semantics to them
in the future, but not yet).


Sorry, I generalised to expr foo from expr y, without realising that y
was also a special case.

Also, when did expr start to treat true and false as boolean values?

I think it really arose from the changes associated with Bug 218000,
when I was tidying up the principles of what literals should be accepted
in expressions (as part of a dive into the expression parser). That
would put it as appearing in Tcl 8.4b2.


Ok, thanks for the history.

I was curious because I noticed a difference in behaviour between my
tcl implementation (8.4.19) and a Jacl implementation that appears to
be based on 8.0.

For the record, 8.4.0 supports expr true && true. 8.4.10 supports expr
y && true.

jon.
.