| Ticket UUID: | fd2d126f231e1c228ff250b220823d76967bd506 | ||
| Title: | Wrong proc doesn't guives an error | ||
| Type: | Bug | Created on: | 2015-05-16 00:53:50 |
| Submitter: | anonymous | Assigned to: | msofer |
| Subsystem: | 22. [proc] and [uplevel] | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2015-05-17 11:06:38 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | |||
| Description: | ||||
This proc
proc oneFunction {a {b 1} c} {puts "$a $b $c"}
doesn't guive an error. It's accepted by the interpreter. I think all the optional arguments should be at the end.
| ||||
| User Comments: | ||||
ferrieux added on 2015-05-16 11:41:33:
The reason it is accepted, is that {b 1} is a valid arg name.
I admit it would make sense to forbid whitespace in arg names except for default ones (end of list), but after decades without the rule there's a (small) risk of compat breakage. Maybe for 9.0 ?
dkf added on 2015-05-17 11:06:38:
No, each formal argument has always been a list. It's just that proc has simply never checked for this failure mode. At some point we might get around to making optionals-in-the-middle work. But for now, it's a (really) low priority, especially as it is a performance-sensitive area. Making this be a declaration-time error would be reasonable. The only concern would be how much of an impact on existing (non-working) scripts this would have. | ||||
