[bug #20941] Modules interact badly with macros

2007-10-31 Thread Ludovic Courtès

Follow-up Comment #2, bug #20941 (project guile):

The thing is, for engineering reasons, there are procedures used by macros
that you may not want to export.  Or the macros you export may be using
procedures from other modules that you do not want to re-export.  Overall, you
don't want to pollute the user's name space.

Worse, if the module user uses a renamer or a selector (e.g., "#:select
(the-macro-that-i-want)"), the macros just won't work.

Symbols used by macros should be resolved in the macro definition context,
not in its usage context (see "Composable and Compilable Macros: You Want it
When?" by M. Flatt).

FWIW, I used a hack to make "macros that work" in SRFI-35.

___

Reply to this item at:

  

___
  Message posté via/par Savannah
  http://savannah.gnu.org/



___
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


[bug #21489] crash when incorrectly sorting methods

2007-10-31 Thread Marco Maggi

URL:
  

 Summary: crash when incorrectly sorting methods
 Project: Guile
Submitted by: marcomaggi
Submitted on: mercoledì 31/10/2007 alle 17:22
Category: None
Severity: 3 - Normal
  Item Group: None
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any

___

Details:

I know that the correct way to do it is:

  (sort-applicable-methods  
(compute-applicable-methods  arg ...) arg ...)

so the  following will "never" happen,  but nevertheless the
following segfaults Guile  1.8.3 on a i686-pc-linux-gnu with
GCC 4.1.2, CFLAGS="-O3 -g -march=i686 -mtune=i686".

;; hurtme.scm --

(define-module (one)
  #:use-module (oop goops)
  #:duplicates merge-generics)

(define saved-length length)
(define-generic length)
(define-method (length . args)
  (apply saved-length o))

(define-method (length (o ))
  (vector-length o))

(export length)

(define-module (hurt-me)
  #:use-module (oop goops)
  #:use-module (one)
  #:duplicates merge-generics)

(sort-applicable-methods length
  (generic-function-methods length) '(1 2 3))

;; end of file

The actual crashing code is in 'more_specificp()'.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212094784 (LWP 22856)]
scm_sys_method_more_specific_p (m1=0xb7bc3160, m2=0xb7bc3130,
targs=0xb7b3f3f0) at goops.c:1961
1961if (cs1 == SCM_CAR(l))
#0  scm_sys_method_more_specific_p (m1=0xb7bc3160, m2=0xb7bc3130,
targs=0xb7b3f3f0) at goops.c:1961
#1  0xb7e40876 in ceval (x=, env=0xb7b3ed18) at
eval.c:4560
#2  0xb7e462ad in call_closure_2 (proc=0xb7b3f390, arg1=0xb7bc3160,
arg2=0xb7bc3130) at eval.c:5347
#3  0xb7e80fb2 in scm_merge_list_step (seq=0xbf831c70, cmp=0xb7e46250
, less=0xb7b3f390, n=2) at sort.c:348
#4  0xb7e82610 in scm_sort_x (items=0x404, less=0xb7b3f390) at sort.c:384
#5  0xb7e826e7 in scm_sort (items=0xb7bea680, less=0xb7b3f390) at sort.c:411
#6  0xb7e41782 in ceval (x=0x404, env=0xb7b3f3c8) at eval.c:4349
#7  0xb7e4603a in scm_primitive_eval_x (exp=0xb7b3cf38) at eval.c:5910
#8  0xb7e5faef in scm_primitive_load (filename=0xb7ba4c20) at load.c:109
#9  0xb7e4169f in ceval (x=0x404, env=0xb7b90fe0) at eval.c:4223
#10 0xb7e2d56b in scm_start_stack (id=0xb7b9d440, exp=0xb7bfe2d8,
env=0xb7b90fe0) at debug.c:454
#11 0xb7e2dd55 in scm_m_start_stack (exp=,
env=0xb7b90fe0) at debug.c:470
#12 0xb7e43495 in scm_apply (proc=, arg1=0xb7bfe310,
args=) at eval.c:4930
#13 0xb7e401e2 in ceval (x=, env=0xb7b90fe0) at
eval.c:4050
#14 0xb7e45b9f in scm_call_0 (proc=0xb7b90fa8) at eval.c:4655
#15 0xb7e479bd in apply_thunk (thunk=0xb7b90fa8) at fluids.c:396
#16 0xb7e47b9e in scm_c_with_fluid (fluid=0x80620e0, value=0x4,
cproc=0xb7e479a0 , cdata=0xb7b90fa8)
at fluids.c:459
#17 0xb7e47bf5 in scm_with_fluid (fluid=0x80620e0, value=0x4,
thunk=0xb7b90fa8) at fluids.c:446
#18 0xb7e40876 in ceval (x=, env=0xb7b90f68) at
eval.c:4560
#19 0xb7e45b9f in scm_call_0 (proc=0xb7b90d70) at eval.c:4655
(gdb) 





___

Reply to this item at:

  

___
  Messaggio inviato con/da Savannah
  http://savannah.gnu.org/



___
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile