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] Tcl-Core Digest, Vol 24, Issue 5
by Will Duquette other posts by this author
May 5 2008 7:02PM messages near this date
Re: [TCLCORE] Tcl-Core Digest, Vol 24, Issue 5 | Re: [TCLCORE] Tcl-Core Digest, Vol 24, Issue 5
On May 5, 2008, at 3:06 AM, Twylite wrote:
>  Hi,
> 
>  Will & DFK wrote:
> >>> * Automatic declaration of type and instance variables in
> >>> typemethod and
> >>>  method bodies
<snip> 
> >>>
>  For what it's worth I think that implicit access to member variables
>  from within a method body is distinctly un-Tclish.  We don't have
>  implicit access to global variables, namespace variables, or any of  
>  the
>  other implicit variable scoping that you find in other languages; why
>  start with objects?  I don't think that making instance variables
>  available implicitly in any context is a reasonable compromise.

I've become quite fond of it; my view is that the variables *are*
declared, in the type definition.  In any event, it's now standard
practice for Snit code, which means that a TclOO-based Snit needs to
support it.
> 
>  That said I recognise that there are developers who find implicit
>  variable access an advantage, and I can respect that (even if they are
>  wrong ;) ).  I believe the following code inserted at the start of a
>  method will accomplish the desired functionality?
>   foreach v [info object vars [self object]] {
>     my variable $v
>   }
> 
>  To make it simple perhaps a proc import_object_vars that uplevels that
>  code snippet.
> 
>  How this could be extended to automatically import the object  
>  variables
>  (without rewrite the body of the method, which I believe SNIT 1.x  
>  does)
>  I'm not sure.

A TclOO Snit would almost certainly have to insert code at the  
beginning of each method to support this.

> 
> 
>  ---
>  Slight change of topic (Warning: Radical Ideas Ahead!)
> 
>  Would it be worth considering an additional "meta" parameter to a  
>  method
>  definition (before or afeter the argslist).  Such a parameter could be
>  used in future to extend the functionality of methods without breaking
>  the interface.
>  For example:
>   - oo::define c method my_func {autovars true} {args} { ... }
>  In this case meta is treated as a dict, and TclOO knows about the
>  "autovars" value which will cause the object's variables to be
>  implicitly brought into scope (like import_object_vars above)
>   - oo::define c method my_func {pointtag t} {args} { ... }
>  In the future some support for Aspects is added.  If an enter/leave
>  action is associated with any of the listed pointcut tags (in this  
>  case
>  "t") then that action will be executed in the context of the method
>  before the body (in the case of enter) or at the point of return  
>  (leave).
>   - oo::define c method my_func {pointcut [list ::mycallback arg1]}
>  {args} { ... }
>  Also for Aspect support, define a specific method to invoke rather  
>  than
>  a tagged action.  This specific case is equivalent to trace enter /
>  trace leave.
> 
>  I know it may be a bit late in the dev cycle to be raising new ideas,
>  but I didn't think of it before ;p  Is there any merit in this?

I think I'd want to make "autovars" a pragma that applies to the
whole type, rather than having to specify it on each method, as that
kind of defeats the purpose of having them automatically declared.

Wouldn't an option/value interface be cleaner than your meta dict?

     method my_func {args} -pointcut t { body... }

Will

> 
> 
>  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

------------------------------------------------------------------
        will -at- wjduquette.com      | Catch our weblog,
http://foothills.wjduquette.com/blog | The View from the Foothills



-------------------------------------------------------------------------
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
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
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