[Gauche-devel-jp] Re: freopen

アーカイブの一覧に戻る

Satoru Takabayashi sator****@namaz*****
2004年 1月 16日 (金) 17:18:10 JST


shiro****@lava*****:
 
> 現状では、
> 
>  (close-output-port (current-output-port))
>  (with-output-to-file "/dev/null"
>    (lambda () ...本体...))

おお、これでばっちり! と思ったら

  (define port (current-output-port))

  (with-output-to-file "/dev/null"
    (lambda ()
      (display "not displayed\n")
      (display "not displayed\n" (current-output-port))
      (display "displayed!!\n" port) ;; 表示されちゃう
      ))

のような状態が発生して焦りました。

具体的には

  (define-class <progress> ()
    (...
     (port  :init-value (current-output-port)
            :init-keyword :port)
     ...))

のような自作のモジュールを使ったときに起きたので、class定義
の中ではなく initialize の中で port をセットするようにして解
決しました。




Gauche-devel-jp メーリングリストの案内
アーカイブの一覧に戻る