-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The only thing in this proposal that can usefully handle a null stringref is string.eq. This makes me think that the instructions in this proposal should generally consume and produce (ref string), not (ref null string).
It even makes me think that stringref should be a shorthand for (ref string) instead of (ref null string). However all the other shorthands are nullable. My impression is that this is because the other shorthands are abstract; you can use a non-nullable type when you have a little more information on where a value comes from and what you can do with it, but for e.g. externref you can't do anything with it anyway, so it can be nullable, why not. Also, these top types are appropriate for storage locations (table slots etc) which have to be nullable. So I see the reason for e.g. externref to be nullable but I don't necessarily think it applies to stringref, which is a concrete type.
Options:
- Leave as is: instructions consume nullable types. (Though, we recently changed instructions that produce
stringrefvalues to make non-nullable types;string.new*,string.const,string.concatshould produce non-nullable results #42.) - Change everything except
string.eqto take(ref string),(ref stringview_wtf8), and so on: non-nullable types. - (2), but also change
stringrefto be shorthand for(ref string)instead of(ref null string). - (2), and remove the
stringref(andstringview_wtf8, etc) shorthands. Just use the two-byterefforms.
Thoughts?