Getter for no field Takashi Kato (07 Sep 2015 12:16 UTC)
Re: Getter for no field taylanbayirli@xxxxxx (07 Sep 2015 12:49 UTC)
Re: Getter for no field Takashi Kato (07 Sep 2015 13:05 UTC)
Re: Getter for no field taylanbayirli@xxxxxx (07 Sep 2015 13:38 UTC)

Re: Getter for no field taylanbayirli@xxxxxx 07 Sep 2015 12:49 UTC

Takashi Kato <xxxxxx@ymail.com> writes:

> I've just noticed the SRFI doesn't specify the following case:
>
>     (ref box)
>
> The box is, for example, SRFI-111 Boxes object which doesn't have
> any field by definition (am I correct?). How should this case behave?
> I think it's nice to accept this.

Hmm, good question.  Boxes have a field, just a single one.  It would be
difficult to support (ref box) without a field argument, and even more
difficult to integrate that into ref*.

Losing only (ref box) wouldn't be a big deal, but not being able to walk
through them in ref* might prove to be a big annoyance.

A special value that simply names the one field of the box would
probably be the best way to support this.

How about,

    (ref box '*)

but more importantly:

    (ref* foo 0 "blah" '* 3)

(I wouldn't expect people to use (ref box '*) over (unbox box).  It's
only there for the ref* case.)

The symbol * is reminiscent of pointer dereferencing in C so it might be
a good choice.  Others I can think of are #f or #t, but that doesn't
make too much sense to me.  I like * more...  Thoughts?

Taylan