pyret-lang
pyret-lang copied to clipboard
Using `method`s as standalone expressions result in misleading error message when type checking is enabled
Since method
s are technically expressions, they're allowed to appear in expression positions. It looks like the type checker has no support for them, yielding a "checking for s-method not implemented"
/"synthesis for s-method not implemented"
error depending on the context. It should probably be rejected as part of well-formed checks.
Simple example:
x = method(self):
self
end
This is a feature that has a well-defined dynamic semantics but no type-checking semantics. Several table operations have a similar property.
So it's not clear to me that it needs to be a well-formedness error in pyret-lang itself, since we're OK with having features that only make sense in the untyped setting. The error message could be better, though!
On Tue, Jun 01, 2021 at 11:28 AM, Thijs Molendijk @.***> wrote:
Since methods are technically expressions, they're allowed to appear in expression positions. It looks like the type checker has no support for them, yielding a "checking for s-method not implemented"/"synthesis for s-method not implemented" error depending on the context. It should probably be rejected as part of well-formed checks.
Simple example:
x = method(self): self end
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brownplt/pyret-lang/issues/1592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA5IU7Q34UGETIFKRVLUI3TQURGNANCNFSM455F25FQ .