slavapestov/factor — Issue #395: boa constructor tries to get values from stack for shadowed slots
Author: kenanb
Created: 2011-11-13 02:01:09+00:00
State: open

if you define a tuple that shadows some slots of its superclass, boa constructor ries to get values from stack for shadowed slots, too.

TUPLE: t1 s1 s2 ;
TUPLE: t2 < t1 s2 s3 ;
! => Note: Definition of slot ``s2'' in class ``t2'' shadows a superclass slot
1 2 3 t2 boa
! => Error: Data stack underflow
t2 all-slots
! {
! T{ slot-spec { name "s1" } { offset 2 } { class object } }
! T{ slot-spec { name "s2" } { offset 3 } { class object } }
! T{ slot-spec { name "s2" } { offset 4 } { class object } }
! T{ slot-spec { name "s3" } { offset 5 } { class object } }
! }
"foo" "s1" "s2" "s3" t2 boa s1>>
! "foo"
"foo" "s1" "s2" "s3" t2 boa s2>>
! "s2"

I think it should be either
1-) forbidden to shadow a slot in high layers of tuple system, (makes sense, since slava said slot shadowing is not intended to be used by the factor user, but implemented to use in some underlying function)
2-) boa constructor should somehow be disabled for tuples with shadowing slots, since it already does the wrong thing.
3-) a shadow-safe boa should be implemented.