is Missing multiple inheritance in sqeak a drawback ?

Avi Bryant avi at beta4.com
Fri Oct 11 23:32:47 UTC 2002


On Fri, 11 Oct 2002, Andrew Berg wrote:

> I've been thinking about this, and what I decided I
> want (but sadly don't have time to build) is a browser
> that can perform this for me.  The second-rightmost
> pane in the system browser--it shows message
> categories--I would like to have it also show and
> manage mixins for me.  I could add a variable and then
> say that that variable implements my Foo interface,
> and it would just generate passthru message handlers
> to that object, which I could then manipulate.

For fun, I just added this method to my MetaMonkey codegen package:

delegateMethodsOf: aClass to: instVarName
	(aClass allSelectors difference: self allSelectors) do:
		[:sel | |pattern|
		pattern _ self messagePatternFor: sel.
		self generate: pattern, ' ^ ', instVarName, ' ', pattern]

usage is like this:

MyClass class>>generate
	self delegateMethodsOf: Collection to: 'myCollection'

It's not as nice as specialized UI code in the browser, of course, but
I've found that maintaining class side declarations like that is pretty
painless.

What this won't do, unfortunately, is track Collection and regenerate the
wrappers if Collection gains or loses some methods.

You can grab the code from
http://beta4.com/squeak/aubergines/source/MetaMonkey.st

Cheers,
Avi




More information about the Squeak-dev mailing list