[plt-scheme] PLT object system

From: Doug Orleans (dougo at place.org)
Date: Fri Feb 18 22:04:15 EST 2005

Matthias Felleisen writes:
 > On Feb 17, 2005, at 8:35 AM, David J. Neu wrote:
 > > Is there a "constructor"  mechanism, i.e. a procedure that is invoked
 > > each time each new, instantiate or make-object is invoked?
 > 
 > Do you mean created? Sure all expressions in the class definition are 
 > evaluated when you create an object. So
 > 
 > Welcome to MzScheme version 299.31, Copyright (c) 2004-2005 PLT Scheme, 
 > Inc.
 >  > (require (lib "class.ss"))
 >  > (define x (class object% (super-new) (printf "hello world~n")))
 >  > (new x)
 > hello world
 > #<struct:object:x>
 >  > (new x)
 > hello world
 > #<struct:object:x>
 >  > (new x)
 > 
 > and so on. It's like a constructor in Java but it's functional -- 
 > Matthias

What's functional about it?

--dougo at place.org



Posted on the users mailing list.