unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#24955: defining a record type does not also define a GOOPS class in Guile 2.1
@ 2016-11-16 15:26 Thompson, David
  2017-01-09 21:43 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Thompson, David @ 2016-11-16 15:26 UTC (permalink / raw)
  To: 24955

Hello,

It used to be, in Guile 2.0, that defining a record type <foo> would
also, in an unhygienic manner,  define the GOOPS class <<foo>> for use
with generic methods.  However, in Guile 2.1, this does not happen.
Example:

    (use-modules (srfi srfi-9)
                 (oop goops))

    (define-record-type <foo>
      (make-foo bar)
      foo?
      (bar foo-bar))

    <<foo>> ;; Unbound variable: <<foo>>

Was this an intentional breaking change? I do find it weird that a
variable binding is magically defined, but I still would like some way
to access the class wrapper for a record type without doing something
hacky like:

    (define <<foo>> (class-of (make-foo 'bar)))

Thanks,

- Dave





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

* bug#24955: defining a record type does not also define a GOOPS class in Guile 2.1
  2016-11-16 15:26 bug#24955: defining a record type does not also define a GOOPS class in Guile 2.1 Thompson, David
@ 2017-01-09 21:43 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2017-01-09 21:43 UTC (permalink / raw)
  To: Thompson, David; +Cc: 24955-done

On Wed 16 Nov 2016 16:26, "Thompson, David" <dthompson2@worcester.edu> writes:

> Hello,
>
> It used to be, in Guile 2.0, that defining a record type <foo> would
> also, in an unhygienic manner,  define the GOOPS class <<foo>> for use
> with generic methods.  However, in Guile 2.1, this does not happen.
> Example:
>
>     (use-modules (srfi srfi-9)
>                  (oop goops))
>
>     (define-record-type <foo>
>       (make-foo bar)
>       foo?
>       (bar foo-bar))
>
>     <<foo>> ;; Unbound variable: <<foo>>
>
> Was this an intentional breaking change? I do find it weird that a
> variable binding is magically defined, but I still would like some way
> to access the class wrapper for a record type without doing something
> hacky like:
>
>     (define <<foo>> (class-of (make-foo 'bar)))

See NEWS:

  ** Defining a SMOB or port type no longer mucks exports of `(oop goops)'

  It used to be that defining a SMOB or port type added an export to
  GOOPS, for the wrapper class of the smob type.  This violated
  modularity, though, so we have removed this behavior.

I think in the future <foo> should be classy already as a kind of
primitive class -- (class-of (make-foo ...)) should eq? <foo>.  That
doesn't happen now yet though.  Closing as not a bug unless you have
really strong opinions here.

A





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

end of thread, other threads:[~2017-01-09 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 15:26 bug#24955: defining a record type does not also define a GOOPS class in Guile 2.1 Thompson, David
2017-01-09 21:43 ` Andy Wingo

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).