Skip to content

Fix Word8Buffer.contents to return an object with ByteVector representation - #351

Merged
JohnReppy merged 1 commit into
smlnj:mainfrom
Skyb0rg007:word8buffer-fix
Apr 3, 2025
Merged

JohnReppy merged 1 commit into
smlnj:mainfrom
Skyb0rg007:word8buffer-fix

Conversation

@Skyb0rg007

Copy link
Copy Markdown
Contributor

Issue

- val buf = Word8Buffer.new 10;
- Word8Buffer.add1 (buf, 0wx41);
- Byte.bytesToString (Word8Buffer.contents buf);
unexpected exception (bug?) in SML/NJ: Representation [Representation]
  raised at: Basis/Implementation/Unsafe/target64-object.sml:139.19-139.33
             ../compiler/TopLevel/print/ppobj.sml:377.24
             ../compiler/TopLevel/print/ppobj.sml:377.24
             ../compiler/TopLevel/interact/evalloop.sml:45.54

- String.map Fn.id (Byte.bytesToString (Word8Buffer.contents buf));
val it = "A" : string

Description

This change fixes the issue by ensuring the Word8Buffer.contents function returns a value with the ByteVector object representation (from create_s), instead of the ByteArray representation (from create_b).

How Has This Been Tested?

Not at all. Please test my code as I am unable compile SML/NJ myself due to an issue with the build system.

@Skyb0rg007 Skyb0rg007 changed the title Word8Buffer.contents returns an object with ByteArray representation Fix Word8Buffer.contents to return an object with ByteVector representation Apr 1, 2025
@JohnReppy JohnReppy self-assigned this Apr 3, 2025
@JohnReppy JohnReppy added bug Something isn't working basis-lib problem with Standard ML Basis library fixed-in-110.99.8 Issues fixed in the 110.99.8 release labels Apr 3, 2025
@JohnReppy
JohnReppy merged commit e2b0326 into smlnj:main Apr 3, 2025
@JohnReppy JohnReppy changed the title Fix Word8Buffer.contents to return an object with ByteVector representation Fix Word8Buffer.contents to return an object with ByteVector representation Apr 3, 2025
JohnReppy added a commit that referenced this pull request Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

basis-lib problem with Standard ML Basis library bug Something isn't working fixed-in-110.99.8 Issues fixed in the 110.99.8 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants