Syntax highlighter

2011-09-07

Fatal bug

I have checked the traffic of this blog, like from which country or which searching words. Somehow I got some traffic from Hungary or Ukraine. (I guess form the US are not non-Japanese speaker...)
So I believe it's good to write in English, very sometimes, even once in a blue moon. Sorry, I'm so lazy.
(If somebody eagerly requests me to write in English, I might do it.)

I've just found a fatal bug on my Sagittarius Scheme. How fatal? I need to say VERY!
Here you can see how serious it is.
(define (map) #f)
(display 'buzz) ;; -> COMPILE ERROR!
This is because I was too lazy to implement library system properly. In current implementation, each library has a hash table to store its variables or macros. The problem was it shares global location object by identifier name.
What does it mean?
It's really simple, even though it looks it has library system, it shares all variable in global. That's why the above problem was occurred.

The bug was actually found because I was trying to run Gambit's benchmarks. On its benchmarks, there is a function named "reduce". This is the same name as SRFI-1 has and the compiler is using it.
I am re-implementing the library system with hierarchy of libraries so that Sagittarius can separate global location object by library. It's almost done, I just need to re-write compiler a little bit and support rename or prefix stuff.

The most surprising thing was I even didn't notice this bug even though I was using it whole time. (Of course I don't re-implement those basic function for studying. I guess that's why.)

No comments:

Post a Comment