Joo ChurlSoo | 6 Jan 12:28 2011
Picon

parameterize

The followind parameterize behavior seems to be wrong.

gosh> (use gauche.parameter)
#<undef>
gosh> 
(define a (make-parameter 1))
(define b (make-parameter 2 number->string))

a
gosh> b
gosh> (list (a) (b))
(1 "2")
gosh> (parameterize ((a 10) (b 20)) (list (a) (b)))
*** ERROR: number required: "2"
Stack Trace:
_______________________________________
  0  after

gosh> (list (a) (b))
(1 "20")
gosh> 
(define a (make-parameter 1))
(define b (make-parameter 2 number->string))

a
gosh> b
gosh> (list (a) (b))
(1 "2")
gosh> (parameterize ((a 10) (a 20)) (list (a) (b)))
(20 "2")
(Continue reading)

Shiro Kawai | 6 Jan 13:33 2011
Picon

Re: parameterize

You're correct.  It is indeed a bug.
When restoring the old value, the converter shouldn't be called.

--shiro

From: Joo ChurlSoo <initerm <at> gmail.com>
Subject: [Gauche-devel] parameterize
Date: Thu, 06 Jan 2011 20:28:52 +0900

> The followind parameterize behavior seems to be wrong.
> 
> gosh> (use gauche.parameter)
> #<undef>
> gosh> 
> (define a (make-parameter 1))
> (define b (make-parameter 2 number->string))
> 
> a
> gosh> b
> gosh> (list (a) (b))
> (1 "2")
> gosh> (parameterize ((a 10) (b 20)) (list (a) (b)))
> *** ERROR: number required: "2"
> Stack Trace:
> _______________________________________
>   0  after
> 
> gosh> (list (a) (b))
> (1 "20")
> gosh> 
(Continue reading)

Shiro Kawai | 6 Jan 14:54 2011
Picon

Re: parameterize

Fixed in rev7341.

--shiro

From: Shiro Kawai <shiro <at> lava.net>
Subject: Re: [Gauche-devel] parameterize
Date: Thu, 06 Jan 2011 02:33:27 -1000 (HST)

> You're correct.  It is indeed a bug.
> When restoring the old value, the converter shouldn't be called.
> 
> --shiro
> 
> 
> From: Joo ChurlSoo <initerm <at> gmail.com>
> Subject: [Gauche-devel] parameterize
> Date: Thu, 06 Jan 2011 20:28:52 +0900
> 
>> The followind parameterize behavior seems to be wrong.
>> 
>> gosh> (use gauche.parameter)
>> #<undef>
>> gosh> 
>> (define a (make-parameter 1))
>> (define b (make-parameter 2 number->string))
>> 
>> a
>> gosh> b
>> gosh> (list (a) (b))
>> (1 "2")
(Continue reading)

Shiro Kawai | 7 Jan 09:04 2011
Picon

control.thread-pool add-job! with timeout

This is a polling question.  Is there an objection if
I change the behavior of add-job! in control.thread-pool?

A thread pool implementation control.thread-pool is a new
feature in 0.9.1.  With it, you can specify the maximum backlog
size of input job queue (default is unlimited).  It is sometimes
handy to have limited backlog to regulate speeds among different
components.

The API to enter a new job to a pool is add-job!.  Somehow I
designed it in a way that it returns immediately when the
pool's input queue is full, returning #f indicating so.

Now I think it should block until there's a room in the
input queue by default, and take an optional timeout argument.
It will be consistent with various other thread APIs such as
thread-join!, mutex-lock!, and enqueue/wait!.  

The change will break the code that expects add-job! to
return upon full backlog situation, but I feel it's better
to have the consistency, and it is less painful to change
it now than later.  

The change won't affect the code that uses a thread pool
without backlog limit; in which case add-job! always
returns immediately, putting a new job into the queue.

A similar discussion may be applicable to wait-all; there's
not way to specify timeout now.  Current check-interval
argument is less important than timeout, so I'd like to
(Continue reading)

gauchedev | 9 Jan 18:25 2011

Windows Interactive Mode

I noticed that running "gosh -i" on Windows was not loading .gaucherc from
my home directory.

I tracked the problem down to the file
gauche-0.9/0.9.1/lib/gauche/interactive.scm, which uses "~" in the
pathname for .gaucherc

It seems that sys-normalize-pathname does not expand ~ on Windows.  I'm
not sure if that's a bug.

In any case, I was able to work around the problem by changing my
interactive.scm from

(let ((dotfile (sys-normalize-pathname "~/.gaucherc" :expand #t)))
  (when (sys-access dotfile F_OK)
    (load dotfile :environment (find-module 'user))))

to:

(let ((dotfile (sys-normalize-pathname (string-append (sys-getenv "HOME")
"/.gaucherc") :expand #t)))
            (when (sys-access dotfile F_OK)
                  (load dotfile :environment (find-module 'user))))

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
(Continue reading)

Shiro Kawai | 10 Jan 01:08 2011
Picon

Re: Windows Interactive Mode

Thanks for reporting.  It appears an overlooked bug.
I checked in a fix to make "~" expansion work on Windows.

--shiro

From: gauchedev <at> jlarocco.com
Subject: [Gauche-devel] Windows Interactive Mode
Date: Sun, 9 Jan 2011 09:25:43 -0800

> I noticed that running "gosh -i" on Windows was not loading .gaucherc from
> my home directory.
> 
> I tracked the problem down to the file
> gauche-0.9/0.9.1/lib/gauche/interactive.scm, which uses "~" in the
> pathname for .gaucherc
> 
> It seems that sys-normalize-pathname does not expand ~ on Windows.  I'm
> not sure if that's a bug.
> 
> In any case, I was able to work around the problem by changing my
> interactive.scm from
> 
> (let ((dotfile (sys-normalize-pathname "~/.gaucherc" :expand #t)))
>   (when (sys-access dotfile F_OK)
>     (load dotfile :environment (find-module 'user))))
> 
> to:
> 
> (let ((dotfile (sys-normalize-pathname (string-append (sys-getenv "HOME")
> "/.gaucherc") :expand #t)))
(Continue reading)

Joo ChurlSoo | 12 Jan 12:07 2011
Picon

parameterize

The following seems to be another bug.

gosh> (use gauche.parameter)
#<undef>
gosh> 
(let* ((init '())
       (add-init (lambda (x) (set! init (cons x init))))
       (a (make-parameter 1))
       (b (make-parameter 2)))
  (parameterize ((a 10) (b 20))
		(add-init (list (a) (b)))
		(set! b (make-parameter 200))
		(add-init (list (a) (b)))
		(a 1000) (b 2000)
		(add-init (list (a) (b))))
  (add-init (list (a) (b)))
  (reverse init))
((10 20) (10 200) (1000 2000) (1 2))	;((10 20) (10 200) (1000 2000) (1 2000))

--

-- 
Joo ChurlSoo

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
Shiro Kawai | 13 Jan 08:16 2011
Picon

Re: parameterize

Very good catch.

My initial reaction to your code was "what? you're not supposed to
alter the binding of the parameter object!  It's a special variable
of disguise after all.  This should be undefined behavior!"
Then I reread srfi-39, and read it again, and find that nothing 
should prevent the code from altering the binding.  And yes, your
interpretation is correct.  The original value should be restored
to the parameter object originally bound to b, but that becomes
inaccesible from other part of programs once the global binding of
b is clobberd.  The code after the parameterize sees a new parameter
object.

Fixed in rev7353.

--shiro

From: Joo ChurlSoo <initerm <at> gmail.com>
Subject: [Gauche-devel] parameterize
Date: Wed, 12 Jan 2011 20:07:16 +0900

> The following seems to be another bug.
> 
> gosh> (use gauche.parameter)
> #<undef>
> gosh> 
> (let* ((init '())
>        (add-init (lambda (x) (set! init (cons x init))))
>        (a (make-parameter 1))
>        (b (make-parameter 2)))
(Continue reading)


Gmane