Skip to content

proposal: spec: remove string(int) #3939

Open
@robpike

Description

@robpike
Contributor
The conversion of an integer to a string was put in very early to bootstrap formatted
printing, if I remember correctly. It's odd, though, and no longer necessary, if it ever
was. It also causes inconsistencies, since string(0xD800) cannot produce the UTF-8
encoding for that code point (by definition, surrogates are not legal in UTF-8) so must
produce something else. We chose the "\uFFFD" since that's the only reasonable
option, but that means:

1) the result isn't obvious
2) string(0xD800) and "\uD800" do different things: the former produces the
UTF-8 for U+FFFD while the latter is statically rejected.

I propose that, in some remote future, we eliminate this conversion from the language.

Activity

adg

adg commented on Jan 21, 2013

@adg
Contributor

Comment 1:

I guess we're bound by the Go 1 compatibility promise to keep this until Go 2.
rsc

rsc commented on Jul 30, 2013

@rsc
Contributor

Comment 2:

Labels changed: added go2.

rsc

rsc commented on Dec 4, 2013

@rsc
Contributor

Comment 3:

Labels changed: added repo-main.

rsc

rsc commented on Mar 3, 2014

@rsc
Contributor

Comment 4:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

self-assigned this
on Mar 3, 2014
added this to the Unplanned milestone on Apr 10, 2015

76 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @urandom@dominikh@rsc@dolmen@magical

        Issue actions

          proposal: spec: remove string(int) · Issue #3939 · golang/go