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.
.



Relevant Pages

  • Re: Funny difference between aliases and args
    ... the reason that is safe is because it negates s own round of substitutions. ... So, of course, the reason why [expr] doesn't work the same way as [foo] is because it wants to do its own substitutions and it is the Tcl round that needs to be disabled -- hence the braces. ...
    (comp.lang.tcl)
  • Re: Difference between is and ==
    ... foo is not None ... - use `is' to compare identity ... and a point about values in Python that was brought ... if expr is None: ...
    (comp.lang.python)
  • Re: when did expr foo return foo instead of an generating an error?
    ... returned foo instead of generating an error. ... when did expr start to treat true and false as boolean values? ... jon. ... I generalized inappropriately from expr y. ...
    (comp.lang.tcl)
  • Re: How to solve this
    ... My solution was the easy way out here: The macro creates an expression ... at compile time which does the right thing in this case. ... is not know when foo is expanded. ... expr is an expression using a, b, and c ...
    (comp.lang.lisp)
  • when did expr foo return foo instead of an generating an error?
    ... I wondering in which version of tcl expr foo, for an arbitrary foo, ... returned foo instead of generating an error. ...
    (comp.lang.tcl)