From: Bernhard van Woerden on 14 Jun 2010 11:46 I'd like to create a command alias and later do some introspection; firstly I'd like to know if the command is an alias and if so what the target is but $ proc foo {} {} $ interp alias {} bar {} foo but $ interp target {} $bar <empty list> as per the documentation for TCL 8.5 Does anyone have an alternative way to find the target ? Thanks Bernhard
From: Jeff Hobbs on 14 Jun 2010 12:55 On Jun 14, 8:46 am, Bernhard van Woerden <bernh...(a)qcode.co.uk> wrote: > I'd like to create a command alias and later do some introspection; > firstly I'd like to know if the command is an alias and if so what the > target is but > > $ proc foo {} {} > $ interp alias {} bar {} foo > > but > $ interp target {} $bar ^^^^^? ^? > <empty list> > as per the documentation for TCL 8.5 > > Does anyone have an alternative way to find the target ? You have a syntax error or three. This command works as expected. Jeff
From: Jeff Hobbs on 14 Jun 2010 12:56 On Jun 14, 9:55 am, Jeff Hobbs <jeff.ho...(a)gmail.com> wrote: > On Jun 14, 8:46 am, Bernhard van Woerden <bernh...(a)qcode.co.uk> wrote:> I'd like to create a command alias and later do some introspection; > > firstly I'd like to know if the command is an alias and if so what the > > target is but > > > $ proc foo {} {} > > $ interp alias {} bar {} foo > > > but > > $ interp target {} $bar > > ^^^^^? ^? > > > <empty list> > > as per the documentation for TCL 8.5 > > > Does anyone have an alternative way to find the target ? > > You have a syntax error or three. This command works as expected. Actually, I see your confusion (though $bar is still wrong). 'target' returns "", which is the target interpreter path, and thus the right response. You want [interp alias {} bar]. Jeff
From: Bernhard van Woerden on 14 Jun 2010 15:03 On Jun 14, 5:56 pm, Jeff Hobbs <jeff.ho...(a)gmail.com> wrote: > On Jun 14, 9:55 am, Jeff Hobbs <jeff.ho...(a)gmail.com> wrote: > > > > > > > On Jun 14, 8:46 am, Bernhard van Woerden <bernh...(a)qcode.co.uk> wrote:> I'd like to create a command alias and later do some introspection; > > > firstly I'd like to know if the command is an alias and if so what the > > > target is but > > > > $ proc foo {} {} > > > $ interp alias {} bar {} foo > > > > but > > > $ interp target {} $bar > > > ^^^^^? ^? > > > > <empty list> > > > as per the documentation for TCL 8.5 > > > > Does anyone have an alternative way to find the target ? > > > You have a syntax error or three. This command works as expected. > > Actually, I see your confusion (though $bar is still wrong). 'target' > returns "", which is the target interpreter path, and thus the right > response. You want [interp alias {} bar]. > > Jeff Brill , thanks Jeff. Sorry for the typo on $bar Yeah [interp alias {} bar] returns foo .. just what I need. Thank you very much. Bernhard
|
Pages: 1 Prev: update vs update idletasks Next: Overlaying a transparent image on a window? |