Print

Print


On 14/04/2011, at 1:14 AM, Joseph Wright wrote:

> Currently, if you do
> 
>  \prop_get:NnN \<prop-list> { <key> } \<tl var>
> 
> and the <key> is not in the \<prop-list> then the \<tl var> ends up as
> \q_no_value. On the other hand, for sequences trying to 'pop' or 'get'
> from an empty sequence leads to a (deliberate) error.


My personal thoughts:

* These should probably be consistent.
* I think returning a quark is dangerous in case of sloppy package authors.
* I favour a deliberate error message for all in such cases, with a variant function for the "error" case; e.g.,

    \seq_clear:N \l_tmp_seq
    \seq_pop:NN \l_tmp_seq \x

should yield "Error: The sequence \l_tmp_seq is empty." with the possibility of also writing

    \seq_clear:N \l_tmp_seq
    \seq_pop:NNF \l_tmp_seq \x { <recovery code> }

in which the recovery code is executed in this case.

* * *

The above is just my own view on things and not necessarily optimal. I'm open to discussion, of course.

Cheers,
-- Will