ursalang / ursa

A friendly, stable general-purpose programming language
https://ursalang.github.io
3 stars 1 forks source link

Design for lvalues #44

Closed rrthomas closed 7 months ago

rrthomas commented 7 months ago

Lvalues should be distinct from both ArkExp and ArkVal as they are run-time values, but not first-class.

ArkExp needs a subclass ArkLexp with an evalRef method that produces an lvalue (=== ArkRef), i.e. ArkRef is no longer a subclass of ArkVal. Assignment calls evalRef on its left-hand argument and eval on its right-hand argument.

For example, ArkProperty.evalRef would call Object.eval and then wrap the result as an ArkPropertyRef. A global, local or capture's .evalRef would return an ArkValRef.