Skip to content
Discussion options

You must be logged in to vote

Lisette supports Go slices, but not (yet) Go arrays. The difference is that a slice in Go (and Lisette) is dynamically sized, while an array is fixed (it can't be resized).

Your code example is actually a slice, but preallocated; the runtime preallocates 1024 bytes for it. Lisette also does not (yet) support preallocating slices.

The simplest way to create a byte-slice is simply manually giving it a type (as a plain number defaults to int):

// byte is an alias for uint8, so both of these are equivalent, and can hold values from 0 to 255

let buffer: Slice<byte> = [0, 255]
let buffer: Slice<uint8> = [0, 255]

// alternatively
let mut c = Slice.new<byte>()
c = c.append(1)

// or even
let mut

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tmssngr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants