Artifacts Associated With Ticket b108e00ac8b1b6e4
Ticket change [b76c2174c0] (rid 250171) by apnadkarni on 2026-01-05 16:48:39:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
In my opinion, the second line below should raise an error as the value being assigned does not match the existing value. ``` % const v 2 % const v 3; # Should raise an error ```
- is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
Defining const with a different value should raise an error
- type initialized to: "Bug"
Ticket change [c65f0cd80a] (rid 250300) by juliannoble2 on 2026-01-11 01:35:41:
- icomment:
I would find const more useful if it raised an error in this case. Intuitively it's what I initially expected. Tip 677's statement: "The variable must not exist prior to const creating a constant variable (unless it is a constant variable; in that case, const silently does nothing)." makes no mention of value checking in this case - so I assumed it was deliberate.
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [1f31df1a51] (rid 254430) by sebres on 2026-06-18 17:23:54:
- icomment:
Short excerpt of a discussion from tclchat: <pre style="padding-left:10pt"> <sebres> shall not [const] with another value as previously throw an error? I mean: <sebres> % const A 5; const A 5; set A; #=> 5; # this is expected (cause can happen by source 2nd time), but... <sebres> - % const A 5; const A 6; set A; #=> 5 <sebres> + % const A 5; const A 6; set A; #=> [e] can't change "A": variable is a constant <sebres> imho, the former (-) is wrong, something like letter (+) shall happen instead <apn> @sebres - see ticket [b108e00ac8] <sebres> thx, Ashok... I'll try to fix it now <apn> @dkf might want to opine <apn> as to the rationale as I think the current behaviour is explicitly stated in the TIP <sebres> then it is wrong anyway <sebres> [set A 6] is prohibited, but "change" using [const] is allowed (however it's not changed)... either it shall be RO completely... or it must be changeable (with [const]) <sebres> doing as it would be changed successfully is simply wrong, no matter what TIP says about </pre>
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [597d100e1a] (rid 254442) by apnadkarni on 2026-06-19 04:57:58:
- icomment:
Further from the chat: DonalFellows (via ischain) 2026-06-18 20:14:51 UTC – 2026-06-18 20:15:43 UTC The problem is how to handle someone putting [const X [expr {...}] inside a loop. I'm uncertain which way to go there. apn (via ijchain) 2026-06-19 04:22:26 UTC – 2026-06-19 04:22:48 UTC A loop does not introduce a new scope so I would say it should behave like anywhere else - const c $X; const c $Y should raise an error unless $X == $Y Or to be more precise, $X eq $Y - login: "apnadkarni"
- mimetype: "text/plain"
- icomment: