[plt-scheme] continuing to write newbie notes on units; feedback?
Danny Yoo wrote:
> I'm still trying to write a tutorial on Units for people who've never
> seen them before.
Good idea, I think something like that is needed.
> Is there anything in the notes that I have so far that need elaboration,
> or anything that is just wrong and needs correction?
Typo: in the following sentence:
"To use a module, we use the *require* form; to use a module, we use an
*invoke* form like *define-values/invoke-unit"
...the second occurrence of "module" is presumably supposed to be "unit".
BTW, the points about poor error messages are all very valid, but the
fixes may not be simple. I assume the reason that "unit syntax error
messages suck" (note that I'm quoting, I didn't say that ;) is that
units are implemented as macros, so they just give generic macro syntax
errors. Better error messages would require better macro error messages
in general. I imagine it might be possible to list all the macro
patterns that might have been matched but weren't, for example, but
although that might make the messages more informative, it won't
necessarily make them friendlier.
(Although, for your specific examples it might help, producing messages
like "'import' expected at..." or "'export' expected at", etc.)
Using units without requiring unit.ss is even less straightforward to
fix, because that requires the system to know something about units,
before it's loaded the code having to do with units. The only real
solution here would seem to be building native knowledge of units into
MzScheme. However, note that if you did a "Check Syntax" in DrScheme in
such cases, names like "unit" would be highlighted in red, which is a
nice fat clue.
Anton