Gauche > Archives > 2017/11/16

2017/11/16 09:14:22 UTCshiro
#
しばらくtwitterブリッジが止まっててこっちに気づいてませんでした。これから返事します。
2017/11/16 09:20:27 UTCshiro
#
james: I reckon you want to replace the default exception handler, correct? (You can't "capture all exceptions" by replacing the global exception handler, for it would be dynamically shadowed anytime by with-exception-handler.)
2017/11/16 09:25:00 UTCshiro
#
We don't have a directly way to replace the default exception handler, for the outermost handler needs to do some under-the-hood tricks to make the system state sane. However, if what you want to do is to add hook to the default exception handler, there's an internal API.
#
(with-module gauche.internal %vm-custom-error-reporter-set!) takes a vm instance (= the thread object) and a procedure that accepts one argument, the thrown condition. It is called when the default exception handler reports the thrown condition. Its default procedure is report-error.
#
gosh> (report-error (make <error> :message "Huh?"))
*** ERROR: Huh?
Stack Trace:
_______________________________________
  0  (eval expr env)
        at "/usr/share/gauche-0.9/0.9.6_pre4/lib/gauche/interactive.scm":267
#
You can set a custom error reporter instead and write out to the logfile, for example.
#
kaki: r7rs"スクリプト"のloadは普段使ってないのであんまりちゃんと考えて無かった…
#
んー、どこでモジュール切り替えてるかさえすっかり忘れてるな…
#
ああそうか、user#importがr7rs importwo
#
検出した時点でr7rs.userに切り替えるのか。これはたぶん、r7rsコードは必ずdefine-libraryに囲まれているという前提で考えてて、スクリプトは直に実行することしか考えてなかったんだと思います。
#
確かにこれは落とし穴だな…user#import内で呼ばれたコンテキストを判断して切り替えるか?
2017/11/16 19:19:34 UTC齊藤
#
array-for-each-index の出してくるインデックスの順序って保証されてると考えていいですか? Reader Syntax の項目で「row-majorの順で」と書かれているので、常識的に考えるとインデックスもこれに対応する順番だとは思うのですが明記されてはいないようなので……
2017/11/16 21:06:26 UTCshiro
#
確かに、例示はされてますが明示されてないですね。足しときます。
2017/11/16 23:06:33 UTCshiro
#
久々にchatonのコードいじってたらなんかschrödinbugっぽいの見つけた。なんでこれ動いてるんだ?