Strings are easier than []byte because they are immutable.

On Wednesday, February 1, 2017 at 12:08:36 AM UTC-6, Henrik Johansson wrote:
>
> What makes strings harder than for example []byte? 
>
> On Wed, Feb 1, 2017, 06:15 Ian Lance Taylor <ia...@golang.org 
> <javascript:>> wrote:
>
>> On Tue, Jan 31, 2017 at 9:10 PM, Eliot Hedeman
>> <eliot.d...@gmail.com <javascript:>> wrote:
>> > I was writing up a proposal about adding the small string
>> > optimization(putting strings on the heap if they will fit within the
>> > sringStruct)to the go runtime, and I realized there might be good 
>> reason why
>> > this has not been done yet. Are there any glaring reasons you can think 
>> of?
>> > Here is the really rough draft of the proposal. Thanks for the feedback!
>>
>> The problem is that the concurrent garbage collector needs to be able
>> to determine reliably and safely whether a word in memory, including
>> on the stack, contains a pointer or not.  It's not OK to have a word
>> in memory that might or might contain a pointer.  It's a good thing
>> that Go doesn't have unions in the language, because they would be
>> very difficult to implement in the garbage collector.
>>
>> Ian
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to