Hi Andy, Thanks for the explanations.
On mar., 30 avril 2024 at 16:43, Andy Wingo <wi...@igalia.com> wrote: >> The first question is: is it still correct? Because this module had >> been implemented before many Guile compiler improvements. > > No, the comment is incorrect. The type check on whatever accessor is > called first (unspecified in scheme; probably we should just bite the > bullet and do predictable left-to-right semantics, as racket does) will > dominate the rest and eliminate those checks. The assert-type is > unnecessary. Good to know. > To see this, do ,optimize-cps at the repl, and count the number of > e.g. struct? checks with and without the assert-vlist. There is only > one, either way. Hum, I am not sure to understand how to use ,optimize-cps at the repl. Naively, I get: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(ice-9 vlist) scheme@(guile-user)> ,optimize-cps (vlist-cons 'foo vlist-null) L0: ; at <unknown>:102:14 v0 := self L1(...) L1: receive() v1 := current-module() ; mod While executing meta-command: In procedure +: Wrong type argument in position 1: #f --8<---------------cut here---------------end--------------->8--- Since ’,help compile’ reads, ,optimize-cps EXP [,optx] - Run the CPS optimizer on a piece of code and print the result. I assume that I do not feed with the correct expression EXP. What would be the invocation? > (A type check is a heap-object? check, then struct?, > then get the vtable, then check against the global variable <vlist>. > All of these duplicates get eliminated.) Ah yeah, it makes sense. :-) Cheers, simon