[Top][All Lists]

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

#:export should not 'hide' imported functionality

From: David Pirotte
Subject: #:export should not 'hide' imported functionality
Date: Wed, 24 Dec 2014 16:01:46 -0200


         [ writing a 'pure' guile/goops code, not using guile-gnome
         [ guile-clutter is left as an exercise :)

In the attached code [image.scm], uncommenting line 43 [commenting
line 49] would raise the following bug (1).

Imo, it should not: the module system, #:export, should be goops
'aware' and not 'hide', as a side effect, imported generic functions
and methods.  Because #:export calls module-ensure-local-variable!,
before anything else, a new get-with var is created, first unbound,
later turned into a generic function with 1 applicable [locally defined]
method only, hiding imported functionality the module relies on.

Note that the initialize method redefinition is not even (re)exported,
so we are talking about guile breaking the code it runs within the 
module 'space' itself, which is not acceptable. Even though, as some
guile maintainers think it should [i don't, but that's another subject],
using #:export should indeed create a new generic function with the
locally defined applicable method only, it should do so for export purposes,
only, for modules that will use 'this one': it should not break upon executing
(get-with pixbuf), since (gnome gw gdk), imported, provides the functionality
it needs.

If anyone is interested, see g-export [goops export] code  [attached] I wrote
to circumvent this problem.

Happy hacking,

;; --

(1) the bug report

;;; compiling ./clus/image.scm
;;; compiled 
In ice-9/boot-9.scm:
 157: 10 [catch #t #<catch-closure 152e9e0> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure 152e9e0>]
In ice-9/boot-9.scm:
  63: 8 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 7 [eval # #]
In clutter/1.12/toolbar:
  81: 6 [main ("./toolbar" "-d")]
In oop/goops.scm:
1553: 5 [#<procedure 19879c0 at oop/goops.scm:1551:0 (class . initargs)> # # 
In clutter/1.12/clus/toolbar.scm:
 141: 4 [#<procedure 1e6a1c0 at clutter/1.12/clus/toolbar.scm:139:0 (self 
initargs)> # ...]
In oop/goops.scm:
1553: 3 [#<procedure 19879c0 at oop/goops.scm:1551:0 (class . initargs)> # # 
In clutter/1.12/clus/image.scm:
  82: 2 [#<procedure 1e6fc80 at clutter/1.12/clus/image.scm:75:0 (self 
initargs)> # ...]
In oop/goops/dispatch.scm:
 239: 1 [cache-miss #<<generic> get-width (1)> (#<<gdk-pixbuf> 1e6fa00>)]
In unknown file:
   ?: 0 [scm-error goops-error #f ...]

ERROR: In procedure scm-error:
ERROR: No applicable method for #<<generic> get-width (1)> in call (get-width 
#<<gdk-pixbuf> 1e6fa00>)
address@hidden:~/alto/projects/clutter/1.12 174 $ 

Attachment: image.scm
Description: Text Data

Attachment: g-export.scm
Description: Text Data

Attachment: pgphXrGSPfLqw.pgp
Description: OpenPGP digital signature

reply via email to

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