This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: (OT) how to pass named parameters to the procedure?
- From: Per Bothner <per at bothner dot com>
- To: Victor Anyakin <anyakin at bonustec dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Tue, 13 Dec 2005 10:34:56 -0800
- Subject: Re: (OT) how to pass named parameters to the procedure?
- References: <20051213120649.GA7046@anyakin> <20051213182441.GB8800@anyakin>
Victor Anyakin wrote:
On Tue, Dec 13, 2005 at 02:06:49PM +0200, Victor Anyakin wrote:
Greetings to all,
the question is slightly offtopic, but, probably, somebody could
explain, is it possible to pass named parameters to functions in
scheme and in Kawa particulary.
I mean, is it possible to perform such calls:
(tn-char :code 32 :blink #t :underline #f)
Kawa does support keyword parameters, but Kawa prefers a colon at
the end:
(tn-char code: 32 blink: #t underline: #f)
Well, I have figured out, that it can be achieved by using
`make-record-type' and then calling `make' to instantiate a new
record.
make-record-type should be avoided, because the compiler can't
help you make better code or error-messages.
Yse define-simple-class (or define-class) for flexibility and
interfacing with Java classes
http://www.gnu.org/software/kawa/Defining-new-classes.html
or use define-record-type for portability:
http://www.gnu.org/software/kawa/Record-types.html
The next question is: is there any pattern, or `recipe' how to make
records with default values?
define-simple-class
--
--Per Bothner
per@bothner.com http://per.bothner.com/