Yes. That's a limitation in the current grammar. Grubba and I have discussed it quite a bit and found that it's fairly complicated to fix (but possible). Grubbas new compiler should handle it properly.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-05-06 23:10: Subject: Re: Implicit class construction, _cast() and `=()
I've noticed similar compiler issues on several occasions. Example:
class BaseNode { static Element|Doc parent; Element|Doc getParent() { return parent; } // using class names as types works fine in the two lines above... int getDepth() { object(Element)|object(Doc) p; // ...but triggered a parse error if done here return ( p = this->getParent() ) ? ( p->getDepth() + 1 ) : -1; } /* ...more stuff elided */ }
also, soft casts such as [Element]p fail to parse, while [object(Element)]p or even [array(Element|Text)]children work OK.
/ rjb