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
native 'str' type unspecced, undocumented, and ill-defined #6544
Comments
From @skidsWe've had a native 'str' type for a while, and still have one even Currently it seems to just be a Str under the hood which has very What exactly is a 'str'? Is it null terminated or does it know Roast indicates it knows how to take an assignment from a Str literal |
From @jnthnOn Fri, 22 Sep 2017 16:40:35 -0700, bri@abrij.org wrote:
It's not native in the sense of same sense that NativeCall uses the word.
That's the wrong way around. A Str boxes a str under the hood, much like Num boxes a num.
Str uses the P6opaque representation. It's defined as something like: class Str { This means it can support things like mixins. The `str` instance is what actually holds the string data buffer. It is always in NFG. Its representation is implementation-defined, but no implementation that provides it supports mixing in to it, which a high-level type like Str should support. So, much like num is an unboxed Num, str is an unboxed Str. It's used quite a bit inside of Rakudo, as it's what all the nqp:: ops for str use. However, there are user-level places one might wish to have it if dealing with a large number of strings. For example: my str @loads-of-strings; Will be far more compact in memory than: my Str @loads-of-strings; Since the latter stores a Scalar pointing to Str pointing to str, while the former is just a bunch of str.
I'm sure there's room for more tests, though given that it's on the inside of every Str, then its functionality is largely covered implicitly (and any method call on a str will box it to the Str object type to actually call the method). |
The RT System itself - Status changed from 'new' to 'open' |
From @geekosaurPossibly the right thing here is for perl 6 to reserve the name for -- |
Migrated from rt.perl.org#132148 (status was 'open')
Searchable as RT132148$
The text was updated successfully, but these errors were encountered: