Skip to content
Tcl Source Code History Of Ticket f14b33ec
Login

History Of Ticket f14b33ec

Artifacts Associated With Ticket f14b33ec

  1. Ticket change [50bcecc518] (rid 233053) by emiliano on 2024-09-05 23:59:16:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      In Tcl up to 8.6 creating a command with a leading single colon is forbidden in all namespaces except the root {} namespace:
      
      $ tclsh8.6 
      % namespace eval foo {proc :bar {} {puts hi}}
      can't create procedure ":bar" in non-global namespace with name starting with ":"
      
      This makes sense since such command is unreachable using its fully qualified name. ::foo:::bar resolves to the 'bar' command in the 'foo' namespace, given the rule that 'two or more colons' are namespace separators.
      
      With Tcl 9, however, it's possible to create such command, but it can't be reached using its full qualified name:
      
      $ tclsh9.0 
      % namespace eval foo {proc :bar {} {puts hi}}
      % namespace eval foo {namespace which :bar}
      ::foo:::bar
      % ::foo:::bar
      invalid command name "::foo:::bar"
      
      This change will undoubtely affect a lot of Tk applications since it's common practice to use [namespace which] to fully qualify bindings and other callbacks.
      
      Tcllib will be affected too, for example math::calculus uses [namespace which] to fully qualify procs used as functions.
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "emiliano"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "emiliano"
    13. subsystem initialized to: "21. [namespace]"
    14. title initialized to:
      changed behaviour wrt command names, namespaces and resolution
      
    15. type initialized to: "Bug"
  2. Ticket change [b943036feb] (rid 233279) by oehhar on 2024-09-09 08:44:15:

    1. icomment:
      Thanks for the great finding.
      
      TCL 8.6 documentation says:
      
      <verbatim>
      Extra colons in any separator part of a qualified name are ignored; i.e. two or more colons are treated as a namespace separator.
      </verbatim>
      
      This phrase is not present in TCL 9.0 documentation.
      
      The TTT meeting today proposed to list that as known bugs in 9.0.0 and not delay 9.0.0 for this bug. It is proposed to address this with 9.0.1.
      
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Ticket change [819c7f29fc] (rid 233283) by oehhar on 2024-09-09 09:33:34:

    1. icomment:
      As this change is apparently intentional, it should be mentioned in the migration notes:
      
      [https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9&p], probably chapter "Change in variable name resolution".
      
      I always thouht it personally useful, that namespaces could be constructed by concatenation. Due to that, "::::" was allowed.
      
      And it still works (TCL 9.0b3):
      
      <verbatim>
      % namespace eval ::n1 {variable v1 v1}
      % set ::n1::v1
      v1
      % set ::::n1::v1
      v1
      % set :::n1::v1
      v1
      % set :::n1::::v1
      v1
      % set :::n1:::v1
      v1
      % proc ::n1::p1 {} {puts p1}
      % ::n1::p1
      p1
      % :::n1::p1
      p1
      % :::n1:::p1
      p1
      % n1::p1
      p1
      % n1:p1
      invalid command name "n1:p1"
      </verbatim>
      
      Quite interesting....
      
      Thank you for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  4. Ticket change [e0f464a890] (rid 233284) by oehhar on 2024-09-09 09:44:04:

    1. icomment:
      As it is still working as in 8.6, I revert my requirement to list it in the migration hints.
      
      I was wrong with the documentation change. It is still on the namespaces.n page (I suppose) and the text is still the same:
      
      There are a few remaining points about qualified names that we should cover. Namespaces have nonempty names except for the global namespace. :: is disallowed in simple command, variable, and namespace names except as a namespace separator. Extra colons in any separator part of a qualified name are ignored; i.e. two or more colons are treated as a namespace separator. A trailing :: in a qualified variable or command name refers to the variable or command named {}. However, a trailing :: in a qualified namespace name is ignored.
      
      I would consider it as a bug, that namespaces may start with ":" in 9.0. Those namespaces may never be accessed using the colon syntax.
      
      Thank you,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  5. Ticket change [698ebd455d] (rid 233432) by pooryorick on 2024-09-14 07:19:39:

    1. icomment:
      In my opinion the proper principle for names (variable, procedure, and
      namespace) is that no names should be forbidden in any namespace, and that any
      issues should be resolved in the direction of making this true for Tcl.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [be7b8d4bf0] (rid 233434) by pooryorick on 2024-09-14 08:35:14:

    1. icomment:
      Names that have ambiguous absolute names can be considered private, and this is useful.  Those who don't want the hassle of such names can simply avoid using them to name things.  There's no compelling reason to prohibit any names.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [0db688f230] (rid 233435) by pooryorick on 2024-09-14 08:42:14:

    1. icomment:
      An example for consideration:  <code>dict with</code> creates a variable for each key and gives it the name of the key.  It's useful not to encounter errors when creating these variables.  There are various similar examples.  It's a good idea to be careful about prohibiting things unless there really is a compelling reason.  Tcl is not a bondage-and-discipline language.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [328623f384] (rid 233582) by emiliano on 2024-09-18 21:46:49:

    1. icomment:
      There's already name constraints:
      
      * Names can't contain the namespace separator
      * Namespace names can't be the empty string.
      
      wrt [dict with], there's already several ways it can fail to create the variables:
      
      * The dict contains a key which is the same as the dict variable.
      
      % set foo {foo 1 bar 2}; dict with foo {}
      missing value to go with key
      
      * The dict contains a key which maps to an already existing array.
      
      % array set bar {} ; set foo {bar 1 baz 2} ; dict with foo {}
      can't set "bar": variable is array
      
      * A key resolves to a namespace which doesn't exists.
      
      % set foo {baz::grill 2} ; dict with foo {}
      can't set "baz::grill": parent namespace doesn't exist
      
      The morale is: don't use [dict with] if you don't control the keys.
      
    2. login: "emiliano"
    3. mimetype: "text/plain"
  9. Ticket change [c27c86e2d5] (rid 233683) by pooryorick on 2024-09-19 19:57:46:

    1. icomment:
      In current versions of Tcl the empty string is a valid variable name:
      
      <code><verbatim>
      set {} world
      namespace eval n1 {
      	variable {} hello
      	puts [set {}]
      }
      puts [set {}]
      </verbatim></code>
      
      output:
      
      <code><verbatim>
      hello
      world
      </verbatim></code>
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  10. Ticket change [50f28df654] (rid 235293) by pooryorick on 2024-11-21 15:08:01:

    1. icomment:
      See also [16fe1b5807820bb], which was marked as a duplicate of this issue and closed, even though it was opened years earlier.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"