www.delorie.com/gnu/docs/kawa/kawa_63.html   search  
Buy GNU books!

Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.3 Allocating objects

Function: make type args ...
Constructs a new object instance of the specified type, which must be either a java.lang.Class or a <gnu.bytecode.ClassType>.

The args ... are passed to the constructor of the class type. If there is no applicable constructor, and the args ... consist of a set of (keyword,value)-pairs, then the default constructor is called, and each (keyword,value)-pair is used to set the correspdong slot of the result, as if by: (slot-set! result keyword value).

For example, the following are all equivalent:
(set! p (make <java.awt.Point> 3 4))

(set! p (make <java.awt.Point> y: 4 x: 3))

(set! p (make <java.awt.Point>))
(slot-set! p 'x 3)
(set! (slot-ref p 'y) 4)

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003