Re: namespace variable not seen by [info exists]

From: Martin Lemburg (martin.lemburg.ugs_at_gmx.net)
Date: 10/29/04

  • Next message: Donald Arseneau: "Re: BLT problem"
    Date: 29 Oct 2004 05:00:50 -0700
    
    

    Hello Rolf,

    the explaination is really simple!

    The "variable" command used only with a variable name, declares only
    the variable, but does not set the variable!

    The man page of "variable" tells:

        "If no value is specified, the new variable is left undefined."

    So - using ...

        % variable foo

    must cause ...

        % info exist foo
        0

    But - using ...

        % variable foo bar
        bar

    must cause ...

        % info exist foo
        1

    A declared, but undefined variable will be reported by "info vars"!

    That's all!

    Best regards,

    Martin Lemburg
    Unigraphics Solutions GmbH - UGS The PLM Company

    Rolf Schroedter <me@privacy.net> wrote in message news:<2ue68vF28sqaiU1@uni-berlin.de>...
    > A namespace variable which is declared by [variable bar]
    > is seen by [info vars] but not by [info exists].
    > Is this a bug or feature ?
    >
    > % set tcl_patchLevel
    > 8.4.6
    > % namespace eval ::foo {variable bar}
    > % info vars ::foo::*
    > ::foo::bar
    > % info exists ::foo::bar
    > 0
    > % namespace eval ::foo {variable bar 1}
    > % info exists ::foo::bar
    > 1
    >
    > Rolf.
    >
    > ---------------------------------------------------------------
    > Rolf Schroedter, German Aerospace Center
    >
    > Remove .nospam to reply: mailto:Rolf.Schroedter@dlr.de.nospam


  • Next message: Donald Arseneau: "Re: BLT problem"