Wiki

Ticket #84 (closed enhancement: fixed)

Opened 16 years ago

Last modified 15 years ago

Classes without explicit initializers should inherit the ones from the base class

Reported by: Chuck Owned by:
Priority: major Milestone: Cobra 0.9
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

Classes that don't declare explicit initializers currently get one parameterless initializer. This is rather annoying when building a class hierachy. Imagine a class such as:

class NamedPoint
    def init(name as String, x as int, y as int)
        ...
    def init(x as int, y as int)
        ...

A subclass such as:

class MyNamedPoint
    inherits NamedPoint
    pass

Should support this out of the box:

p = MyNamedPoint('origin', 0, 0)
q = MyNamedPoint(1, 1)

In fact, there is no reason to believe that a parameterless initializer is a good guess when the base class does not have any.

This might affect existing code, so we may need a new -legacy: option to force the old behavior.

Change History

Changed 16 years ago by Chuck

  • milestone set to Cobra 0.9

This would now be part of ticket:92

Changed 16 years ago by Chuck

bump

Changed 15 years ago by Chuck

  • status changed from new to closed
  • resolution set to fixed

Done in changeset:2322

Note: See TracTickets for help on using tickets.