Allow calling actor & object methods in `after` statement
after n: x() currently only supports plain functions in the local scope, like we can define a method in the local actor and call that, but if we have an object or another actor we can't call the methods on those. Instead we have to wrap it up in a local function first. Seems a bit verbose? Can we allow after to accept object methods directly?
Like so:
actor Foo():
def foo():
print("foo")
actor main(env):
f = Foo()
after 1.0: f.foo()
If lambda was accepted that would also make things a little more flexible, but alas, it is not...
Would be dead simple to support! Just note that once we implement cancelling of after messages, cancellation won't be deterministic in the case a message is directed to some other actor. But I don't see that as a problem per se, it's quite a natural consequence of the asynchronous behavior of actors.
Yes, agreed. Cancellation of after to other actor would not be deterministic! And that is OK!