Skip to content

Reconsider thunks in ValueType #8

@Radvendii

Description

@Radvendii

There's some weirdness in the C API when it comes to thunks. They are sort of just considered normal values, but most of the time they are forced before being returned from functions, and for some purposes you don't want to consider them normal values.

We discussed a couple of options for redesigning this, including

  • Having two enums, one with one without thunks
  • Using something like trees that grow. This adds a lot of complexity though
  • Using an enum without thunks, and then an Option<T> to represent thunks (None being "it's a thunk") The function returning this value could be something like type_if_evaled(&Value): Option<ValueType>
  • Once a value is forced, it can maybe be a nicer enum, such that there's no possibility of trying to get the string value out of an int value.

Another point related to this restructuring: perhaps force() should take a &mut self, since it might mutate the underlying value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions