Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-18
21:14 • Pending ticket [8ab06e31e3]: Compiled self n returns the namespace instead of ... artifact: 0d9ffd7248 user: jan.nijtmans
2026-10-15
21:41
Fix [8ab06e]: compiled [self n] should be ambiguous (typo) check-in: ab0f4178ff user: jan.nijtmans tags: core-9-0-branch
21:40
Fix [8ab06e]: compiled [self n] should be ambiguous check-in: dd6ea5a7e8 user: jan.nijtmans tags: core-9-0-branch
21:01
Fix [8ab06e]: compiled [self n] should be ambiguous check-in: 7cd1d5bbe9 user: jan.nijtmans tags: trunk, main
2026-10-14
08:03 • Ticket [8ab06e31e3] Compiled self n returns the namespace instead of an ambigu... artifact: 7484c2e45f user: serhiy.storchaka
08:02
Fix [8ab06e31e3]: compiled [self n] returned the namespace instead of the "ambiguous subcommand" err... closed check-in: 313bb0bb1d user: serhiy.storchaka tags: compile-self-ambiguous
2026-10-12
20:37 • Ticket [3069454fff] difference between bcc'ed and eval'ed regexp sta... artifact: 49311822fd user: serhiy.storchaka
20:36 • New ticket [8ab06e31e3] Compiled self n returns the namespace instead of an am... artifact: 2221850e00 user: serhiy.storchaka

Compiled [self n] returns the namespace instead of an ambiguous subcommand error

Pending8ab06e31e3af6141118a547d52e4636fba9ef252Created 51 days agoUpdated 45 days ago
Descriptionwiki2026-10-12 20:36:12
self n is an error ("ambiguous subcommand "n": must be call, caller, class, filter, method, namespace, next, object, or target"), but in compiled code it is accepted as self namespace:
oo::class create C {method m {} {self n}}
[C new] m

The compiler accepts any prefix of namespace, including n, which is also a prefix of next. It has done so since [acbaf52e6e]. na should be the shortest accepted prefix. Since this turns code that works now into an error, the fix is for the next feature release.

Referenced by2
  • 313bb0bb1dFix [8ab06e31e3]: compiled [self n] returned the namespace instead of the "ambiguous subcommand" error of the command, since n is also a prefix of next. Require at least "na" for namespace. check-in2026-10-14 08:02:17
  • 49311822fdTicket [3069454fff] difference between bcc'ed and eval'ed regexp status still Open with 3 other changes ticket2026-10-12 20:37:46
serhiy.storchakawiki2026-10-14 08:03:19

Proposed fix in branch compile-self-ambiguous: the compiler now requires at least na for namespace, so self n gets the "ambiguous subcommand" error from the command. Test oo-29.2.

jan.nijtmanswiki2026-10-18 21:14:13

Now merged to [trunk] and core-9-0-branch.

Merge to core-8-6-branch still to be done.

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