chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] define-record and define-record-type


From: Kon Lovett
Subject: Re: [Chicken-users] define-record and define-record-type
Date: Mon, 26 Apr 2010 13:09:26 -0700


On Apr 26, 2010, at 11:17 AM, Jeronimo Pellegrini wrote:

Hello,

I see that I can (use srfi-9), but define-record-type is already
available, even if I don't (use) the module. Can I always count on that?

W/ Chicken. Part of the non-standard syntax unit - use, and-let*, optional, etc.

I also see from

http://chicken.wiki.br/manual/Non-standard%20macros%20and%20special%20forms#record-structures

that besides SRFI-9 define-record-type there is also a define-record that
has a somewhat
different interface. Besides the different interface, is there any other
differences between
those? (Memory usage pattern, efficiency etc?)

'define-record' creates a ctor, pred, getters & setters for all fields. 'define-record-type' gives more control over the generated api; also a SRFI so wider support.

Chicken has a native type - structure (a tagged vector) - which is used for both kinds of records. So one getter is pretty much like another.

You might look at the "defstruct" egg.


Thanks,
J.



_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]