Re: [TCLCORE] Tcl-Core Digest, Vol 24, Issue 5
by Arnulf Wiedemann other posts by this author
May 6 2008 12:22PM messages near this date
Re: [TCLCORE] Tcl-Core Digest, Vol 24, Issue 5
|
Re: [TCLCORE] Tcl-Core Digest, Vol 24, Issue 5
Am Dienstag, 6. Mai 2008 06:02:35 schrieben Sie:
> Thanks, Kevin.
>
> On May 5, 2008, at 7:36 PM, Kevin Kenny wrote:
> > Will Duquette wrote:
> >> 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.
> >
> > Indeed. And my impression is that we were discussing *how* best
> > to accomplish this.
>
> I'm sorry, did I sound strident? Didn't mean to. Trevor had
> pointed out that implicitly-declared variables weren't particular
> Tcl-ish, which is true, though he understood that others disagree;
> and I was explaining that while I do disagree, that's almost
> irrelevant at this point, given the context. But I didn't mean
> to sound argumentative.
>
> > Itcl has the same requirement (that instance variables become
> > visible automatically within method bodies), and Arnulf has been
> > able to code up support (resorting to C, I concede) to provide
> > the implicit variable access via custom variable resolution.
> > I suspect that Snit's requirement is almost exactly the same
> > as Itcl's, even though Snit's Not Incr Tcl.
>
> This is a great observation. Here I've been, pondering how to
> make this work appropriately for Snit in the context of inheritance,
> and of course it's a problem Itcl has already had to solve. D'oh!
>
> Arnulf, how does Itcl handle this now? (From the point of view of
> a programmer using Itcl, not in terms of how it's implemented
> internally.)
Itcl has a set of variables for every object (all variables of all classes of
that object) and uses a variable resolver to get the object specific set of
variables (C-Code !!). Also variables with the same name in different classes
are handled as different variables, depending on the namespace (== class) the
method using it is runninng. Every method gets the classes namespace where
the method is defined as the current namespace when calling it.
I hope that helps, if there are further questions please let me know.
Arnulf
>
> > I'd be perfectly
> > willing, if you and Arnulf can sort out the requirement, to
> > entertain a TIP promoting the code needed to auto-resolve
> > instance variables to the Core - if two major OO extensions
> > need almost identical functionality, that argues in favor of
> > putting it in.
>
> Thanks very much!
>
> > In the meantime, inserting code at the start of each method
> > to bring in the instance variables sounds right. The
> > [my variable] command has to be made fast in any case, so
> > the performance shouldn't go horribly astray.
>
> This is more or less what Snit 1.x does, although it uses
> multiple upvar's, and that's been fast enough for our production
> code. Slower than Snit 2.x, which uses "namespace upvar", but
> fast enough to be usable.
>
> Will
>
> > --
> > 73 de ke9tv/2, Kevin
>
> ------------------------------------------------------------------
> 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
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
|