[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible changes to abstract types proposal
Stewart Greenhill <greenhil@murdoch.edu.au> writes:
> (Q1) Should abstract records be explicitly declared ABSTRACT?
>
> Pros:
> - Provides documentation. Improves clarity of declarations.
The biggest "Pro" IMO.
> - Allows early catching of errors.
And gives better error messages from the compiler. It can throw an
error message if an attempt to declare an abstract method for a non-
abstract record type. Without this flag a record must "automagically"
be marked abstract. This can lead to unpleasant surprises, like all
"magic".
> - Necessary to allow declaration of abstract types that do not have
> abstract methods.
>
> Cons:
> - Requires explicit declarations for record types.
> - May require multiple changes to classes if a base class changes its
> "abstractness".
This must not be a disadvantage.
> - Can lead to some potentially confusing declarations (eg. abstract types
> that do not have abstract methods).
>
> (Q2) Should it be possible to declare abstract extensions of concrete types?
>
> Pros:
> - Simpler specification (no restriction on abstract extensions).
> - Allows abstract types to inherit implementation from concrete types.
>
> Cons:
> - Use of this feature may lead to implementation dependences between
> classes and descendents. May result in unstructured class hierarchies.
This feature is only intended to add some more semantics to the
declarations, and to catch some errors when this semantics is
violated. It is not intended to enforce "good design".
-- mva