Panther Search Documentation Tutorials Downloads Devlog Source Code

Panther Value Categories

All expressions have a value category. In C-like languages, the two main value categories are usually lvalue and rvalue. In Panther, there are also two main categories: concrete and ephemeral. These are very similar to lvalue and rvalue respectively, but they are different enough that it warranted new names.

Ephemeral

Ephemeral values are very similar to rvalue values. Ephemeral values are any values that do not have storage. This means they cannot be assigned to nor can the address of them be gotten. Ephemeral values are not necessarily explicitly typed as fluid literals are ephemeral.

The following are ephemeral expressions:

Concrete

Concrete values are similar to lvalue values. Concrete values are any value that have storage. An important difference between concrete values lvalue values is that ephemeral values cannot be used as an assignment value. The correct way to use a concrete value as an assignment value is with an operator copy, a operator move, or a operator destructive move. There are three subcategories of concrete values: concrete-mutable, concrete-const, and destructive-movable-concrete-const

Concrete-Mutable

Concrete-mutable values are values that are concrete and mutable.

The following are concrete-mutable expressions:

Concrete-Forwardable

Concrete-forwardable values are values that are concrete, and mutable. Concrete-forwardable is the only value category that is allowed to be argument of an operator forward.

The following are concrete-forwardable expressions:

Concrete-Const

Concrete-const values are values that are concrete and non-mutable. Mutating a concrete-const value is undefined behavior.

The following are concrete-const expressions:

Destructive-Movable-Concrete-Const

Destructive-movable-concrete-const values are values that are concrete and only mutable by operator destructive move. Mutating a destructive-movable-concrete-const value in any way other than operator destructive move is undefined behavior.

The following are destructive-movable-concrete-const expressions: