Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-10-27
02:44 • Ticket [1027849fff] Slight clarification on expr man page would be helpful s... artifact: 0bf8efce92 user: dgp
02:44 • Ticket [1027849fff]: 1 change artifact: fba509a627 user: dgp
2004-10-26
17:25 • Closed ticket [1027849fff]. artifact: 208e111438 user: dkf
2004-10-04
21:02 • Ticket [1027849fff]: 3 changes artifact: 4e850475bd user: dkf
21:01 • Ticket [1027849fff]: 1 change artifact: 6e87f4132a user: dkf
21:01 • Ticket [1027849fff]: 1 change artifact: 3893d805b2 user: dkf
2004-09-14
11:46 • New ticket [1027849fff]. artifact: e20b453e5e user: lvirden

Slight clarification on expr man page would be helpful

Closed / Fixed1027849fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-09-14 11:46:20
Currently, the expr(n) man page leaves readers a bit
confused concerning the special limitation on operands
that expr requires.

In the rest of Tcl, a single word string value need not
be quoted.
However, in expr , this string format must be quoted. 
This is specifically documented in expr(n) in operand
formats 3 and 4.

HOWEVER, earlier in the man page, the doc goes through
the interpretation of the operands and states that if
the operand matches any of the integer formats, it will
be treated as an integer, then if it matches any of the
floating number formats, it will be treated as a
floating number.  The man page then states "[i]f no
numeric interpretation is possible, then an operand is
left as a string [...]".  It seems to me that the man
page, at this point, should say:

If no numeric interpretation is possible, and the
operand is enclosed in either double quotes or braces,
then the operand is left as a string [...].
If none of these cases are true, expr will treat the
expression as a syntax  error.

This would clarify to the reader the case they may miss
concerning the error.
dkf Ticket [1027849fff]: 1 change [History diff]2004-10-04 21:01:38
dkf Ticket [1027849fff]: 1 change [History diff]2004-10-04 21:01:39
dkf Ticket [1027849fff]: 3 changes [History diff]2004-10-04 21:02:20
dkfplain2004-10-26 17:25:16
Logged In: YES 
user_id=79902

It would also be wrong; you're mixing up literals and operands.

Added some extra text to clarify. Fixed in HEAD
dgp Ticket [1027849fff]: 1 change [History diff]2004-10-27 02:44:22
dgpplain2004-10-27 02:44:23
Logged In: YES 
user_id=80530

backport.
Log in (anonymous is fine) to add a comment.