On 08/14/12 14:18, Mark Thomas wrote:
> On 10/08/2012 23:13, Kin-man Chung wrote:
>
>> There are some feedbacks from the public review. One of them is a
>> request for adding namespaces to idendifiers.
>>
>> I know CDI has been using a.b.c.d as namespaced identifiers, but that
>> creates ambiguities in both the syntax and semantics.
>>
>> Since we already have namespace for functions, its only logical to use
>> the same syntax and notation for identifiers. For example,
>>
>> ns:obj.foo denotes the property foo of an object with a namespace ns.
>>
>> Obviously, namespaces are only allowed for top level objections.
>>
>> Note that there is an ambiguity with the ?: operator.
>>
>> What does a? b: d : e mean, a? (b:c): e or a? b: (c: d)?
>>
>> I think we already have similar problem with namespaced function in :?
>> operators, so maybe we can reosslve this similarily. Let think about
>> this more.
>>
> Could we just define a precedence order and require use of () to change it?
>
I was thinking about this also. It probably makes sense to have
namespace higher precedence than :? operator.
>
>> How can we fit this into our ELResolver? When an
>> ELResolver.getValue(Object base, Object property) is invoked, property
>> is the identifier, as before, but instead of a null base, we can
>> encapsulate the namespace in "base". So the code will be like
>>
>> Object getValue(ELContext context, Object base, Object property) {
>> String namespace = null;
>> if (base != null&& base instance ELNameSpace)
>> namespace = ((ELNameSpace)base).getNameSpace();
>> }
>> ...
>>
>> What do you think?
>>
> Seems like a bit of a hack but I don't have any better ideas right now.
>
The other option is to leave base null, and to have property a String of
the form "ns:foo". I think this is more nature.
Kin-man
> Mark
>
>