You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-dev@incubator.apache.org by Xiping Wang <xi...@us.ibm.com> on 2009/03/06 14:41:17 UTC

Question about some collection operations

Neeraj,

I have some questions about collection expressions for you.

1) In a collection expression such as Max, is it allowed to include a
declared constant in it's parameter list ?
Imperius seems like Max(10,10,1,2,3,4,5), but not Max(p,10,1,2,3,4,5) as
p's value is not included in the symTable after parsing.
So when evaluating the Max expression Max(p,10,1,2,3,4,5), a
NullPointException is thrown.

2) Does each element of a collection expression have to be of
SingleArgumentExpression type? This is not clear to me, it is not clearly
specified in the spec.
For example, is it allowed to write something like this, Max(x+y, 1, 2, 3)
where x+y is a DoubleArgumentExpression. The Imperius parser is happy with
it, but an exception gets thrown at
evaluation time as the lhs and rhs of "x+y" are null.

3) In a collection expression, can an element be another collection? For
example, InCollection(x, [1,2,[3,4,5]]). Again, the parser seems like it,
but the evaluation part does not expect any element to be another
collection.


Thanks,

Xiping

Re: Question about some collection operations

Posted by Xiping Wang <xi...@us.ibm.com>.
Hi Neeraj,

Thanks for the reply. Right, the spec needs to be clear about these issues.

Xiping



                                                                           
             Neeraj                                                        
             Joshi/Durham/IBM@                                             
             IBMUS                                                      To 
                                       imperius-dev@incubator.apache.org   
             03/09/2009 08:55                                           cc 
             AM                                                            
                                                                   Subject 
                                       Re: Question about some collection  
             Please respond to         operations                          
             imperius-dev@incu                                             
             bator.apache.org                                              
                                                                           
                                                                           
                                                                           
                                                                           




Hi Xiping


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"The light at the end of the tunnel...may be you"


Neeraj Joshi
WebSphere XD - Compute Grid
AIM, IBM
Apache Imperius - http://incubator.apache.org/imperius
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Date:
03/06/2009 09:44 AM
Subject:
Question about some collection operations




>Neeraj,

>I have some questions about collection expressions for you.

>1) In a collection expression such as Max, is it allowed to include a
>declared constant in it's parameter list ?
>Imperius seems like Max(10,10,1,2,3,4,5), but not Max(p,10,1,2,3,4,5) as
>p's value is not included in the symTable after parsing.
>So when evaluating the Max expression Max(p,10,1,2,3,4,5), a
>NullPointException is thrown.

Where is 'p' declared ? can you show a sample policy?

>2) Does each element of a collection expression have to be of
>SingleArgumentExpression type? This is not clear to me, it is not clearly
>specified in the spec.
>For example, is it allowed to write something like this, Max(x+y, 1, 2,
3)
>where x+y is a DoubleArgumentExpression. The Imperius parser is happy
with
>it, but an exception gets thrown at
>evaluation time as the lhs and rhs of "x+y" are null.

That is correct, the specification didn't say such embedding was allowed
as far as I remember.

>3) In a collection expression, can an element be another collection? For
>example, InCollection(x, [1,2,[3,4,5]]). Again, the parser seems like it,
>but the evaluation part does not expect any element to be another
>collection.

Cascaded collections was again not called out in the spec.

But I agree that all these cases should either be handled at compile time
or we provide an implementation at
execution times.

>Thanks,

>Xiping


Re: Question about some collection operations

Posted by Neeraj Joshi <jn...@us.ibm.com>.
Hi Xiping


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"The light at the end of the tunnel...may be you"

 
Neeraj Joshi
WebSphere XD - Compute Grid
AIM, IBM
Apache Imperius - http://incubator.apache.org/imperius
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Date:
03/06/2009 09:44 AM
Subject:
Question about some collection operations




>Neeraj,

>I have some questions about collection expressions for you.

>1) In a collection expression such as Max, is it allowed to include a
>declared constant in it's parameter list ?
>Imperius seems like Max(10,10,1,2,3,4,5), but not Max(p,10,1,2,3,4,5) as
>p's value is not included in the symTable after parsing.
>So when evaluating the Max expression Max(p,10,1,2,3,4,5), a
>NullPointException is thrown.

Where is 'p' declared ? can you show a sample policy?

>2) Does each element of a collection expression have to be of
>SingleArgumentExpression type? This is not clear to me, it is not clearly
>specified in the spec.
>For example, is it allowed to write something like this, Max(x+y, 1, 2, 
3)
>where x+y is a DoubleArgumentExpression. The Imperius parser is happy 
with
>it, but an exception gets thrown at
>evaluation time as the lhs and rhs of "x+y" are null.

That is correct, the specification didn't say such embedding was allowed 
as far as I remember.

>3) In a collection expression, can an element be another collection? For
>example, InCollection(x, [1,2,[3,4,5]]). Again, the parser seems like it,
>but the evaluation part does not expect any element to be another
>collection.

Cascaded collections was again not called out in the spec. 

But I agree that all these cases should either be handled at compile time 
or we provide an implementation at
execution times.

>Thanks,

>Xiping