Document some problems with nil

While he's a pretty cool character in HZD, he seems to have some
identity problems when in a compiler.
This commit is contained in:
Bill Currie 2019-06-09 22:29:51 +09:00
parent 439cd15620
commit c98d1ff08c
2 changed files with 13 additions and 1 deletions

View file

@ -142,7 +142,7 @@ string_from_plist (PLString *plstring)
local @param ret;
local string str = [plstring string];
ret.quaternion_val = nil; //FIXME should be ret = nil;
ret = nil; //FIXME should be ret = nil;
if (str_mid (str, 0, 1) == "[")
return rect_from_plist (plstring);

View file

@ -0,0 +1,12 @@
The problem with nil is more a problem with @param and values.
@param values used type_nil's low-level type, which is either quaternion
or vector (v6 progs). Thus returning (or passing?) nil through @param
creates a value that has type_param built low-level type quaternion.
Then assigning nil to a quaternion finds the param nil (because the
value and low-level type is checked) which has the wrong type for type
checks.
one solution is to create an ev_param type (convert to quaternion or
vector for v6 progs) that the VM either ignores or can copy around
ev_param data.