UndefinedBehaviorSanitizer's Unexpected Behavior
daniel.haxx.se48 pointsby ekimekim91 comments
type Option<T> = T | undefined
function f<T>(value: T): Option<T> { ... }
let thing: string | undefined = undefined;
let result = f(thing);
Now imagine the definition of Option is in some library or other file and you don't realize how it works. You are thinking of the Option as its own structure and expect f to return Option<string | undefined>. But Option<string | undefined> = string | undefined | undefined = string | undefined = Option<string>. #!/bin/sh
foo
bar
vs #!/bin/sh
foo
exec bar
And you could perhaps imagine a shell that does "tail process elimination" to automatically perform the latter when you write the former.