Interfaces ala Java for Squeak

Stephen Travis Pope stp at create.ucsb.edu
Thu Nov 19 17:14:33 UTC 1998


There have been several browser extensions in various Smalltalks over the years
to use method protocols more formally, i.e., to extend their semantics beyond
that of pure annotation. 

One simple approach is to add automatic delegation-generation, so that you can
tell a class (e.g.,) to forward Magnitude>>comparison protocol to its "value"
instance var.

Another extension is to allow "protocol copy" so that, if you define a protocol
named "printing" the browser copies a template "printOn:" method there. You can
add a browser menu that lets the user choose among the common protocols for
class or metaclass methods, enabling you to define a class and simply select a
few standard protocols -- "gimme a class with these instVars and with
'initialize-release,' 'accessing' (auto-gen instVar accessors), 'displaying,'
and 'printing' protocols (interfaces)."

The third useful technique I've seen is static protocol-based testing, which
complains (e.g.,) if there's a "printing" protocol but no "printOn:" method in
it.

All of these are simple tool hacks, not extensions to the class description
object or the class definition method.

-- 
stp

_ Stephen Travis Pope
_ stp at create.ucsb.edu,  http://www.create.ucsb.edu/~stp/





More information about the Squeak-dev mailing list