yhara / biwascheme

yhara's private clone of BiwaScheme. The official one is:
https://github.com/biwascheme/biwascheme
MIT License
88 stars 3 forks source link

Strings should not be primitive values #24

Open erjiang opened 13 years ago

erjiang commented 13 years ago

In BiwaScheme, (eq? "hi" "hi") => #t

but should be #f, since strings should be heap-allocated objects in usual Schemes. This can be solved by making a BiwaScheme String object to take advantage of native JS ==. Additionally, this allows for mutable strings because the String object's wrapped value can simply be replaced.

yhara commented 13 years ago

Yes, they should be mutable. But do you really need it? string-set! implemented with immutable JavaScript strings may not be so fast.

erjiang commented 13 years ago

I opened this issue merely because I was concerned for the semantics of strings and also for convenience for the user who might want to use string-set!. Speed obviously won't be good, but that could be an implementation note. It's halfway done in https://github.com/erjiang/biwascheme/tree/string-obj if you're interested.