Slot management system for TclOO
Closed / Fixed2500398fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 15 years ago
Descriptionplain2009-01-12 02:26:05
It seems that [variable] within class declaration doesn't 'accumulate' variable names, so there can only be a single [variable] in the declaration.
I would expect the following to produce "moop v3 1" instead of erroring.
package require TclOO
namespace import oo::*
class create Vartest {
variable v3
variable v1 v2
method moop {v} {
puts stderr "moop $v [set $v]"
}
method woo {} {
my moop v1
my moop v2
my moop v3
}
constructor {} {
set v1 1
set v2 1
set v3 1
}
}
Vartest create test
test woo
PRODUCES:
tclsh8.6 tcloo.tcl
moop v1 1
moop v2 1
can't read "v3": no such variable
while executing
"set $v"
(class "::Vartest" method "moop" line 2)
invoked from within
"my moop v3"
(class "::Vartest" method "woo" line 4)
invoked from within
"test woo"
(file "tcloo.tcl" line 24)
dkfplain2009-01-12 17:42:29
Right now, the 'variable' declaration 'sets' rather than 'appends'. In this, it is like the 'superclasses', 'mixins' and 'filters' decls. Arguably this should be different; I'm in two minds about it.
dkfplain2009-01-12 17:42:30
Right now, the 'variable' declaration 'sets' rather than 'appends'. In this, it is like the 'superclasses', 'mixins' and 'filters' decls. Arguably this should be different; I'm in two minds about it.
coldstoreplain2009-01-12 17:45:53
I don't mind which way it works, although I tend to like to have a variable declaration with associated comments. I'd expected it to be like [method] rather than [superclass], but can live with however it falls. Possibly this needs to be more clearly documented.
bericplain2009-03-14 01:24:45
Hello Donal, Just to remind you... What do you intend to do for this? Personnaly, I would prefer the 'append' behaviour. The 'set' behaviour is not usual in Tcl.
dkfplain2009-03-24 23:19:46
“Do”? It's working as specified and as documented.
dkfplain2009-05-11 20:56:40
data_type - 360894 As this is really a FRQ for a slot-like management scheme for variables, I'm moving this to another tracker.
dkf Ticket [2500398fff]: 1 change
[History diff]2009-05-11 20:57:36
dkf Ticket [2500398fff]: 1 change
[History diff]2009-05-11 20:58:35
dkf Ticket [2500398fff]: 1 change
[History diff]2009-07-12 22:01:25
dkfplain2009-07-12 22:02:18
Note that this sort of thing ought to be applied to the other list-of-things declarations too. Broadening FRQ scope.
dkfplain2012-05-17 17:52:24
allow_comments - 1 This was TIP #380, and is applied.
Log in (anonymous is fine) to add a comment.