Liste des Groupes | Revenir à cl forth |
dxf <dxforth@gmail.com> writes:
...But how much need today and what's wrong with ABORT"?
My guess at the thinking behind the Forth-94 committee's decisions
about that are:
1) ABORT" Undefined word" takes more space than -13 AND THROW. Of
course, if the system then has a table for translating throw codes
to messages, that probably eliminates the memory savings, but a
system that is really tight on memory can just output the error
code and leave it to the user to look the error up in the manual.
>
2) For CATCH, every ABORT" looks the same, so you cannot do something
for one kind of error and something else for other kinds. Of
course, the question is whether one can do that with the current
situation (apparently not portably for inaccessible or non-existent
files in INCLUDED), and whether that's something that Forth
programmers would make use of if the situation was otherwise.
One interesting aspect is that IIRC Mitch Bradley uses
>
C" <error message>" throw
or somesuch. If you want to catch that, you have to do it as
follows:
: printer-on-fire c" printer on fire" ;
: foo ... catch dup printer-on-fire = if ... then ... ;
: bar ... printer-on-fire throw ... ;
And of course, this only make sense if the system treats an
uncaught throw as a counted string to be printed.
Les messages affichés proviennent d'usenet.