FAQ

On Mon, Sep 21, 2015 at 11:52 AM, Tim K wrote:
I would love to be able to just say:
"string" + 1
to get "string1"
Well:
"foo" + string(49)
is already valid Go (http://play.golang.org/p/XfIcW0mod4). It would be
weird if we introduced:
"foo" + 49
that did something different.

As for the original post, we already require explicit type conversions
between e.g. int and int32, since C's implicit conversions can easily
lead to bugs. Given that, it'd be weird to allow implicit conversions
that implied running arbitrary code, let alone a well defined
conversion like from int to int32. It's a nice feature of Go that,
unlike C++, when I read a line of code like:
x = y + z
then I know that there aren't any function calls happening.

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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 23 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 20, '15 at 11:52p
activeSep 21, '15 at 5:11p
posts23
users10
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase