mx2cc crash during linkage

About Monkey 2 Forums Monkey 2 Programming Help mx2cc crash during linkage

Tagged: ,

This topic contains 15 replies, has 6 voices, and was last updated by  arpie 8 months, 2 weeks ago.

Viewing 16 post (of 16 total)
  • Author
    Posts
  • #14255

    arpie
    Participant

    ‘Static’ mean that this logic is common for whole class/type, not for every instance.

    Yes, absolutely.  But they can be invoked on a class OR on an instance.

    I am suggesting marking a Class Function as Abstract as a style of Contractual Programming.  Clearly it cannot be used to define common logic.

    This currently works in Monkey if you declare a Function in an Interface, and this makes total sense.  However, calling the Function() by doing Interface.Function() currently causes a compiler crash.  This also makes total sense but would be better caught during semanting with a sensible error message (“Illegal call to abstract function”?).

    My above logic should also be applicable to Abstract Classes, which are basically just Interfaces with some predefined methods.  Allowing Abstract Functions within Class declarations is the same as using them in Interfaces.  Indeed, this works as I described above in Monkey.  If an Abstract Function is not defined in a Derived Class, the semanter says “Class <class> is abstract due to unimplemented method(s)”.

Viewing 16 post (of 16 total)

You must be logged in to reply to this topic.