[Issue 1595] Multiple typedefs of Exception should be treated as different types.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 20 08:31:48 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1595





------- Comment #4 from thomas-dloop at kuehne.cn  2007-10-20 10:31 -------
http://www.digitalmars.com/d/declaration.html
# Strong types can be introduced with the typedef. Strong
# types are semantically a distinct type to the type checking
# system, for function overloading, and for the debugger.

As far as I understand the quote, typedefs create distinct types.
For classes I always asumed that

#
# typedef Master Slave;
#

was syntactic sugar for

#
# class Slave : Master{
#       this(...){
#               super.this(...);
#       }
# }
#

however the current implementation only creates a
strong-at-compiletime and weak-at-runtime type.
Test code:

# import std.stdio;
#
# class Master{
# }
#
# typedef Master Slave;
#
# void main(){
#    Object o;
#
#    o = new Master(); // 1
#    writefln("1: %s", o);
#
#    o = new Slave(); // 2
#    writefln("2: %s", o);
# }

As the debugger currently can't differentiate the types of object
1 and 2 I'd rate this a general bug that was triggered in this case
by "catch".


-- 



More information about the Digitalmars-d-bugs mailing list