It'd becoming a burden to constantly query and check the underlying types of literal values.
class Value final {}; // could be literal or variable. could be number, string, array, etc.
This type would be intentionally non-generic. throwing runtime type exceptions instead, for the editor to handle.
// literals operate on literals, and return literals...
constexpr bool operator==(const Value& a, const Value& b) const; // evaluates type, checks equality
constexpr Value+(const Literal& a, const Value& b) const;
constexpr Value[]() const;
// etc.
You can create values from primitive types
explicit Value(int value);
explicit Value(bool value);
// etc.
and convert from them
constexpr bool (bool)() const;
constexpr std::string (std::string)() const;
The editor should be responsible for ensuring the right types are used, and valid blocks and expressions are nested together.
It'd becoming a burden to constantly query and check the underlying types of literal values.
This type would be intentionally non-generic. throwing runtime type exceptions instead, for the editor to handle.
You can create values from primitive types
and convert from them
The editor should be responsible for ensuring the right types are used, and valid blocks and expressions are nested together.