Primitives in Mlton #583
-
I am implementing Buffer structure as defined here https://github.com/SMLFamily/BasisLibrary/blob/master/Code/2015/004/Buffer.sml. Does mlton already provide the required primitives in lieu of these functions that I can use?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't think that you need primitives at all to implement The linked file includes a "pure" SML implementation: If you really wanted additional efficiency, then |
Beta Was this translation helpful? Give feedback.
-
Thanks. Is there any advantage/benefit in using Word8Array/Word8ArraySlice as opposed to CharArray? in terms of efficiency?
Indeed, I was wondering, does MLton already have unsafe versions of the above specific functions as primitives? If so can I perhaps peruse it? This is useful for performance since most of the Buffer functions already do check bounds and additional bounds check by the Basis lib seems a bit wasteful. |
Beta Was this translation helpful? Give feedback.
None at all in MLton. After front-end type checking,
Word8.word
andChar.char
are the same type.