[rules-users] Literal representation for value objects

Edson Tirelli tirelli at post.com
Sun Mar 8 11:35:38 EDT 2009


    I like features that add language extensibility and I would be happy to
consider that into the design of the language if people can provide us with
a good proposal. In this case, the (upcoming?) support for units in MVEL
would be an implementation of this extension point.

    The main problem I see is how to identify which plugin would be
responsible for interpreting a given value. For instance:

Box( height < “3 meters” )

    How will the engine know that "3 meters" should be parsed by plugin A
instead of plugin B? Or even how should the engine know "3 meters" isn't
just a String?

    I think if we answer this question, everything else may be fixed to
work. As you may see, this is as much a language design/parsing question as
an internal issue.

    []s
    Edson

PS: this will not make the cut for 5.0, but we may be able to do something
right after, for 5.1.



2009/3/8 Mark Proctor <mproctor at codehaus.org>

> David Boaz wrote:
>
>> Hi,
>> In my application we use few value objects. For example, Dates, Quantities
>> and Durations. These objects are immutable and have some behavior. For
>> example, comparing two quantities may involve quantity-conversion
>> computations (“2 foot” < “3 meter”).
>>
>> In drools documentation I found an interesting example (section
>> 6.5.2.1.1.3.2. Literal Restrictions, example 6.20):
>> Cheese( bestBefore < “27-Oct-2007”)
>> How Does the parser knows to create a Date object from that String? Does
>> Date has a ‘specialized’ behavior in drools? Is it possible to ‘plugin’
>> similar behavior for my value classes? How?
>>
>> I’d like to achieve the following functionality:
>> Person(height < “2-meter”)
>>
>>
> We have built in type co-ercion, unfortunately this is not pluggable and
> fixed around numbers, strings and dates. We are looking to have built in
> unit support at some time, but no specific dates for this, we are waiting
> for the feature to make it's way into MVEL, probably around Q3 I guess,
> you'll have to ask the MVEL author.
>
> Mark
>
>> Thanks, David
>>
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090308/022fdf95/attachment.html 


More information about the rules-users mailing list