Certainly looks like a bug; if there's a good, technical reason why that is the case, it's not obvious.
At least in the case of structref, its limitations make sense inasfar dynamic memory allocation is not supported, so local struct references would fall out of scope when returned from a function.
Also, important to note, is that while function references can be used with complete abandon in global and local scopes, structref can only exist in a function's scope; struct references can be parameters or local variables, but can't be returned, can't be in structs or global vars, so the possibility of genuine constructors are completely out the window.
EDIT: One more caveat; functions used to define the funcref interface must return a non-void type.
Certainly looks like a bug; if there's a good, technical reason why that is the case, it's not obvious.
At least in the case of structref, its limitations make sense inasfar dynamic memory allocation is not supported, so local struct references would fall out of scope when returned from a function.
Correction: funcref require non-void return functions only when they are defined as arrays.
Null reference comparison requires a comparison to a reference var of the same type; null will throw a type error.
Yeah, Beier, your examples are invalid syntax.
Also, important to note, is that while function references can be used with complete abandon in global and local scopes, structref can only exist in a function's scope; struct references can be parameters or local variables, but can't be returned, can't be in structs or global vars, so the possibility of genuine constructors are completely out the window.
EDIT: One more caveat; functions used to define the funcref interface must return a non-void type.
The results of my reference tests.