There's self. but how can I reference nested type referencing? :-[
Logically, should there be parent. also? :zzz:
Nested TYPE Example:
TYPE _item
id
selected_id
color
size
FUNCTION set:
self.id = basket.item_id // absolute
// self.id = parent.parent.item_id // would prefer relative
ENDFUNCTION
ENDTYPE
TYPE _group
apple AS _item
banana AS _item
ENDTYPE
TYPE _base
item_id
fruit AS _group
ENDTYPE
GLOBAL basket as _base
basket.fruit.apple.set()
The child has no knowledge about the parent. (Unlike in real life) ;)
Ah. i was hoping it to be like Javascript, which is not real nor life either. 8)
You could do it with a little ref passing workaround...
change...
FUNCTION set:
to...
FUNCTION set: parentRef as _base
then change...
self.id = basket.item_id
to...
self.item_id = parentRef.item_id
Your call would need a change too...
basket.fruit.apple.set(basket)
for another basket...
basket2.fruit.apple.set(basket2)
Untested.
I see what you mean bigS and I did have something like this. Pardon the complexity and I don't expect a complete solution, although the idea of any type parent was so that it could be generally called, well in this case the fruit may also be not in of basket type (eg. basket, box, bag have item_id).
TYPE _container
item_id
fruit_sealed AS _group
fruit_fresh AS _group
ENDTYPE
GLOBAL box as _container // not the same as _base