[Ohrrpgce] SVN: james/5052 When loading an RSAV, pre-load the default hero and positions
Ralph Versteegen
teeemcee at gmail.com
Thu Feb 16 22:00:20 PST 2012
On 17 February 2012 05:49, James Paige <Bob at hamsterrepublic.com> wrote:
> On Thu, Feb 16, 2012 at 08:39:37AM -0800, subversion at HamsterRepublic.com wrote:
>> james
>> 2012-02-16 08:39:37 -0800 (Thu, 16 Feb 2012)
>> 161
>> When loading an RSAV, pre-load the default hero and positions
>> instead of using the nodespec .default syntax which doesn't work when the parent node is optional.
>> ---
>
> Thanks, Ralph! Your explanation really helped.
>
> I was wondering, should a nodespec with a .default ever be allowed in
> an optional parent? I might be misunderstanding, but it seems like using
> node."name".default() would reliably do the wrong thing if any parent
> node is not required. (or do I mean any grandparent node? ... I think I
> confused myself again )
>
> ---
> James
The problem wasn't really that the parent was optional, but rather
that the parent was meant to occur more than once, with different
values (different array elements). (And that's what LOADARRAY is for.)
You're not misunderstanding, that's a genuine problem. I thought about
throwing an error if you don't have an unbroken chain of defaulting
ancestor nodes, however I think there would be genuine use cases for
that. For example, suppose I added rsav/script/interpreter_state. If
it's missing, I do nothing at all, but if it exists, then nodes below
it could have defaults if missing.
But I think we could do with some changes to make that mistake harder
to make, like a recursive default option.
Also, I just realised that saying "required" and "optional" when we're
talking about whether or not a node defaults is pretty confusing.
More information about the Ohrrpgce
mailing list