unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Removal of SCM_UNBOUND
@ 2006-04-15 21:41 Clinton Ebadi
  2006-04-15 22:03 ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Clinton Ebadi @ 2006-04-15 21:41 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1023 bytes --]

When I was running through the evaluator code, I noticed the comment on
SCM_UNBOUND (only used by GOOPS), and that it should be replaced by
SCM_UNSPECIFIED.

Defining SCM_GOOPS_UNBOUND to SCM_UNDEFINED seemed to work:

guile> (version)
"1.9.0"
guile> (use-modules (oop goops))
guile> (define-class <foo> () (bar))
guile> (define quux (make <foo>))
guile> (slot-ref quux 'bar)

Backtrace:
In current input:
   5: 0* [slot-ref #<<foo> a7cd00f0> bar]

<unnamed port>:5:1: In procedure slot-ref in expression (slot-ref quux
(quote bar)):
<unnamed port>:5:1: Slot `bar' is unbound in object #<<foo> a7cd00f0>
ABORT: (goops-error)
guile> (slot-set! quux 'bar 5)
guile> (slot-ref quux 'bar)
5

Is there anything I am missing, or would it be possible to just drop
SCM_UNBOUND from CVS HEAD?
-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@fnode#tpu Jabber:clinton@hcoop.net
I use Free Software because I value freedom over features.
443E 4F1A E213 7C54 A306  E328 7601 A1F0 F403 574B

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Removal of SCM_UNBOUND
  2006-04-15 21:41 Removal of SCM_UNBOUND Clinton Ebadi
@ 2006-04-15 22:03 ` Mikael Djurfeldt
  2006-04-15 22:06   ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2006-04-15 22:03 UTC (permalink / raw)
  Cc: Mikael Djurfeldt, guile-devel

On 4/15/06, Clinton Ebadi <clinton@unknownlamer.org> wrote:
> guile> (use-modules (oop goops))
> guile> (define-class <foo> () (bar))
> guile> (define quux (make <foo>))
> guile> (slot-ref quux 'bar)
>
> Backtrace:
> In current input:
>    5: 0* [slot-ref #<<foo> a7cd00f0> bar]
>
> <unnamed port>:5:1: In procedure slot-ref in expression (slot-ref quux
> (quote bar)):
> <unnamed port>:5:1: Slot `bar' is unbound in object #<<foo> a7cd00f0>
> ABORT: (goops-error)
> guile> (slot-set! quux 'bar 5)
> guile> (slot-ref quux 'bar)
> 5
>
> Is there anything I am missing

(define x (if #f #f))
(slot-set! quux 'bar x)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Removal of SCM_UNBOUND
  2006-04-15 22:03 ` Mikael Djurfeldt
@ 2006-04-15 22:06   ` Mikael Djurfeldt
  2006-04-15 22:13     ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2006-04-15 22:06 UTC (permalink / raw)
  Cc: Mikael Djurfeldt, guile-devel

On 4/16/06, Mikael Djurfeldt <mdjurfeldt@gmail.com> wrote:
> (define x (if #f #f))
> (slot-set! quux 'bar x)

Actually, I notice that I read your post sloppily.  SCM_UNDEFINED
might work, but I think you should check that thoroughly.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Removal of SCM_UNBOUND
  2006-04-15 22:06   ` Mikael Djurfeldt
@ 2006-04-15 22:13     ` Mikael Djurfeldt
  2006-04-15 23:26       ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2006-04-15 22:13 UTC (permalink / raw)
  Cc: Mikael Djurfeldt, guile-devel

On 4/16/06, Mikael Djurfeldt <mdjurfeldt@gmail.com> wrote:
> On 4/16/06, Mikael Djurfeldt <mdjurfeldt@gmail.com> wrote:
> > (define x (if #f #f))
> > (slot-set! quux 'bar x)
>
> Actually, I notice that I read your post sloppily.  SCM_UNDEFINED
> might work, but I think you should check that thoroughly.

While putting together my daugther's Easter egg, I suddenly realized
that the thing that mght bite you is that many parts of GOOPS is
written in Scheme so that, if this UNBOUND value is eqv? to
SCM_UNDEFINED, things go wrong as soon as any Scheme primitive, used
by GOOPS itself, happen to get this value passed in an optional
argument.

I think there *are* instances like this so that making them eqv?
really does introduce a bug.  But even if it doesn't right now, having
them eqv? seems likely to introduce future bugs.

M


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Removal of SCM_UNBOUND
  2006-04-15 22:13     ` Mikael Djurfeldt
@ 2006-04-15 23:26       ` Neil Jerram
  2006-04-17  8:21         ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2006-04-15 23:26 UTC (permalink / raw)
  Cc: Clinton Ebadi, guile-devel

"Mikael Djurfeldt" <mdjurfeldt@gmail.com> writes:

> While putting together my daugther's Easter egg, I suddenly realized
> that the thing that mght bite you is that many parts of GOOPS is
> written in Scheme so that, if this UNBOUND value is eqv? to
> SCM_UNDEFINED, things go wrong as soon as any Scheme primitive, used
> by GOOPS itself, happen to get this value passed in an optional
> argument.
>
> I think there *are* instances like this so that making them eqv?
> really does introduce a bug.  But even if it doesn't right now, having
> them eqv? seems likely to introduce future bugs.

Just to check my understanding: I believe the existing SCM_UNBNDP
macro, which is used in C code to check for the presence of an
optional argument, expands to (x == SCM_UNDEFINED); I presume that
SCM_UNBOUND is a distinct value (and somewhat confusingly unrelated to
SCM_UNBNDP) used by GOOPS to indicate an unbound slot.

Then, as Mikael says, bugs may be introduced where a Scheme primitive
takes an optional argument and passes that argument on, untranslated,
to code that uses that value to set or test a slot's value.

That sounds unlikely, though.  In my experience, I've never noticed
SCM_UNDEFINED escaping onto the Scheme level, and all the primitive
code that I can remember immediately translates SCM_UNDEFINED to some
locally meaningful default value.

Regards,
    Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Removal of SCM_UNBOUND
  2006-04-15 23:26       ` Neil Jerram
@ 2006-04-17  8:21         ` Mikael Djurfeldt
  0 siblings, 0 replies; 6+ messages in thread
From: Mikael Djurfeldt @ 2006-04-17  8:21 UTC (permalink / raw)
  Cc: Clinton Ebadi, Mikael Djurfeldt, guile-devel

On 4/16/06, Neil Jerram <neil@ossau.uklinux.net> wrote:
> Just to check my understanding: I believe the existing SCM_UNBNDP
> macro, which is used in C code to check for the presence of an
> optional argument, expands to (x == SCM_UNDEFINED); I presume that
> SCM_UNBOUND is a distinct value (and somewhat confusingly unrelated to
> SCM_UNBNDP) used by GOOPS to indicate an unbound slot.

Right.  (If I remember correcty, the SCM_UNBOUND/SCM_UNBNDP confusion
was present already in the version of SCM which Guile originally was
based on.  At that time, SCM_UNBOUND was used to mark an unbound
variable, so it is natural for GOOPS to use it to mark an unbound
slot.)

> Then, as Mikael says, bugs may be introduced where a Scheme primitive
> takes an optional argument and passes that argument on, untranslated,
> to code that uses that value to set or test a slot's value.
>
> That sounds unlikely, though.  In my experience, I've never noticed
> SCM_UNDEFINED escaping onto the Scheme level, and all the primitive
> code that I can remember immediately translates SCM_UNDEFINED to some
> locally meaningful default value.

No, that's not what I mean.  Rather, I think code internal to GOOPS
will at some instances extract and pass on the SCM_GOOPS_UNBOUND
value. If SCM_GOOPS_UNBOUND is defined to be the same value as
SCM_UNDEFINED, then SCM_UNDEFINED will escape this way, which
obviously leads to problems.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-17  8:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-15 21:41 Removal of SCM_UNBOUND Clinton Ebadi
2006-04-15 22:03 ` Mikael Djurfeldt
2006-04-15 22:06   ` Mikael Djurfeldt
2006-04-15 22:13     ` Mikael Djurfeldt
2006-04-15 23:26       ` Neil Jerram
2006-04-17  8:21         ` Mikael Djurfeldt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).