Fields may be marked abstract, virtual, and override - all normal method semantics apply to both getter and setter
Individual getter/setter may not be marked abstract/virtual/override - only the field in unison (otherwise it gets way too complicated)
The setter may narrow the protection scope over the getter - this is the only flag allowed per getter/setter
A field may override a method that matches its getter, but must specify the override keyword
Mixins
Mixins will support abstract fields so that we can design APIs that use normal getter/setter convention (OutStream.charset is example);
At a later date it may be useful to define non-abstract mixin fields, but it creates a lot complications
A mixin may not declare private slots
Inheritance rules
The slot reflection and compiler rules defined below match exactly
Constructors are never inherited - they are available only in their declaring type
Private slots are never inherited - they are available only in their declaring type
Internal slots are inherited only by types with the same pod
Two parent types with static method of the same name cannot be subclassed together
Two parent types with const of the same name cannot be subclassed together
Two parent types with instance methods of the same name and different signatures cannot be subclassed together
Two parent types with instance methods of the same name and same signature may be subclassed given that only one has a concrete implementation or both are virtual and the subclass overrides to provide an unambiguous definition
Protection Scope
Overrides can expand scope protected->public or internal->public
Private and internal may cause of emit problems due to name conflicts (since it is permissible for subclasses to declare non-overridden versions)
Private/virtual is impossible combination
Const
Static fields will be removed since they would allow multiple threads to share state
Const fields will replace static fields (const keyword)
Const fields must have initial const value (or List.ro/Map.ro), getter/setter disallowed, abstract/virtual/override disallowed
Const classes marked with const keyword are guaranteed immutable
Short term only sys classes will be const (Str, Int, Uri, etc)
Long term need to define rules for user-defined const classes (every field set in ctor only)
Const classes will also play vital role in efficient message passing b/w threads
Default Parameters
Syntax to use super class's defaults: writeChars(Str str, Int off := super, Int len := super)
Covariant Return Types
This would be nice - Andy needs to investigate if CLR supports
If CLR doesn't support compiler will insert CovariantCast opcode which Java can ignore
A generic T type would be really cool for enclosing type, but likely insanely complex
brian Wed 27 Sep 2006
Fields
Mixins
Inheritance rules
Protection Scope
Const
Default Parameters
Covariant Return Types