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

Allow the creation of new Basic types in code #100

Open
vdka opened this issue Nov 23, 2017 · 0 comments
Open

Allow the creation of new Basic types in code #100

vdka opened this issue Nov 23, 2017 · 0 comments

Comments

@vdka
Copy link
Contributor

vdka commented Nov 23, 2017

Allowing the creation of custom integer types at a user level will allow bitfields to be implemented nicely. This will be similar to how it is done in (ziglang)[http://andrewkelley.me/post/a-better-way-to-implement-bit-fields.html].

#import compiler("types")
u3 :: types.Integer(bits: 3, signed: false)
u2 :: types.Integer(bits: 2, signed: false)
BitField :: struct {
    a: u3
    b: u3
    c: u2
}
@vdka vdka added the feature label Nov 23, 2017
@vdka vdka added this to the Notable Features milestone Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant