Panther Search Documentation Tutorials Devlogs Downloads Source Code

Documentation > Panther Documentation > Value Categories

Value Categories

Panther
Documentation


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 Value Category

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 but not explicitly typed.

The following are ephemeral expressions:

Concrete Value Category

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 or a operator move. There are three subcategories of concrete values: concrete-mutable, concrete-forwardable, and concrete-const.

Concrete-Mutable Value Category

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

The following are concrete-mutable expressions:

Concrete-Forwardable Value Category

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 Value Category

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: