Arc Forumnew | comments | leaders | submitlogin
Bug in scar function in official arc 3.2 implementation
4 points by tubsy 762 days ago | 2 comments
I just installed the latest Racket 8.7 and ran the latest official version of arc (http://www.arclanguage.org/arc3.2.tar).

While playing with it, I encountered the following bug in scar function:

  arc> (= x '(1 2 3))
  (1 2 3)
  arc> x
  (1 2 3)
  arc> (scar x 'a)
  a
  arc> x
  (344739504129 . 10059776)
In Anarki, this bug seems to be fixed, but I don't want to use anarki because it boots very slowly. Does anyone know how to fix this bug in the official version?


2 points by akkartik 751 days ago | link

Interesting. I haven't heard this one before.

The stable branch has this bug as well.

I'd compare how x-set-car! is implemented in the two versions. Current HEAD: https://github.com/arclanguage/anarki/blob/6f3fecdaa46e25b34...

stable: https://github.com/arclanguage/anarki/blob/stable/ac.scm#L12...

I suspect Racket's changed something in unsafe-set-mcar! during the move to Chez Scheme.

(Sorry I just saw this.)

-----

2 points by rocketnia 708 days ago | link

There was a pull request by samth that fixed this on the main branch, though I guess no one's ever ported it to the stable branch: https://github.com/arclanguage/anarki/pull/183

Just after that, Racket introduced an easier way to fix this, `unsafe-set-immutable-car!`, specifically as a stable way to mutate the so-called immutable cons cells going forward. :) We should probably move to that.

I've opened an issue for it: https://github.com/arclanguage/anarki/issues/218

-----