Closed jcorbin closed 2 months ago
Hmm, but actually: if this is to be done, then setting an already extant key to undef
needs to remove; will update soon :tm:
Two notes. One is that this functionality sort of exists via the _remove_undefined_vals() private function. The second is that there might be a reason for a user to want a key with an undef value. Like maybe you want to define a key as undefined but have it as a key so that a subsequent set operation with grow=false can still succeed. Some of the existing code in rounding.scad actually works this way, but it creates the struct directly so the change wouldn't break it. However, I do not know for sure that the proposed change is safe for the existing code.
We could expose an option for struct_set that skips undefs. But I'm not sure that deleting fields because they are set to undef is the right behavior. This could all become irrelevant if native structures ever see the light of day.
This seems abandoned.
Avoid adding
[key, undef]
pairs to structs.