Inferred return types
Jacob Carlborg
doob at me.com
Sat Jun 30 04:00:08 PDT 2012
On 2012-06-30 01:25, Martin Nowak wrote:
>> class Foo
>> {
>> auto foo ()
>> {
>> return "Foo";
>> }
>> }
>>
>> class Bar : Foo
>> {
>> auto foo ()
>> {
>> return "Bar";
>> }
>> }
>>
> Ouch, what a terrible idea to base a class hierachy on inference.
> But nonetheless covariance checking should be performed after inference.
I actually found the bug by mistake. I was going to override a method in
a subclass and got the error. The strange thing is that I had copied the
method from the super class and it didn't work anyway. Then I saw, in
the super class, that I didn't have a return type on the method. I had
just missed declaring a return type, the intention was not to use type
inference. I guess I use Ruby too much :)
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list