bug#26616: close

2017-04-22 Thread Linas Vepstas
Per last message, close.


bug#26616: close

2017-04-22 Thread Linas Vepstas
I just retested with a pull from today's git and the problem does NOT
reproduce.

Attempting to close this bug.

tested with

$ guile --version
guile (GNU Guile) 2.2.2.1-886ac


bug#26616: guile-2.2 par-for-each hangs for large lists

2017-04-22 Thread Linas Vepstas
The following spins, burning about 250% cpu time, for large lists; it works
fine for smaller lists.   This is for a recent version of guile from git:

guile -v
guile (GNU Guile) 2.1.5.19-7e9395

will retry with newer guile shortly.

On fresh guile:

(use-modules (srfi srfi-1))
(define al (list-tabulate 10 values))
(define foo 0)
(par-for-each (lambda (x) (set! foo (+ x foo))) al)

^CERROR: In procedure scm-error:
ERROR: User interrupt

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
In ice-9/threads.scm:
   289:22  5 (loop _)
In ice-9/futures.scm:
   265:11  4 (touch #)
   243:14  3 (work)
In unknown file:
   2 (wait-condition-variable #t)
While executing meta-command:
ERROR: In procedure cdr: Wrong type argument in position 1 (expecting
pair): ()
scheme@(guile-user) [1]>

The above is after interrupting after an hour or so of accumulated CPU
time.

Again, shorter lists (e.g. 10K long) work fine. My production lists are
about 400K to 2M in size.

--linas


bug#26026: closed (Re: bug#26026: Defining a method named zero? breaks primitive zero?)

2017-04-22 Thread Alejandro Sanchez
This does not work. If I remove the export of ‘zero?’ I get another error:

scheme@(guile-user)>  (zero? (make ))
:3:1: :3:1: In procedure =: Wrong type: 
#< 106606e20>

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
In current input:
  3:1  0 (_)
scheme@(guile-user) [1]>

That is why I was exporting ‘zero?’ to begin with. I do not have to export ‘+’ 
or ‘-‘ for example.

> On 19 Apr 2017, at 17:13, GNU bug Tracking System  
> wrote:
> 
> Your bug report
> 
> #26026: Defining a method named zero? breaks primitive zero?
> 
> which was filed against the guile package, has been closed.
> 
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 26...@debbugs.gnu.org.
> 
> -- 
> 26026: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26026
> GNU Bug Tracking System
> Contact help-debb...@gnu.org with problems
> 
> From: Andy Wingo 
> Subject: Re: bug#26026: Defining a method named zero? breaks primitive zero?
> Date: 19 April 2017 at 17:12:12 GMT+2
> To: Alejandro Sanchez 
> Cc: 26026-d...@debbugs.gnu.org
> 
> 
> On Wed 08 Mar 2017 12:07, Alejandro Sanchez  writes:
> 
>> If I define a ‘zero?’ predicate method for a custom class the primitive 
>> ‘zero?’ is lost. Here is a simple vector module:
>> 
>>  ;;; File vector2.scm
>>  (define-module (vector2)
>>#:use-module (oop goops)
>>#:export ( get-x get-y zero?))
>>  
>>  (define-class  ()
>>(x #:init-value 0 #:getter get-x #:init-keyword #:x)
>>(y #:init-value 0 #:getter get-y #:init-keyword #:y) )
>> 
>>  (define-generic zero?)
>>  (define-method (zero? (v ))
>>(and (zero? (get-x v))
>> (zero? (get-y v
>> 
>> In the Guile REPL try executing the following code:
>> 
>>  scheme@(guile-user)> (use-modules (oop goops) (vector2))
>>  scheme@(guile-user)> (zero? (make ))
>> 
>> This will display 
>> 
>>  WARNING: (guile-user): `zero?' imported from both (ice-9 r5rs) and 
>> (vector2)
>>  ERROR: In procedure scm-error:
>>  ERROR: No applicable method for #< zero? (1)> in call (zero? 0)
>>  
>>  Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
>>  scheme@(guile-user) [1]> ,bt
>>  In vector2.scm:
>>   11:7  2 (_ #< 105e87e00>)
>>  In oop/goops.scm:
>> 1438:4  1 (cache-miss 0)
>>  In unknown file:
>> 0 (scm-error goops-error #f "No applicable method for ~S in 
>> call ~S" (#< …) …)
>> 
>> Apparently the problem is that ‘zero?’ is defined in two modules and
>> the vector2 definition overrides it. This isn’t the case with other
>> primitives like ‘+’ or ‘*’, so this seems like a bug? I had built
>> Guile from HEAD a few days ago, my package manager shows 6fff84d as
>> the version number, so I guess that must be the hash of the commit
>> HEAD was pointing to at that time.
> 
> Actually the (vector2) module makes a fresh definition for zero?.  You
> can tell because zero? is in its export list.  So instead of extending
> the primitive-generic that is zero?, you are making a new definition.
> See:
> 
>  scheme@(guile-user)> (define-module (foo) #:export (zero?))
>  $1 = #
>  scheme@(foo)> (zero? 0)
>  :4:0: :4:0: Unbound variable: zero?
> 
>  Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> 
> If you want to extend a primitive-generic, then do that by not exporting
> zero?.  In a way it's like mutating the primitive in place, giving it
> additional powers.
> 
> Andy
> 
> 
> 
> 
> From: Alejandro Sanchez 
> Subject: Defining a method named zero? breaks primitive zero?
> Date: 8 March 2017 at 12:07:56 GMT+1
> To: bug-guile@gnu.org
> 
> 
> If I define a ‘zero?’ predicate method for a custom class the primitive 
> ‘zero?’ is lost. Here is a simple vector module:
> 
>   ;;; File vector2.scm
>   (define-module (vector2)
> #:use-module (oop goops)
> #:export ( get-x get-y zero?))
>   
>   (define-class  ()
> (x #:init-value 0 #:getter get-x #:init-keyword #:x)
> (y #:init-value 0 #:getter get-y #:init-keyword #:y) )
> 
>   (define-generic zero?)
>   (define-method (zero? (v ))
> (and (zero? (get-x v))
>  (zero? (get-y v
> 
> In the Guile REPL try executing the following code:
> 
>   scheme@(guile-user)> (use-modules (oop goops) (vector2))
>   scheme@(guile-user)> (zero? (make ))
> 
> This will display 
> 
>   WARNING: (guile-user): `zero?' imported from both (ice-9 r5rs) and 
> (vector2)
>   ERROR: In procedure scm-error:
>   ERROR: No applicable method for #< zero? (1)> in call (zero? 0)
>   
>   Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
>   scheme@(guile-user) [1]> ,bt
>   In vector2.scm:
>11:7  2 (_ #< 105e87e00>)
>   In oop/goops.scm:
>  1