Quantcast

TIP #457 change? Re: TIP #471: Add [info linkedname] Introspection Command

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TIP #457 change? Re: TIP #471: Add [info linkedname] Introspection Command

Peter da Silva-2
This is actually a problem for the original intent of this, to avoid having special handling for the name of automatically upvarred variables in TOP #457, for the purpose of referencing the name on the command line for things like error messages.

I suggest that TIP #457 be modified to not reference this at all, and rather specify that if you need the upvarred variable name you use the traditional “upvar” command rather than the named variable “-upvar” syntax.

On 5/19/17, 1:45 AM, "Harald Oehlmann" <[hidden email]> wrote:

    Dear Matthieu,
   
    thank you for the valueable answers.
    No expert here, sorry.
   
    Am 17.05.2017 um 09:37 schrieb Mathieu Lafon:
    >
    >> e) it is a link on a link ?
    >>     set a 1
    >>     upvar #0 a b
    >>     upvar #0 b c
    >>     info linkname c
    >>     -> a or b ?
    >
    > This will return "a" *but* not because intermediate links are
    > followed, but because c will internally be directly linked to a. [info
    > linkedname] will not follow intermediate links if present.
   
    This is interesting. I suppose, there is specification work here.
    The argument "implementation is like that" will probably not be a good
    argument.
   
    I personally don't see the use-case of the command expect to find out if
    a variable is a link in general.
    The returned name has no practical use, as the upvar level is not
    returned. It is not known, if the target variable is in the stack of a
    caller or a global variable. And other introspection commands may not be
    executed, as this requires the level information.
   
    I suppose, the glob-pattern version returns a list, which will be empty
    if there is no such linked variable.
   
    Another question came to my mind. Is the returned variable name with its
    namespace? This would, in a sense, allow to differenciate global and
    stack-frame variables...
   
    namespace eval ns { variable a 1}
    upvar #0 ::ns::a b
    info linkname b
   
    Those questions are not important. I am not in the discussion. You may
    see it as poety slam and ignore it.
   
    Thank you,
    Harald
   
   
   
    ------------------------------------------------------------------------------
    Check out the vibrant tech community on one of the world's most
    engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    _______________________________________________
    Tcl-Core mailing list
    [hidden email]
    https://lists.sourceforge.net/lists/listinfo/tcl-core
   

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP #457 change? Re: TIP #471: Add [info linkedname] Introspection Command

Mathieu Lafon
Hello Peter,

On Fri, May 19, 2017 at 2:19 PM, Peter da Silva
<[hidden email]> wrote:
> I suggest that TIP #457 be modified to not reference this at all, and rather specify that if you need the upvarred variable name you use the traditional “upvar” command rather than the named variable “-upvar” syntax.

TIP #457 does not reference this TIP/command.

This new TIP can be useful with the -upvar specifier of TIP#457 when
it will allow accessing the name of the immediate parent, but it is
not a requirement for TIP#457.

They should be handled as separate TIPs to not confuse users.

-- Mathieu

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TIP #457 change? Re: TIP #471: Add [info linkedname] Introspection Command

Peter da Silva-2
On 5/19/17, 10:12 AM, "Mathieu Lafon" <[hidden email]> wrote:
> TIP #457 does not reference this TIP/command.

Ah, I see now that it does not. Thanks.
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tcl-core
Loading...