Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea- Better implementation of list vars? #14

Open
dragoncoder047 opened this issue Oct 14, 2022 · 0 comments
Open

Idea- Better implementation of list vars? #14

dragoncoder047 opened this issue Oct 14, 2022 · 0 comments

Comments

@dragoncoder047
Copy link

Taking inspiration from the definition of the object in uLisp you could use a C union for tcl_var to be able to represent linked lists as more tcl_vars:

 struct tcl_var {
   tcl_value_t *name;
+  union {
     tcl_value_t *value;
+    struct tcl_var *values; // Pointer to nested list or hashmap
+  }
+  char type; // Flag to determine which pointer in the union to take
   struct tcl_var *next;
 };

The name would hold a string of the index (possibly in hexadecimal, to speed array lookup).

Now that a var can point to another var, this could also lead to hashmaps (name being the key string etc) and nested data structures.

Does this sound like a possibility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant