type safe data structures - #34
Conversation
|
Interesting idea! Would prefer to use numbers that can be cleanly expressed in binary (meaning combinations of powers of 2, e.g. 1/16, 2/16, 3/16). |
|
I would probably use a unified function prefix such as dss_list_create, dss_map_create etc. for consistency. I would also prefer clean floats like Floogle suggested. Additionally, I think ds(s)_get_type should error when the float signature from the function collection isn't present. |
|
dss_ doesnt come anything to mind. what do you think of a tds_ prefix? typed data structure |
i feel like returning undefined and letting the user deal with the error makes more sense |
I suggested
We don't have a true undefined value in 8.2, so returning undefined wouldn't crash anything expecting strings. Additionally, I would change the return value of the type check function to return from predefined id constants that use the float values used internally, such as |
|
i feel like this is good error handling, please check |
|
Looks good! If I would change just one thing, using exact float values allows you to perform equality checks on them so the abs(x-y)<0.001 part is unnecessary. |
|
oh true, my bad lol |
|
done |
proposal for typesafe ds_*, being able to check the type of a ds.
im keeping this as a draft as i believe there could be some changes done and its also missing ds_bag support,
i would like opinions on these.