unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass
Date: Fri, 30 Jan 2015 11:50:15 -0200	[thread overview]
Message-ID: <20150130115015.5c8e3192@capac> (raw)
In-Reply-To: <87zj94c5rv.fsf@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 4193 bytes --]

Andy,

> Are you certain?  What git revision are you using?  I don't think the
> test should "work" with the current stable-2.0 or master, or 1.8 for
> that matter.

>     $ /opt/guile-1.8/bin/guile
>     guile> (use-modules (oop goops))
>     guile> (define-class <a> ()
>     ...    (width #:accessor width #:init-keyword #:width #:init-value 0))
>     guile> (define-class <b> (<a>))
>     guile> (define b (make <b>))
>     guile> (width b)
>     0
>     guile> (set! (width b) 10)
>     guile> (width b)
>     10
>     guile> (define-method ((setter width) (self <b>) width) (next-method))
>     guile> (set! (width b) 10)
> 
>     Backtrace:
>     In current input:
>       10: 0* [setter:width #<<b> 7f795ed527e0> 10]
>        ?: 1  (let* ((next-method (goops:make-next-method self width)))
> (next-method))
> 
>     <unnamed port>: In expression (let* (#) (next-method)):
>     <unnamed port>: No next method when calling #<<generic> setter:width (2)>
>     with arguments (#<<b> 7f795ed527e0> 10)
>     ABORT: (goops-error)

When talking about goops, we should not refer to 1.8 (*), 1.6 or any guile version
for that matter, but to the clos language spec subset goops implements [appart from
the adaptation for it to be module protected, but that is not the point here].

This said and with that in mind, the implementation you say was in guile-1.8 and
that it appears you have reimplemented 'right now' breaks the specification and
afaiac makes goops totally unusable for any serious work: this is a catastrophy,
please reconsider!

	-] anything defined by a user using define-method _must_ pass thought the
	exact same computation machinery _and_ all become applicable methods;

	-] within the core of a define-method, one must always be able to call
	(next-method) [of course if the user do so inappropriately it raises an
	error, I'm not talking about that];

	-] they is no exception for setters, which are _just_ methods, with, in
	addition and as we know, a bit of 'magic' so that they can be used with set!
	
		-> otherwise, there would be 2 define-method semantics
		-> that can't be, and if it was the case the clos 'comity' would
		have defined another method for setters such as
		define-setter-method, and restrict that method from being able to
		call (call-next-method);

	-] within the core of methods, including the ones called with (next-method)
	calls to slot-ref slot-set! must _always_ call the instance(s) slot-ref-
	slot-set! as defined by the system [if none were provided], or the user's
	code they were provided [such as when #:allocation is #:virtual]

We should not need any really, but here is a description [no code, no need to at
this point] of a [still very simple] 'visual' example, so everyone can follow:

	let's define a gravity sensitive class <apple> and a !gravity setter, which
	sets the position of the instance on a scene and takes care of its layout
	[as in 'horizontal or 'vertical] depending on the gravity poles the instance
	respond to: at some point this setter method calls sot-set! to set the
	instance position slot value, such as 'north-west;

	then we define a <toolbar> class, which inherit from <apple>, with
	an item slot filled with <button> instances, each button having an optional 
	<tooltip> instance [a text, "My beautiful tooltip..."];

	each tooltip text must 'glue' to there button _and_ always be entirely on the
	scene [visible to the user, if the scene is itself visible of course, but
	that's not the question here]:

	-> that means there is extra work to be done on toolbar instances, but we
	want to run the <apple> !gravity setter code first

	(define-method ((setter !gravity) (self <clus-toolbar>) gravity)
	  (next-method)
	  (for-each (lambda (toolbar-item)
		      (ensure-tooltips-on-stage toolbar-item))
	    (!items self)))

Cheers,
David

(*) Besides, let me tell you that I never intensively used goops before guile-2, but
just played a little with it, precisely because I could not trust it, as I had my
heisen bugs using guile 1.6 because in these past times I could not even trust the
module system




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2015-01-30 13:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 19:46 goops - guile-clutter unexpected bug while using #:virtual slot allocation for a <clutter-actor> subclass David Pirotte
2014-12-19 23:42 ` Panicz Maciej Godek
2014-12-20  6:16   ` David Pirotte
2015-01-26 21:35 ` Andy Wingo
2015-01-27  1:00   ` David Pirotte
2015-01-27  8:29     ` Andy Wingo
2015-01-27 19:11       ` David Pirotte
2015-01-27 19:35         ` David Pirotte
2015-01-27 20:44         ` Andy Wingo
2015-01-28  3:05           ` David Pirotte
2015-01-28  3:36             ` David Pirotte
2015-01-28 12:57             ` Andy Wingo
2015-01-28 19:24               ` David Pirotte
2015-01-30 13:50           ` David Pirotte [this message]
2015-02-06 13:33             ` Andy Wingo
2015-02-06 17:09               ` David Pirotte
2015-02-06 17:49                 ` Andy Wingo
2015-02-07  0:06                   ` David Pirotte
2015-02-07 15:37                     ` Andy Wingo
2015-02-07 17:13                       ` David Pirotte
2015-02-07 16:08                     ` David Pirotte
2015-02-04 16:12           ` David Pirotte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150130115015.5c8e3192@capac \
    --to=david@altosw.be \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).