Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

self in class context for 8.6

84 views
Skip to first unread message

rene

unread,
Feb 8, 2024, 7:19:49 AMFeb 8
to
Hello

Iirc the "self" command (without args) was introduced in 8.7.
In 8.7 I can write oo::class create ::C {puts [self]}
Is there a way to get the class self command in 8.6.

Thank you
Rene

YuriyKovalenko

unread,
Feb 8, 2024, 8:10:53 AMFeb 8
to
self exists in 8.6 also. Try
oo::class create ::C {constructor {} {puts [self]}}
or
oo::class create ::D {method foo {} {puts [self]}}

Alan Grunwald

unread,
Feb 8, 2024, 11:45:26 AMFeb 8
to
As far as I recall, [self] is the same as [self object]. Does [self
object] work, and do what you want/expect in the contexts where [self]
isn't doing the trick?

greg

unread,
Feb 8, 2024, 3:15:54 PMFeb 8
to
https://www.tcl.tk/man/tcl8.6/TclCmd/self.html
https://www.tcl.tk/man/tcl8.7/TclCmd/self.html


...
if omitted the result will be the same as if self object was invoked.

rene

unread,
Feb 13, 2024, 9:21:18 AMFeb 13
to
Answering myself:

[self] == [lindex [uplevel 1 {info level -1}] 1]
0 new messages