Skip to content

Somehow merge the Expression and Data_ref classes

Expression and Data_ref both represent data whose type is known dynamically. Expression can be the result of an expression in the configuration file while Data_ref is some data passed by the code. A Expression can already be a implemented as a reference to a Data_ref. The user-code plugin additionally requires for a Data_ref to be able to expose the content of a Expression to the code so as to expose name or type informations.

The question arises of how to merge those concepts. Hoewever, Data_ref should remain a very lightweight to copy reference that plugins can pass all around as easily as a pointer while Expression need dynamic polymorphism to support various way of expressing the same value.

  • with #60 (closed) Expression can have many more different possible types and should expose it as a Datatype,
  • Expression should support indexing in the data if the type supports this,
  • Expression as_double and as_string should maybe be extended with a more generic function that returns a Data_ref.

The result would be that we have 3 concepts:

  • Data_ref: a typed unnamed reference to data content in a specific buffer at a specific address,
  • Data_descriptor: a variable or descriptor that has a name and can be assigned a Data_ref,
  • Expression: an expression that collapses to something akin to a Data_ref when evaluated.

... we get close to the concepts of a dynamically typed programming language.

Edited by Julien Bigot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information