3 ms·
A Particularly Gnarly Case of Go's Non-Nil Interfaces
- Someone 3y agoFTA: “I’ve seen comments online that argue that this is a bug in the language, which I would push back on. Though one may disagree with the design choices, the behavior is well-specified.” I think the comments talk about a bug/non optimal choice in the design, not in how it’s worded in the spec. For a similar case, look at variant records in Pascal. They’re well-specified, but the spec implies that they can be used to read or write arbitrary memory locations (create a variant record storing either a pointer to byte or a pointer-sized integer, write the address to be read to that integer, and then use the pointer to read or write the memory location), and that’s 100% against a goal of Pascal, namely that of being a high-level language.