Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

What is the purpose or benifits of the command "info subcommands"


Why Tcl supports so many info commands
for example
 info proc ....

So , does this have there real usage or merely grammar sugar.
also I have heard the dynamic language may have its functions ,but why
an how to harness it?

On 16 Mai, 14:28, CFAN <eyeli@gmail.com> wrote:

> Why Tcl supports so many info commands
> for example
>  info proc ....

> So , does this have there real usage or merely grammar sugar.
> also I have heard the dynamic language may have its functions ,but why
> an how to harness it?

Some use [info] much for introspection, some don't. [info procs] can
for instance be helpful if you're debugging a script interactively and
are too lazy to check the sources.
For an introspection example that uses several [info] subcommands to
recreate a proc's definition, in such a form that it can be eval'ed
in, say, another interpreter, see "corp" http://wiki.tcl.tk/15349

A little, but often useful debugging helper is [info level 0] which
returns the call to the current proc.
Or [info script] to make sibling files available for sourcing without
having to give absolute pathnames.
When I'm at some colleague's machine, I often use
[info na] (nameofexecutable) and
[info pa] (patchlevel)
to determine what tclsh is really running.

More on the Wiki, as usual: http://wiki.tcl.tk/1043

At 2007-05-16 08:28AM, "CFAN" wrote:

>  Why Tcl supports so many info commands
>  for example
>   info proc ....

>  So , does this have there real usage or merely grammar sugar.
>  also I have heard the dynamic language may have its functions ,but why
>  an how to harness it?

[info args], [info default] and [info body] are essential for redefining
procs dynamically.

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Glenn Jackman wrote:
> [info args], [info default] and [info body] are essential for redefining
> procs dynamically.

Or invoking them dynamically, even. See tclhttpd, which takes a web form
as input and matches the fields in the form to the arguments of the
procedure so-invoked.  (Very cool idea, I must say.)

--
   Darren New / San Diego, CA, USA (PST)
     His kernel fu is strong.
     He studied at the Shao Linux Temple.

On 16 Mai, 13:28, CFAN <eyeli@gmail.com> wrote:

> Why Tcl supports so many info commands
> for example
>  info proc ....

> So , does this have there real usage or merely grammar sugar.
> also I have heard the dynamic language may have its functions ,but why
> an how to harness it?

Introspection (or reflection in Java or .NET) are important feature
for handling metadata.
(data about data)
- debugging
- frameworks (persistence)
- serializing
- .NET uses introspection to couple IDE with components or manage
component containers (without painful XML Java descriptor, EJB3.0 is
based now also on reflection)
- introspection allows to use Tcl as one envirorment for runing and
modifing systems
- loose coupling components or modules
- administrate runing systems

XOTclIDE (http://www.xdobry.de) and TclTalk are IDEs, which work only
with help of introspection.
That allows to interactive modifying running system without edit-run-
debug-stop interactions.
They both use "info procs" for it.
Unfortunately introspection in Tcl/Tk is not complete.
So it is impossible to write a GUI-Builder, which relies only on
introspection.
There are no complete introspection API for widgets (only very base
$widget configure)
Many Tcl extensions do not offer introspection at all or does not
allow dynamic modifing data.

Artur

On May 17, 3:47 am, Artur <m@xdobry.de> wrote:

> Unfortunately introspection in Tcl/Tk is not complete.
:
> There are no complete introspection API for widgets (only very base
> $widget configure)

:
Perhaps it would be worthwhile to brainstorm with others on areas
where introspection is needed - and why.  It might help motivate
someone to write a TIP (http://tip.tcl.tk/) for filling in the gaps
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc