ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthieu Riou" <matth...@offthelip.org>
Subject Re: [SimPEL] Adding with
Date Wed, 19 Dec 2007 19:12:20 GMT
On Dec 19, 2007 10:56 AM, Alex Boisvert <boisvert@intalio.com> wrote:

> On 12/19/07, Matthieu Riou <matthieu@offthelip.org> wrote:
> >
> > with(c = customer.payload.ns::customer, v = visitor.payload.ns::customer
> )
> > {
> >   c.ns::firstname = v.ns::fname;
> >   c.ns::lastname = v.ns::lname;
> >   with (ca = c.ns::address, va = v.ns::address) {
> >      ca.ns::city = va::ns.city;
> >      ca.ns::zipcode = va.ns::zip;
> >   }
> > }
>
>
> I think aliasing is a good idea, although I think we can achieve it using
> functions and possibly currying instead of adding syntax to the language.
> How about,
>
> c = xpath(customer.payload.ns::customer)
> v = xpath(visitor.payload.ns::customer)
>
> c.ns::firstname = v.ns::fname
> c.ns::lastname = v.ns::lname
>
> ca = xpath(c, c.ns::address)
> va = xpath(v, v.ns::address)
>
> ...
>

So far we've stick with the original definition and structure of BPEL
variables (they only hold XML) and functions have been either external or
defined in very specific places. Doing this would make them something
different entirely. I'm not sure we're ready to deal with closures and
currying just yet.


>
> Here c, v, ca and va are actually aliases to the original path. I'd also
> > propose (optional) that a non-existent path used in *with* gets created
> if
> > it doesn't exist when a *with* relies on it. So in my previous example
> if
> > customer.payload.ns::customer doesn't exist, we create this XML
> structure
> > and set it on customer.
> >
> > So the would get translated to a BPEL equivalent to:
> >
> > <if>
> >   <condition>!exists(customer.payload.ns::customer)</condition>
> >   <assign>
> >     <from><literal><ns:customer></ns:customer></literal></from>
> >     <to>$customer.payload</to>
> >   </assign>
> > </if>
>
>
> This has the side-effect of wiping the rest of the $customer.payload
> content.
>

Which is why I've said this behavior would be optional. I just haven't
figured out the syntax for this option yet :)

Matthieu


>
> alex
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message