Skip to content

Commit 3d602bc

Browse files
authored
Merge pull request #32 from WebAssembly/string-eq
Allow null operands to string.eq
2 parents 0b118b1 + d62a253 commit 3d602bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

proposals/stringref/Overview.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ address ::= i32 | i64
195195
Such instructions also take the memory to which to read or write as an
196196
immediate.
197197

198+
Although `stringref` is a nullable type, trap if a null `stringref`
199+
value reaches any instruction in this proposal. The one exception is
200+
`string.eq`.
201+
198202
### Creating strings
199203

200204
```
@@ -346,8 +350,9 @@ If an allocation fails, the implementation must trap. Fallible
346350
```
347351
(string.eq a:stringref b:stringref) -> i32
348352
```
349-
Return 1 if the strings *`a`* and *`b`* contain the same codepoint
350-
sequence. Return 0 otherwise.
353+
If both *`a`* and *`b`* are null, return 1. If only one of them is
354+
null, return 0. Otherwise return 1 if the strings *`a`* and *`b`*
355+
contain the same codepoint sequence, or 0 otherwise.
351356

352357
```
353358
(string.is_usv_sequence str:stringref)

0 commit comments

Comments
 (0)