Gauche > Archives > 2024/09/19

2024/07/07 09:56:29 UTCzaxx
#
Great. Just yesterday, after I already posted the question here, I found Makiki! :) I quickly reviewed it and I like it! The only downside for me is that it doesn't have any HTML templates mechanism. It would be really nice if it had that feature, so that HTML responses don't always have to be constructed "manually" using the text.html-lite library, for example. By the way, is there a way to make it so that functions from text.html-lite don't have to be called with the html: prefix? It's very verbose if I always have to write html:table, html:a, html:div instead of table, a, div.
2024/07/07 13:00:34 UTCshiro
#
These days I tend to use SXML to construct HTML response. Check out examples/post.scm in Makiki, for example. SXML is just a S-expression so you can easily construct programatically.
2024/07/07 15:32:29 UTCzaxx
#
Mr. Shiro, as an experienced Scheme developer, can you share your workflow with us? Do you use Emacs? If so, do you use any additional tools or plugins that make scheme programming easier for you (like Geiser or something else)? I'm really interested in how to achieve the optimal programming experience, working in Gauche.
2024/07/07 20:09:59 UTCshiro
#
I just use Emacs + Quack. Old school. I should learn newer ways (and adapt Gauche to work with them smoothly). I'd rather ask what new geenration developers are using.
2024/07/25 11:12:38 UTCleah2
#
What is the fastest way to exit from a lexical scope (i.e. break from a loop)? In my benchmark it's call/cc, but shouldn't partcont be faster?
2024/07/25 13:04:50 UTCshiro
#
Right now, capturing partial continuation requires all activation frames in the VM stack area to heap, and that cost is not smaller than full continuations. I have some ideas bouncing around to optmize it.
2024/07/28 09:22:22 UTCkaki
#
http-getすると "ERROR: Can't load certificates from system certificate store" と言われるのですが、どうすればいいですか?macOSで (tls-ca-bundle-path) の値は system 、opensslはbrewしてあります。
2024/07/29 07:58:07 UTCkaki
#
Gaucheは0.9.14です。
2024/08/04 07:49:39 UTChamayama
#
ext/tls/gauche-tls.h の SYSTEM_CA_CERT_PATHS に cacert を探すパスが書いてありますが、
そこに見つからないということのようです。
(tls-ca-bundle-path "/etc/ssl/cert.pem")
を指定すると、一応 macOS で動作するようでした。(GitHub Actions で確認)
2024/08/04 14:33:43 UTCkaki
#
ありがとうございます。(tls-ca-bundle-path "/etc/ssl/cert.pem") で動作しました。
#
SYSTEM_CA_CERT_PATHSに書かれている /usr/local/etc/openssl/cert.pem にもファイルはあるのですが、そちらを指定すると以下のような別のエラーになりました。
#
*** ERROR: mbedtls_x509_crt_parse_file() failed on "/usr/local/etc/openssl/cert.pem": HMAC_DRBG - Too many random requested in single call (3)
Stack Trace:
_______________________________________
  0  (report-error e)
  1  (%tls-connect tls host p proto)
  2  (connect-socket)
        at "/usr/local/share/gauche-0.98/0.9.14/lib/rfc/http.scm":754
  3  (start-connection conn)
        at "/usr/local/share/gauche-0.98/0.9.14/lib/rfc/http.scm":759
  4  thunk
  5  (with-connection conn (^ (i o) (request-response i o method u ...
        at "/usr/local/share/gauche-0.98/0.9.14/lib/rfc/http.scm":303
2024/08/04 15:33:36 UTCshiro
#
ふーむ、証明書の数が多すぎるっぽい? mbedtlsはbrewで入れたやつですか?
2024/08/04 15:41:40 UTCkaki
#
そのようです>mbedtls
2024/08/04 15:42:07 UTCshiro
#
こっちでも試してみます。
2024/08/08 03:51:12 UTCnobsun
#
Gauche で、任意個の引数を取れる手続から、アリティを固定数に制限した手続を作るには、どうすればよいでしょう?(ブランクがありすぎて全然鼻が効かない状態です)
2024/08/08 04:01:51 UTCnobsun
#
MIT-Scheme で
(define (restrict-arity proc nargs)
    (hash-table-set! arity-table proc nargs)
    proc)
と定義されている、restrict-arity を Gauche で定義することを考えています。
2024/08/08 04:28:47 UTCとおる。
#
Software Design for Flexibility にそんな例がありましたねー。
2024/08/09 00:52:02 UTCnobsun
#
ああ。まさにそれです。
2024/08/09 04:57:06 UTCg000001
#
listから引数を3つに制限したlist3を作るようなことってあまりlisp的にやらない気がする(メリットがなさそう)のですが、どういう場所で活躍するのでしょう?(コンパイル時のチェックを期待など?)。 引数の個数チェックということだと、((lambda (a b c) (list a b c)))と書けばよさそうですが……
2024/08/09 05:21:53 UTCg000001
#
などと思いましたが、Software Design for Flexibilityにある例なのですね。用途が思考実験ということならmit schemeのコードはポータブルに見えます。
#
アリティをポータブルにプログラム内で取得するのが肝ということだと、srfiに何度か提案されていますが、没になってるみたいです。 https://srfi.schemers.org/srfi-191/srfi-191.html
2024/08/09 06:42:37 UTCshiro
#
アリティをnargsで与えたいなら、マクロにするか、一旦可変長で受け取ってランタイムに引数の数をチェックするかですかねえ。
#
マクロ展開時にnargsがわかるならマクロが実用的には良いと思うんですが。
2024/08/09 07:18:40 UTCとおる。
#
https://practical-scheme.net/wiliki/wiliki.cgi?Scheme%3A%E6%89%8B%E7%B6%9A%E3%81%8D%E3%81%AEcurry%E5%8C%96 むかしの WiLiKi を検索したらこんな項目がありました。
2024/08/09 14:36:53 UTCnobsun
#
実装より先に考えることいろいろありそう。そちらをもうすこし整理してみようと思います。
2024/08/10 10:12:35 UTChamayama
#
Gauche Scheme 800 Star おめでとうございます。(変動はあるでしょうが…)
2024/08/10 17:48:38 UTCshiro
#
ありがたや。目指せ1000 (いつになるやら)
2024/09/05 02:42:00 UTC齊藤
#
(use gauche.generator)

(define (restrict-arity proc n)
  (let ((argument-list (generator->list gensym n)))
    ((eval
      `(lambda (p)
         (lambda ,argument-list
           (p ,@argument-list)))
      (find-module 'gauche))
   proc)))

(define (foo . p) "foo") ; 可変長の手続き
(define bar (restrict-arity foo 3)) ; アリティを制限
(bar 1 2 3) ; これは OK
(bar 1 2 3 4) ; これは NG
#
こんな感じかな?
2024/09/05 03:46:11 UTCshiro
#
ああ、確かにそのevalの使い方は安全ではありますね。でもevalかあ…