rtti cast
BCS
ao at pathlink.com
Thu May 8 11:51:16 PDT 2008
Reply to terranium,
> Jarrett Billingsley Wrote:
>
>>> yeah, try something else, hide the bug :)
>>> ...
>>> ...efficient bugmaker.
>> I _really_ don't understand where you're coming from here. I'd be
>> interested to see some example of code where an invalid downcast were
>> a bug and where a failed cast _should_ throw an exception. I've only
>> ever used downcasts in D as a replacement for Java's "instanceof",
>> where it's just a simple typecheck.
>>
> void GetNodes()
> {
> auto obj = Parser.GetNextObject();
> MyList.Add(cast(INode)obj);
> }
Dang, you just reminded me that I do have some code that downcasts and expects
stuff to work (it check the cast though). It's in a generated parser I'm
working on.
More information about the Digitalmars-d
mailing list