racket / r6rs

Other
6 stars 9 forks source link

fix symbol->string to return immutable strings (R6RS §5.10) #6

Open LiberalArtist opened 2 years ago

LiberalArtist commented 2 years ago

The report says that:

the strings returned by symbol->string … are immutable objects … An attempt to store a new value into a location referred to by an immutable object should raise an exception with condition type &assertion.

LiberalArtist commented 2 years ago

I would have added a test, but I was surprised to see that there already is one: https://github.com/racket/r6rs/blob/481ca6b05dc6ba3dac79f1a1b3b48706ddf9c0fc/r6rs-test/tests/r6rs/mutable-strings.sls#L17-L20

If I'm understanding correctly, test/unspec-or-exn does not require that an exception be raised. I suppose this is only a "should"-level requirement, which means "that valid reasons may exist in particular circumstances to ignore a statement, but that the implications must be understood and weighed before choosing a different course." Does the test suite intentionally not test such requirements?