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

Switch to linked prop for spec lists #9

Open
muzimuzhi opened this issue Nov 26, 2024 · 0 comments
Open

Switch to linked prop for spec lists #9

muzimuzhi opened this issue Nov 26, 2024 · 0 comments

Comments

@muzimuzhi
Copy link
Owner

Currently a spec list stores

  • spec keys in \g__tblr_<spec>_<level>_clist
  • and spec values in \g__tblr_spec_<level>_<spec>_<key>_tl

As spec keys come from both prop keys (always str) and running code (using current catcode), duplicate keys may not be removable (when tracing), unless we convert all keys to str:

 \cs_new_protected:Npn \__tblr_spec_gput:nnn #1 #2 #3
   {
     \tl_if_exist:cF { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl }
       {
         \tl_new:c { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl }
       }
     \tl_gset:cn
       { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl } {#3}
-    \clist_gput_right:ce { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist } { #2 }
+    \clist_gput_right:ce { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist } { \tl_to_str:e {#2} }
   }

or just

\clist_gput_right:co { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist } { \tl_to_str:n {#2} }

if #2 is ensured unexpandable.

Linked property list variables (which needs l3kernel 2024-02-13, better 2024-02-18)

  • have all the virtue of (old, flat) props: no duplicate keys, ensured str key
  • take constant time for if_in, item, put/get, pop/remove operations.
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