On Wed, Feb 1, 2017 at 6:35 AM, Ian Lance Taylor <i...@golang.org> wrote:
> On Tue, Jan 31, 2017 at 10:26 PM,  <landi...@gmail.com> wrote:
>> It would know at string creation time because strings in go are immutable.
>> Really these are two types, with duck typing between them. (the programmer
>> unless using unsafe or reflection sees them the same)
>> You have a shortstring type and a string type, what determines their type is
>> the length of the string.
>> If it is a shortstring type then it is a regular struct with no pointers, if
>> it is a string type then it would have a pointer.
>
> The point of this scheme is presumably to pass the values to some
> other function that takes arguments of type `string`, such as
> `strings.Split` or whatever.  At that point the distinction you are
> talking about is lost.

By the way, I should add that it's a good idea if we can make it work.
It's just that the initial suggestion won't work, and I don't see an
obvious way to fix it.

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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to