|
From: | Jörg F . Wittenberger |
Subject: | [Chicken-hackers] -block: a solution leading to more questions |
Date: | 11 Apr 2013 18:36:02 +0200 |
I found a way to convince chicken to compile with block optimization and still be able to call those procedures from eval. However, what's required - at least according to my current knowledge - is to have a "binding module", which initializes all bindings to some arbitrary value like #f and export another procedure to set it to the actual value plus an "implementation module", which updates the bindings. (I tried to use set! in the "implementation module" but that did not work out.) Now, given that the next thing I'd like to to would be to use (enforce-argument-types) atop for those bindings, which end up visible to the interpreter, I'm looking into an obvious option: I'd have to have a script, which would take a module's source as-is and create four modules out of it: 1. a "binding module" to be imported. * including With type declarations * all values bound to #f * -no-warnings to csc, since all initial bindings are "wrong" 2. a "init module", which imports (1) and exports a setter procedure. * type declarations (optional, but should) need to reflect the types from (1) as they should be 3. a toplevel file (possible not a module at all) * compiled with enforce-argument-types * importing (1) and having an equivalent procedure, which now checks it's arguments before it calls (2) via the binding in (1) 4. the "implementation module", which does the actual work. Hm. I already noticed that code compiled with (block) must not have procedures which ignore their arguments. (Seen with a 1-ary procedure so far.) Also it looks as if rest arguments can spell trouble. To sum up: I feel this would be a task to be performed inside the compiler and not by some precompile script. Feasible? Rational? How do you guys thing ot it. Find attached the modified code of yesterdays foobar example, which does work. (Including a Makefile ;-) Best /Jörg .....
foo.scm
Description: foo.scm
bar.scm
Description: bar.scm
foo.v.scm
Description: foo.v.scm
bar.v.scm
Description: bar.v.scm
foobar.scm
Description: foobar.scm
Makefile
Description: Makefile
[Prev in Thread] | Current Thread | [Next in Thread] |