chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] retrieving a structure's symbol name


From: Marco Maggi
Subject: Re: [Chicken-users] retrieving a structure's symbol name
Date: Wed, 24 Jul 2019 19:22:45 +0200

Peter Bex wrote:

> On Wed, Jul 24, 2019 at 03:49:13PM +0200, Marco Maggi wrote:
>> Ciao,

>>   I know  that it is  dirty, but is it  possible to retrieve  the symbol
>> name of  a structure  from the  block object?  If  I create  a structure
>> with:

>>    (define (make-it)
>>      (##sys#make-structure 'spiffy))

>>    (define O
>>      (make-it))

>> can  I extract  "spiffy"  from the  structure object  bound  to "O"?   I
>> searched "library.scm" in CHICKEN's 5.1.0 source without success.

> You can access slot 0 to get it:

> (##sys#slot (##sys#make-structure 'foo) 0) => foo

Yes!  Damn, I already knew about it...

> And it will be namespaced with the module if it is defined in a module.

Mh.   If I  understand correctly  this is  to avoid  collisions for  the
record printers,  and stuff like that.   If I define my  own record-type
constructor, and I want to  use the built-in record printers facilities:
is  CHICKEN expecting  me  to qualify  the name  with  the module?   The
symbols I want to use are expected to be unique...

Thanks.
-- 
Marco Maggi



reply via email to

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