ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] Pre-CFV: TIP#257
by Twylite other posts by this author
May 6 2008 12:25AM messages near this date
Re: [TCLCORE] Pre-CFV: TIP#257 | Re: [TCLCORE] Pre-CFV: TIP#257
Hi,
> > Sounds good to me.  In my reading of the TclOO commands this morning I
> > couldn't find any way to get a list of variables associated with a
> > specific class (only all variables associated with an object) ...
> > - Is this something that can be done by the C internals?
> > - Could this be exposed by a "info class variables"?
>  At present, I'm not sure it's a question that makes sense.  IIRC
>  you only declare variables for objects; there's no counterpart
>  to Snit's instance variable declarations.  Any object simply has
>  whatever variables its constructor and methods have declared and
>  set.
Ah ... terminology confusion.

I understood that Will wanted to make "private" variables implicitly 
available to methods.  A "private" variable being an instance/member 
variable associated with the specific type (class) of the instance 
(object). This excludes those member variables of the object that are 
associated with super- or sub-classes, mixins, etc.
>  A reasonable compromise  
>  would be that instance variables declared by a type would be  
>  automatically visible in the methods defined explicitly by that type,  
>  but not elsewhere, i.e., you'd need to explicitly declare them in  
>  subclasses.
>    
So a method my_method of class my_class will have implicit access to 
variables declared by (an object of) class my_class.

So my question was: is it possible to get a list of such variables?  I 
see a way to list all variables declared by an object, but that will 
include super- and sub-classes, mixins, etc.

In order to declare an instance variable one must call "my variable X" 
from within a method (possibly the constructor, but not required as far 
as I can tell).  To know what type that variable was declared by would 
mean that, at the C level, the creation of X by "my variable X" must 
also note the class/type of the calling method.  This could be done 
explicitly (a field in a struct) or implicitly (if a single object 
stores its variables in different namespaces according to the specific 
class/type of the method that declared them).  This information does not 
appear to be available via the Tcl API - is it available at all?

Regards,
Trevor



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Twylite
Will Duquette
Kevin Kenny
Kevin Kenny
Will Duquette
Arnulf Wiedemann
Will Duquette
Kevin Kenny
Donal K. Fellows
Twylite
Larry W. Virden
Twylite
Gustaf Neumann
Larry McVoy
Gerald W. Lester
Vasiljevic Zoran
Larry McVoy
Gerald W. Lester
Larry McVoy
Tomasz Kosiak
Gustaf Neumann
Donal K. Fellows
Daniel A. Steffen
Donal K. Fellows
Daniel A. Steffen
Donal K. Fellows
Donal K. Fellows
Daniel A. Steffen
Gerald W. Lester
Vasiljevic Zoran
Arnulf Wiedemann
Tom Krehbiel
Vasiljevic Zoran
Donal K. Fellows
Gustaf Neumann
Brian Griffin
Gustaf Neumann
Donal K. Fellows
Gustaf Neumann
Kristoffer Lawson
Daniel A. Steffen
Twylite
Donal K. Fellows
Will Duquette
Donal K. Fellows
Will Duquette
Arnulf Wiedemann
dgp
Donal K. Fellows
Arnulf Wiedemann
Twylite
Will Duquette
Twylite
Donal K. Fellows
Stefan Sobernig
Donal K. Fellows
Stefan Sobernig

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved