by polotics · 7y ago · 0 comments
A good example is when using a String supplied by a scripting language such as Ruby or JavaScript.
Normally, you might need to copy the string to add a NUL byte, or request that the scripting engine provide a NUL terminated string (which might result in the same action performed).
Using this optional approach, a potential copy of the data can be avoided.
Though I guess it would be good to have nicer wrappers for the common case where you do only send text.
It's a bit unfortunate that they use two code paths for that which are basically just copy & paste.
https://github.com/boazsegev/facil.io/blob/master/lib/facil/...