3 ms·
Does someone know how the str type works? From lang reference it's pointer/size/capacity struct but none of the examples does any freeing of strings. What kind
by extropy 4y ago
Does someone know how the str type works? From lang reference it's pointer/size/capacity struct but none of the examples does any freeing of strings.
What kind of magic is this?
- ddevault 4y agoStrings are essentially a usage-constrained slice alias. You can pass a string into "free" and it will free the underlying storage. Check out the spec for the full answer: https://harelang.org/specification.pdf https://harelang.org/specification.pdf They are a very lightweight language feature which is mostly supplemented by the standard library, e.g. the strings module.
- sanxiyn 4y agoMost strings in examples are statically allocated and don't need freeing. There is an example with freeing of strings in the introduction. Search for strings::freeall.
- rasterdog 4y agoalso there a lot of implementations of "pointer/size/capacity struct" for strings in plain C