On Fri, Mar 27, 2009 at 1:37 PM, Michele Simionato < [email protected]> wrote:
> > On Mar 26, 11:55 pm, Abdulaziz Ghuloum <[email protected]> wrote: > > What forces us is the desire to be able to fully expand > > and compile each library without having to also evaluate it. > > There is another point I forgot to mention. The fact that libraries > are compiled without being evaluated is not without disadvantages. > Consider for instance this example: > > $ more test.sls > (library (test) > (export x) > (import (rnrs)) > (define x (/ 1 0))) > > The test library here is buggy, because of a division-by-zero error. > However > compiling it will not reveal any error :-( > > $ ikarus --compile-dependencies x.ss > Serializing "./test.sls.ikarus-fasl" ... > > The error will be visibile only when the library is used (too late!) > > $ more x.ss > (import (rnrs) (test)) > (display x) > > $ ikarus x.ss > Unhandled exception: > Condition components: > 1. &assertion > 2. &who: / > 3. &message: "division by 0" > 4. &irritants: () > > So there is a class of errors that could > be recognized at compile time if the definitions > were evaluated by the compiler. I see pros and > contras (the contras are possible confusions > between runtime/compile time for definitions > depending on the time) but not an obvious argument why > not evaluating definitions at compile time is certainly > better. I dont think the specification allows to raise a compile error for 'invalid parameters' even if it can determine to be incorrect. This is the same as calling: (fx+ 1) or (fx+ 'a 'a) Either case MUST compile, and MUST raise an exception at runtime. In IronScheme, if I can detect there is an issue at compile time, I simply defer the computation to the runtime, or could even just convert it into a closure that will return an error. This is only of the things that make Scheme quite hard to implement on a statically typed runtime such as the CLR, as it forces me to box values at method boundries and plenty type checking at runtime. Further research & development in IronScheme, will alow me to safely determine whether a variable/parameter can have only 1 type. Cheers leppie -- http://codeplex.com/IronScheme http://xacc.wordpress.com
