A: class {
value := 0
other: Int
init: func
foo: func (v := this value) {
this other = v
}
}
B: class {
whatever := 1
init: func
bar: func (w := this whatever) -> Int {
a := A new()
a foo()
a other
}
}
b := B new()
something := b bar(2)
The value of v in foo should be this value but this does not point to itself but rather to the calling object b and fails with: error: ‘example__B’ has no member named 'value'
The same happens if the last line is replaced with something := b bar(), then the default value of w in bar fails because this is undeclared (we're not calling from any object).
Here's a short example:
The value of
v
infoo
should bethis value
butthis
does not point to itself but rather to the calling objectb
and fails with:error: ‘example__B’ has no member named 'value'
The same happens if the last line is replaced with
something := b bar()
, then the default value ofw
inbar
fails becausethis
is undeclared (we're not calling from any object).(I assume this is not by design.)