Subject: | |
From: | |
Reply To: | |
Date: | Wed, 13 Apr 2011 16:44:34 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hello all,
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.
There are arguments for and against the difference in behaviour.
On the side of the current approach, an empty sequence is very different
from a missing key in a a property list. If a sequence is being used as
a stack, then trying to get/pop once it is empty is probably going to be
due to a coding error. If you potentially return \q_no_value then there
has to be a quark test each time you get a value, and that does not make
so much sense for a stack.
On the other hand, \q_no_value is defined as being a special return
value used when there is 'nothing to return'. Doing
\seq_pop_left:NN \<seq> \<tl var>
\quark_if_no_value:NF \<tl var>
is not going to be too much slower than the current code, as there is an
internal test which would be removed if the behaviour was changed.
Thoughts?
--
Joseph Wright
|
|
|