3

I am on Apama 10.3 (Community Edition):

any emptyString := "";
any emptyDictionary := new dictionary<string,any>;
string myString := <string> emptyString;
dictionary<string,any> := <dictionary<string,any>> emptyDictionary;

The cast in line 3 works, but in line 4 Designer complains about unexpected token: <. Only if I use white spaces does it work:

dictionary<string,any> := <dictionary< string,any> > emptyDictionary;

In the documentation Developing Apama Applications this is not mentioned but on page 296 when casting with optional<>, the correct syntax with the white spaces is used.

Does this work as expected or is it a bug?

Saurav Sahu
  • 13,038
  • 6
  • 64
  • 79
Caribou
  • 2,070
  • 13
  • 29

1 Answers1

3

The problem here isn't about casting to an any type. This is due to the EPL parser always interpreting expression >> as a right-shift operator. If you need to close two angle brackets, you always need to use a space between them. It’s only the closing brackets that are affected (as you’d never need to write << in EPL).

The form I always use is:

dictionary<string,any> x := <dictionary<string,any> > emptyDictionary;
sequence<sequence<string> > jaggedArray := new sequence<sequence<string> >;
Saurav Sahu
  • 13,038
  • 6
  • 64
  • 79
HenryLockwood
  • 215
  • 1
  • 8