Skip to content
PragTob edited this page Jan 19, 2013 · 11 revisions

Reconciling Classes and Traits - Module systems course at HPI

We're trying to make any class usable as a trait in a Master's course at HPI's Software Architecture Group.

Principles

  1. programmers need to specify ambiguous cases:
  • conflicts at compile-time
  • conflicts don't change including classes
  1. tool support to show programmers what needs to be decided

Limitations

  • Variable sized classes → for now not allowed as traits
  • Changing original classes/class hierarchy does not change the target classes which already contain included code
  • It is not possible to: Include the same instance variable from two separate traits into my class, unless both use an instance variable which already exists in my class.

Usage

Superclass subclass: #SubclassName
	instanceVariableNames: 'muh'

	"TraitClasses: include other (parts of) other classes"
	Includes: { #OtherClass selectors: {#selA . #hi} .
	    #AnotherClass . 
	    #YANC 
	      variables: {#muh useExisting. #bla . (#sel1 -> #sel2 useExisting)}
	      selectors: {#useMuh}
	      protocols: {#enumeration}.
	}

	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Models'

Development