Skip to Content Java Solaris Communities Partners My Sun Sun Store United States Worldwide

»  Spotlight Articles
»  Projects
»  Publications
»  People
»  Awards
»  Events
»  Downloads
»  Internships
»  Contrarian Minds
»  About Sun Labs

Resends

  • Used to invoke overridden methods:
    	at: key = (resend.at: hash: key)
       

    Syntax for different message types:
    		resend.unary 
    		resend.+ arg	"binary" 
    		resend.foo: bar	"keyword" 
       
  • Directed resend chooses between multiple parents:
    	(|
    		parent1* = (| foo = 3 |).	
    		parent2* = (| foo = 4 |).
    		foo = (parent1.foo + parent2.foo)
    	|)
    

Resends

Self has a resend mechanism, using the keyword resend. This enables an overriding method to invoke the overridden method.

The syntax used is to attach the message selector to resend with a period, e.g.:

	at: key = (resend.at: hash: key)
This example defines a method at: which invokes an overridden version of at:, passing it the hash of its argument.

When an object has multiple parents, a directed resend can be used to disambiguate conflicting inherited slots. In this case resend is replaced by the name of the parent slot:

	(|
		parent1* = (| foo = 3 |).	
		parent2* = (| foo = 4 |).
		foo = (parent1.foo + parent2.foo)
	|)

[ Previous ] [ Index ] [ Next ]
Would you recommend this Sun site to a friend or colleague?
Contact About Sun News Employment Privacy Terms of Use Trademarks Copyright 1994-2008 Sun Microsystems, Inc.