Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Slices - struct elements only #31

Open
GraphR00t opened this issue Jan 4, 2024 · 0 comments
Open

Implement Slices - struct elements only #31

GraphR00t opened this issue Jan 4, 2024 · 0 comments

Comments

@GraphR00t
Copy link
Contributor

Inox slices are equivalent to Go slices. They are the primary way to create a sequence containing instances of a struct type.
Slices are not serializable.

struct Token {
    kind int
    start int
    end int
}

# allocate and initialize a slice of length 3 on the module's heap
tokens = [:]Token{{0, 3, 4}}

# allocate a slice on the module's heap
tokens = new([:]Token, 10)

# append a token at the end of the slice, should it work like Golang's append ?
tokens = appendto(tokens, Token{0, 3, 4})

# equivalent
appendto(&tokens, Token{0, 3, 4})
@GraphR00t GraphR00t modified the milestones: Version 0.2, Version 0.3 Jan 4, 2024
@GraphR00t GraphR00t removed this from the Version 0.4 milestone Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant