Running samples/weak/basic.jakt produces different results for comptime vs build time execution, suggesting that either foo is not destroyed at the end of the scope, or the weak pointer is not updated:
class Foo {
public function hello(this) => "friends"
}
function main() {
mut weak_foo: weak Foo? = None
println("weak_foo has_value? {}", weak_foo.has_value())
{
let foo = Foo()
weak_foo = foo
println("weak_foo has_value? {}", weak_foo.has_value())
println("weak_foo hello: {}", weak_foo!.hello())
}
println("weak_foo has_value? {}", weak_foo.has_value())
}
~/jakt$ ./build/bin/jakt -r samples/weak/basic.jakt
weak_foo has_value? false
weak_foo has_value? true
weak_foo hello: friends
weak_foo has_value? true <------ !!!!
~/jakt$ ./build/bin/jakt -cr samples/weak/basic.jakt
weak_foo has_value? false
weak_foo has_value? true
weak_foo hello: friends
weak_foo has_value? false
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too