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: Difference between and #
    ... The read syntax 'EXPR means (QUOTE EXPR). ... If you evaluate (function foo), and a function foo exists in the lexical ...
    (comp.lang.lisp)
  • Re: flex + yacc problem: partial parsing.
    ... I have done an experiment which shows that the readahead will in fact be ... extract) can be "expr DOTDOT expr" where DOTDOT is a .. ... to the rule associated with that reduction, ... and the scanner has returned another FOO. ...
    (comp.compilers)
  • 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)
  • 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)