purescript-foreign-object icon indicating copy to clipboard operation
purescript-foreign-object copied to clipboard

Inconsistencies with Record.ST and Data.Array.ST

Open kl0tl opened this issue 3 years ago • 1 comments

There’s a few inconsistencies between Foreign.Object.ST, Record.ST and Data.Array.ST:

  • Foreign.Object exports thawST, freezeST and runST whereas those functions are exported as thaw, freeze and run from Data.Array.ST and Record.ST (there’s actually no Record.ST.run yet but I proposed to add it in https://github.com/purescript/purescript-record/issues/68).
  • Record.ST and Data.Array.ST export a modify function but Foreign.Object.ST does not.
  • Foreign.Object.ST.Unsafe exports only an unsafeFreeze function, but no unsafeThaw like Data.Array.ST.Unsafe (I also proposed exporting both unsafeFreeze and unsafeThaw from a new Record.ST.Unsafe module in https://github.com/purescript/purescript-record/issues/68).

Should we make this package more similar to the others, or the other way around perhaps?

kl0tl avatar Nov 24 '20 09:11 kl0tl

Exporting thawST, freezeST and runST as thaw, freeze and run from Foreign.Object.ST isn’t that straightforward because then Foreign.Object.ST must import Object from Foreign.Object, incurring a circular dependency because some functions in Foreign.Object are implemented with mutations for efficiency.

kl0tl avatar Dec 13 '20 16:12 kl0tl