On 10/01/10 15:44 +0100, Hartmut Goebel wrote:
> 
> Am So, 10.01.2010, 15:18, schrieb Cédric Krier:
> 
> > The issue is that in json, it is a common practice to use __class__ to
> > extend
> > json to handle new class. So it is expected to have a string as value,
> 
> IC.
> 
> >>     ["id", ["If", ["Not", ["In", ["Eval", "context", {}], "company",
> >> null]], "=", "!="], ["Get", ["Eval", "contex1", {}], "company", 0]]
> >>
> >
> > The issue for this one is what about a list that will have one of this key
> > words ("Eval", "If" etc).
> 
> Should not be a problem:
> * The first element in the list is _always_ the function/class-name.
> * All (remaining) elements are arguments which are either
>   - terminal symbols ('company', 0, 'Eval') or
>   - function calls (this is lists.
> * If an argument is a list, it will always be another function call --
>   since we doe not know the datatype list. (If we are intruding lists, this
>   will become a new function/class "List".)

No. We use json notation where a list is a list and we add some hook to handle
some kind of list differently.
The goals is to able to define dynamic domains in Tryton like this:

[('name', 'in', ['Foo', 'Bar'])]

where the list will be dump in json with the pyson hook.

So what about this domain:

[('name', 'in', ['Eval', 'Bar'])]

This will not work in your implementation as the list will be considered as an
eval statement instead of a list object.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier

Attachment: pgpNirVTpoybR.pgp
Description: PGP signature

Reply via email to