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?
On Tue, Dec 13, 2005 at 10:34:56AM -0800, Per Bothner wrote:
> 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
Seems to me that this exactly the solution I have been looking for.
Thanks alot for your hint
--
Victor Anyakin () ascii ribbon campaign
/\ - against html mail