>> I'm not clear on what simple-error should evaluate to. It says
>> string-->A, but what should A be?
>
> An error is thought of as returning an error object sometimes
> represented formally as bottom (_|_) which inhabits every type. Hence
> simple-error returns the type A for all A. Computationally the error
> is returned as an exception which is printed off at the top level;
> however this exception can be trapped and replaced by another object
> as long as type constraints are obeyed.
Ah, ok. So it throws/fires/raises an error (or exception?). May I
suggest that the description: "prints an exception" is confusing?
Also, there seems to be terminology: error and exception seem to be
used interchangeably. Is that correct? If so, it might be useful to
either choose one and stick with it, or mention they are synonymous,
or if there is a difference, clarify it somewhere. I understand that's
a bit nit-picky, but if this is a language specification, we probably
want to avoid multiple interpretations.
>> Also, there are various entries in that chart where the Type column is
>> empty, or hd shows _. It would be nice to have some more clarity on
>> some of those. For example, what should happen for the expression:
>> (simple-error (defun f (X) (+ X X)))
>
> Not every function in Shen has a type; for example eval.
Wouldn't it evaluate to whatever the code evaluated to? So, although
it might not have a concrete static type, it will evaluate to some
type at runtime.
> This is not
> an oversight. 'hd' actually is not totally specified in its
> behaviour; given [] as an argument under CL it returns [].
Ah, I see. So the behavior is platform dependent. May I suggest that
the type column should mention that instead of just being blank?
I'm still learning Shen, but... just as an early impression... if the
intention is to be able to "write once, run anywhere", is there
sufficient platform dependent behavior that might make that difficult?
> The typed version 'head' is better behaved but a little slower because it does a
> cons? test on its argument. For that reason, 'hd' is included for speed.
Right. Though we could also keep both safety and speed with a
dependent types version, couldn't we?
> defun in Kl requires little explanation except to note that all
Ah, sorry I didn't catch that part. So, it's just special.
Thanks!