On Wed, 2003-02-26 at 06:30, Clark C. Evans wrote:
> On Mon, Feb 24, 2003 at 10:56:07AM -0800, Brian Ingerson wrote:
> | ---
> | dir:
> | web: /web
> | cgi: $web/cgi-bin
> | cgi_dict: $cgi/dict
> | include:
> | - $cgi_dict/lib
> A $$ would be nice to let you know what the parent-key is...
> id: $$ # short for 2939
> name: Clark
> id: $$ # short for 9393
> name: Brian
> I find this pattern alot, I want to use an ID as the
> key, but yet, I want to store the key in a mapping.
> I'd like a nice short-cut syntax for this, it need
> not be in yaml-core... the $ variable substution
> thingy above is quite cool though.
It doesn't look like you can get thais in the current implementation of
the Perl module: the YAML object does not expose the parent key when the
loader is called.
It does not look like a big deal to store the stack of keys in the
object though. I have a patch that does just that BTW, if you want it
Ingy (or should I send you its spirit? ;--).
It might be smarter to allow callbacks when keys are recognized though,
that would be a little more generic (it would allow you to manage scopes
for variables for example).
Michel Rodriguez <mirod@...>