DMD 1.019 and 2.003 releases

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Jul 25 12:51:03 PDT 2007


Walter Bright wrote:
> Bruno Medeiros wrote:
>> I agree, but on a side note, shouldn't D's cast() operator be used 
>> exclusively to subvert *static* type checking?
>> (Since currently it's also used to check the runtime type of class, 
>> instead of a separate construct like Java's 'instanceof', C#'s 'is', 
>> or C++'s 'dynamic_cast')
> 
> I could argue it either way.

Some other interesting examples.

--- Ruby
obj.is_a? Class       # Considers all ancestor classes
obj.instanceof? Class # Only considers immediate class
obj.class == Class    # Same as above, naturally

--- PHP
is_a(obj, 'Class')


The terms 'is' and 'is a' seem to be everywhere.

(But I'm actually perfectly fine with the cast() style.)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list