[Top][All Lists]

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

Re: strange mkstemp! behavior

From: rm
Subject: Re: strange mkstemp! behavior
Date: Mon, 13 Sep 2004 10:51:18 +0200
User-agent: Mutt/1.5.3i

On Mon, Sep 13, 2004 at 10:24:27AM +0200, Maarten Grachten wrote:
> Hi guile people,
> in 1.6.4, but also in 1.7.1 (didn't try others)  there seems to be
> something wrong when using mkstemp! several times after another like this:
> (define (look-at-this x)
>       (let ((name "/tmp/XXXXXX"))
>               (write-line name)
>               (mkstemp! name)))

I'm not a schemer, but doesn't the above code violate the specs?
'(let ((name "/tmp/XXXXXX"))' binds 'name' to an inmutable string
(string constants are inmutable).

How about:
 (define (look-at-this x)
    (let ((name (string-copy "/tmp/XXXXXX")))
      (write-line name)
      (mkstemp! name)))

On my system this produces:

 guile> (version )
 guile> (map look-at-this '(1 2 3))
 (#<input-output: /tmp/YoV3f2 3> #<input-output: /tmp/g5Etjk 4> #<input-output: 
/tmp/uX15kC 5>)
HTH Ralf Mattes 

reply via email to

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