Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(899)

Issue 5421057: code review 5421057: allow direct conversion between string and named []byte... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by rsc
Modified:
13 years, 3 months ago
Reviewers:
CC:
golang-dev, gri, r
Visibility:
Public.

Description

allow direct conversion between string and named []byte, []rune The allowed conversions before and after are: type Tstring string type Tbyte []byte type Trune []rune string <-> string // ok string <-> []byte // ok string <-> []rune // ok string <-> Tstring // ok string <-> Tbyte // was illegal, now ok string <-> Trune // was illegal, now ok Tstring <-> string // ok Tstring <-> []byte // ok Tstring <-> []rune // ok Tstring <-> Tstring // ok Tstring <-> Tbyte // was illegal, now ok Tstring <-> Trune // was illegal, now ok Update spec, compiler, tests. Use in a few packages. We agreed on this a few months ago but never implemented it. Fixes issue 1707.

Patch Set 1 #

Patch Set 2 : diff -r f754c9eb88cf https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f754c9eb88cf https://go.googlecode.com/hg/ #

Total comments: 5

Patch Set 4 : diff -r 7b82e8f65537 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -89 lines) Patch
M doc/go_spec.html View 1 2 3 2 chunks +16 lines, -8 lines 0 comments Download
M src/cmd/gc/subr.c View 1 1 chunk +6 lines, -6 lines 0 comments Download
M src/pkg/encoding/xml/xml_test.go View 1 2 3 chunks +50 lines, -52 lines 0 comments Download
M src/pkg/net/http/sniff.go View 1 1 chunk +17 lines, -17 lines 0 comments Download
M src/pkg/net/mail/message.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
A test/convert1.go View 1 2 1 chunk +96 lines, -0 lines 0 comments Download
M test/convlit.go View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M test/named1.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 5
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 3 months ago (2011-11-21 20:00:29 UTC) #1
gri
LGTM I would add a couple of examples to the spec in the respective section ...
13 years, 3 months ago (2011-11-21 21:09:59 UTC) #2
r
LGTM http://codereview.appspot.com/5421057/diff/3/doc/go_spec.html File doc/go_spec.html (right): http://codereview.appspot.com/5421057/diff/3/doc/go_spec.html#newcode3349 doc/go_spec.html:3349: Converting a byte slice to a string type ...
13 years, 3 months ago (2011-11-21 21:49:01 UTC) #3
rsc
All comments done.
13 years, 3 months ago (2011-11-22 17:29:41 UTC) #4
rsc
13 years, 3 months ago (2011-11-22 17:30:07 UTC) #5
*** Submitted as http://code.google.com/p/go/source/detail?r=1c9fd4ac403a ***

allow direct conversion between string and named []byte, []rune

The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes issue 1707.

R=golang-dev, gri, r
CC=golang-dev
http://codereview.appspot.com/5421057
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b