Along with the same lines, you may find that the lispobj
type is
all you need in many situations. Let’s take an example. Suppose you want
to implement a --stars
option to assign a rank to a movie, from 0
to 5. The lazy approach is to simply create a lispobj
option with
a :typespec
(type specifier) of (integer 0 5)
and you’re
done.
But now, remember that the end-user of your application is probably not
a Lisper (in fact, I would hope that Clon
contributes to increasing
the number of standalone Common Lisp applications out there…). What do
you think would be her reaction, if, after providing a bogus value to
the --stars
option, she get the following error message:
Option 'stars': invalid argument "6". Argument "6" must evaluate to (integer 0 5).
or worse, a "Cannot parse argument"
error message because of a
typo?
Not very friendly, right? In other words, you need to think in terms of
what the end-user of your application will expect. In that particular
situation, you might want to subclass lispobj
(with
defoption
!) only to provide friendlier error messages.