[Dbix-class] abstract syntax (extract from a conversation)

David E. Wheeler david at kineticode.com
Fri Jul 27 06:03:36 GMT 2007


On Sat Jul 21 04:01:41 GMT 2007, mst wrote:

> > >>> { foo => 1, bar => { '!=' => 2 } }
> >
> > [ -cond => 'and',
> >   [ -statement, ... ]
> >   [ -statement,
> >     [ -key => 'bar' ],
> >     [ -op => 'is_not' ],
> >     [ -value => 2 ],
> >   ],
> > ]
>
>   [ -op, 'and', [ -op, 'is', ... ], [ -op, '!is', ... ] ]

And then…

> I think the value should be an explicit list, so
>
> [ -op, 'in', [ -ident ... ],
>   [ -list,
>     [ -value, \3 ],
>     [ -value, \4 ]
>   ]
> ]

So then should not the previous example be:

  [ -cond => 'and',
    [ -list,
      [ -statement, … ],
      [ -statement,
        [ -key => 'bar' ],
        [ -op => 'is_not' ],
        [ -value => 2 ],
     ],
   ]
]

Or does -list apply only to values?

> Sod hashrefs, they only lead to annoyance.

It's pretty typical to do ASTs/IRs as array refs, anyway. They're  
much more efficient, too.

Best,

David



More information about the Dbix-class mailing list