Skip to content
Tcl Source Code History Of Ticket 910d67a229
Login

History Of Ticket 910d67a229

Artifacts Associated With Ticket 910d67a229

  1. Ticket change [2a40899de0] (rid 222692) by sebres on 2024-03-05 15:55:58:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      The implementation of <code>[namespace unknown]</code> has a small bug - it works if command is invoked from the frame inside the namespace for which it was set, but it is completely evaded if command is called fully-qualified outside of NS.
      
      Here a diff illustrating proper implementation:
      <code><pre style="padding-left:10pt">
        % namespace eval ::tcl::xxx { 
            proc unknown args {puts "XXX: [uplevel {namespace current}] $args"};
            namespace unknown ::tcl::xxx::unknown
          }
        ::tcl::xxx::unknown
        % namespace inscope ::tcl::xxx { test }
        XXX: ::tcl::xxx test
        % ::tcl::xxx::test
      <b style="color:red">- invalid command name "::tcl::xxx::test"</b>
      <b style="color:green">+ XXX: :: ::tcl::xxx::test</b>
        % namespace inscope ::tcl { xxx::test }
      <b style="color:red">- invalid command name "xxx::test"</b>
      <b style="color:green">+ XXX: ::tcl xxx::test</b>
      </pre></code>
      
      The issue that specified handler doesn't work everywhere prevents many possible usecases like dynamic NS/ensemble commands or fallbacks, or for instance an implementation of NS-based auto-loading by setting of unknown handler for an NS (instead it forces to call slowly global "::unknown" for known/loaded namespaces with registered unknown handler, which normally should be invoked as first).
      
      Because it is already fixed in my fork, it can be relative fast backported here, just must check against NRE (which is different on my side).
      
    5. foundin initialized to: "any"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "50e9528765c18296566374b3fde2df942c394efd"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "sebres"
    14. subsystem initialized to: "21. [namespace]"
    15. title initialized to:
      NS-qualified invocations of command evade [namespace unknown]
      
    16. type initialized to: "Bug"
  2. Ticket change [5bd14828e3] (rid 222698) by oehhar on 2024-03-05 16:26:07:

    1. icomment:
      Donal Fellow commented on the core list:
      
      That’s apparently “not a bug” in that it’s how that feature was designed to work. I’ll merrily admit to being very doubtful that that’s an entirely sane result; it results in [namespace unknown] being one of those features that’s IMO virtually useless. In terms of actual known uses, the only in-core one is TclOO, which uses it to handle definition abbreviations (it was merely the easiest way to customize command resolution in definition scripts, and I recommend that people try to avoid abbreviating definition names).
      
      There seem to be some more uses out in the wild, but I don’t know if they’re making effective use or are actually mostly just (accidentally?) avoiding being in the case which it handles.
      
      Donal.
      
      ----
      
      So, it is more an RFE to fix the design in 9.0 -> do we need a TIP ?
      
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Ticket change [5849319373] (rid 222705) by sebres on 2024-03-05 17:04:23:

    1. icomment:
      The fix is in [76660a84029aa1c1].
      
      Regarding Donals comment, I already saw it in core mailing list...<br/>
      As for "not a bug" and possible RFE, I also knew it'd follow sooner or later (nothing changes here).<br/>
      But Jan asked about the ticket and the solution, so both are here.
      
      I can only say: a feature that was implemented pretty useless (by design or not) can be for sure considered as a bug, isn't it?
      
      Sure it is compat thing more or less, just if someone used it previously only inside the namespace (otherwise it was not usable), this fix would not affect such people at all.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  4. Ticket change [469aa1610e] (rid 222726) by stevel on 2024-03-05 23:17:35:

    1. icomment:
      Do we need a TIP for 9.0?    If it is treated as a bug fix then no, but it must be clearly documented in the release notes.   If anyone objects to it being treated as a bug fix then yes, we need a TIP.  I would assume no to start with.
      
    2. login: "stevel"
    3. mimetype: "text/plain"
  5. Ticket change [ceda4b913d] (rid 222727) by jan.nijtmans on 2024-03-05 23:26:07:

    1. icomment:
      Let's see.
      1) The change doesn't break any existing test-case. Good!
      2) There's a new testcase demonstrating the corner-case. Good!
      
      Implementation looks good to me (cleanly written, as usual for sebres!). It handles a situation apparently not handled before. That looks like a valid bug-fix to me, which doesn't need a TIP.
      
      The bug-fix is written for 8.6, and can (trivially) be forward-merged.
      
      I'm +1 merging this to 8.6 and up, considering it a bug-fix for a corner-case which was not considered before. I don't see any negative impact.
      
      @Donal, do you agree too?
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [4fa6445c7e] (rid 222740) by sebres on 2024-03-06 12:50:12:

    1. icomment:
      There is a small amend [98aab416a2bac6b0] for additional corner case (calling near-fully qualified command <code>foo::bar::xxx</code> from global NS).<br/>
      For some reason there is a deviation, depending on invocation type (compiled/direct/NRE), how <code>TEOV_NotFound</code> may get the command in <code>objv[0]</code>: as <code>::foo::bar::xxx</code> or as <code>foo::bar::xxx</code> (so with and without leading colons).<br/>
      This amend considers that and add still one corner case in test.
      
      To obtain real normalized command name inside the handler one would anyway use something like this (e. g. with auto_qualify like global ::unknown):
      <code><pre>
          # fully-qualified command name:
          lindex [auto_qualify $cmd [uplevel {namespace current}]] 0
          # fully-qualified command name (without auto_qualify):
          regsub -all {(::){2}} [uplevel {namespace current}]::$cmd {::}
          # relative command name:
          regsub {^(::){1,2}foo::bar(::){1,2}} [uplevel {namespace current}]::$cmd {}
      </pre></code>
      
      <i>(Suggestion, just as nice to have)</i><br/>
      For the last (to obtain normalized relative name) one could extend <code>[namespace tail]</code> like:
      <code><pre>
          % namespace tail 
          namespace tail string ?relative?
          % namespace tail ::foo::bar::xxx::yyy ::foo::bar
          xxx::yyy
      </pre></code>
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [e0c940a849] (rid 222754) by sebres on 2024-03-06 19:47:51:

    1. icomment:
      Now I know why it did not completely work initially after back-porting - I had a bit different variant of TclGetNamespaceForQualName (got amended a year later)...<br/>Now it is fully back-ported and new tests added (see namespace-52.14), so it'd always work for a not simple command too (<code>::A::B::C::cmd</code> -> <code>::A::B</code> with unknown, <code>C::cmd</code> is to search, even if <code>::A::B::C</code> is not there, however also if <code>::A::B::C</code> exists, but has no unknown handler.
      
      @Jan<br/>
      <i>> I'm +1 merging this to 8.6 and up, considering it a bug-fix for a corner-case which was not considered before. I don't see any negative impact.</i>
      
      Although I also not believe it'd have any negative impact, I must admit I see one compat thing, so it should at least get a release note (as well as a documentation enhancement), explaining a precedence now - "deepest NS with unknown-handler always wins (regardless from where exactly it was executed)".<br/>
      For instance in case of 2 nested NS with handlers (<code>::A::B</code> and <code>::A::B::C</code>), for the call:<br/>
      <code>namespace eval ::A::B:: { C::cmd }</code><br/>
      it'd invoke handler of <code>::A::B::C</code>, where previously it'd rather invoke <code>::A::B</code> (since the first was not implemented yet).
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [d945f1a93a] (rid 222838) by jan.nijtmans on 2024-03-10 11:28:51:

    1. assignee changed to: "sebres"
    2. closedate changed to: "2460379.97837244"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Fix [1f0f766632e637cc|merged] to core-8-branch and trunk.
      
      Not yet to 8.6 (can always be done later, if desired)
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. severity changed to: "Important"
    8. status changed to: "Closed"
  9. Ticket change [3258ec9867] (rid 223123) by jan.nijtmans on 2024-03-13 15:56:31:

    1. closedate changed to: "2460383.1642564"
    2. icomment:
      [https://core.tcl-lang.org/tips/doc/trunk/tip/689.md|TIP] written now by Harald (thanks!)
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  10. Ticket change [78a4ce402f] (rid 223410) by jan.nijtmans on 2024-03-20 10:13:52:

    1. closer changed to: "nobody"
    2. icomment:
      > Fix [merged] to core-8-branch and trunk.
      
      This merge has now been undone, waiting for the TIP vote. The unkown handler for ::tcl::clock has been added as example to the TIP implementation.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. status changed to: "Pending"