2 ms·
They aren't just type aliases, they actually have unique slots in the symbol table when used so...you define more brands :) brand position <- Point brand
by seanmcdirmid 12y ago
They aren't just type aliases, they actually have unique slots in the symbol table when used so...you define more brands :)
brand position <- Point
brand start-position <- position
brand end-position <- position
def DrawLine(start-position, end-position):
... = start-position + ...
... = end-position - ...
But that is kind of annoying, brand composition as adjectives would probably work better:
brand position <- Point
brand start
brand end
def DrawLine(start&position, end&position):
... = start&position + ...
... = end&position - ...
Very natural language, and start/end can be used to qualify all variables that are starty or endy. The biggest problem with the approach is that you have to think ahead of time about what your variables mean, and they might become fairly verbose (so "start position" rather than "startp"). Also, when you get into the implementation, it is kind of tiring to think about what every local variable should mean, so maybe this only really works for procedural parameters and maybe to help define fields.
I've been thinking about this for awhile, but haven't put it into a prototype yet.