6 ms·
That would force a conversion from opaque type to integer, which would force creation of the rune to byte index. It doesn't have to be handled as a special cas
by Animats 9y ago
That would force a conversion from opaque type to integer, which would force creation of the rune to byte index. It doesn't have to be handled as a special case. The opaque type thing is an optimization hidden from the user. If you try to look at it, you get the integer value, expensively.
- mjw1007 9y agoIt's a shame to do all that work at runtime though, when the result is just going to be that the byte number in the opaque value is increased by the byte length of the first string. I do think there's a great deal to be said for indexing and pattern matching returning opaque 'locations' (particularly if/when we have languages that let you verify at compile time that you're using the location with the right string). But I fear doing it well would be distinctly fiddly.