3 ms·
The hyperspec has a definition of what is a variable in the different namespaces. Also, for type declarations: "Affects only variable bindings and specifies th
by junke 9y ago
The hyperspec has a definition of what is a variable in the different namespaces. Also, for type declarations:
"Affects only variable bindings and specifies that the vars take on values only of the specified typespec"
- lisper 9y ago> The hyperspec has a definition of what is a variable The hyperspec's definition only applies to the hyperspec, not the paper. On the hyperspec's definition, an array cell is not a variable, but it seems very unlikely that this is what the author of the paper intended. It's much more likely that what the author intended by "variable" the CLHS calls a "place". (But this is exactly the problem: we don't know what the author of the paper intended because he didn't say. We have to guess.) > vars take on values only of the specified typespec Right, but the spec doesn't actually say what happens when this constraint is violated.
- junke 9y ago> On the hyperspec's definition, an array cell is not a variable, but it seems very unlikely that this is what the author of the paper intended. It's much more likely that what the author intended by "variable" the CLHS calls a "place". There is no syntax to declare the type of a single cell, you can only put identifiers (symbols), not places, into declarations. Either your variable is declared to hold an array of, say, fixnums, or you bind a variable to the content of a cell and declare the type of that variable. > Right, but the spec doesn't actually say what happens when this constraint is violated. The spec says the consequences are undefined. Either you code against the guarantees of your implementation (which are hopefully more precise), or you aim for portability and consistently add check-type before locally declaring types.
- lisper 9y ago> the spec doesn't actually say what happens when this constraint is violated. > The spec says the consequences are undefined. Don't those mean the same thing?
- junke 9y agoLet's try the Zen/taoist analogy. At the end of the day, a Zen master tells his student: "your next lesson will start at 5am tomorrow, don't be late"; the student says: "what will happen if I am late?". The master doesn't reply. The student goes to sleep and wakes up late. "You missed your lesson, come back tomorrow at 4am or else I can't guarantee your safety.". The next day, the student arrives on time. ---- Saying things are undefined is an explicit way of demarcating what is part or not of the specification. Otherwise, the meaning could ambiguous.
- lisper 9y agoOK. That seems like a pretty fine hair to split in the context of the present discussion.