Replies: 1 comment 1 reply
-
I think this should work? buf: [32]u8
copy(buf[:], "Hellope") |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Example:
I work a lot with static arrays for my strings needs, and this would be very helpful
My typical use case is to just not have to care about strings and how they are allocated and what their lifetime is, they are mutable therefore so i can serialize my config from disk or just arbitrary data if i want to test something
Example:
I never care about allocating a string, makes my life and design super smooth and lean
In odin currently use this utility function:
But i'd rather not have to import modules, and on a different project, i'd have now to use a collection..
I feel like this should be allowed because a static array is just a value type, there is no lifetime involved, and bounds are known at compile time already, compiler's job should be trivial
D allows this, and it's been quite useful to have
One cons is the hidden cost you pay at runtime
Questions:
Beta Was this translation helpful? Give feedback.
All reactions