News for hackers. Stuff that matters.
Re:Why Go is doomed to succeed by Elrac on Saturday June 13, 2015 @12:40PM (#9711559)
"Between C and Java" hits it very well, I'd say.

When I jumped ship from C to Java, Java's object orientation wasn't exciting to me, and its exception handling is an acquired taste.

But dynamically growable, garbage collected buffers are something I'd missed for a long time. And the simple ability to concatenate strings without first reserving space for the result. Oh, and hash maps! Remarkably versatile data structures, those.

Coming from C, Java was a delight. Java would have a lot more trouble dragging me away from Go.

Re:Why Go is doomed to succeed by xamuel on Saturday June 13, 2015 @05:27PM (#9712731)
>And the simple ability to concatenate strings without first reserving space for the result

Not exactly the same thing, but routine string manipulation in C gets considerably easier once you discover a highly underrated function called asprintf (basically combines sprintf and malloc, calculating the buffer size for you).

Re:Why Go is doomed to succeed by Elrac on Saturday June 13, 2015 @08:23PM (#9713303)
Woo hoo, thanks for the tip!

But I still need to worry about creating a memory leak with this. :(

Re:Why Go is doomed to succeed by Merovius on Sunday June 14, 2015 @04:38AM (#9714227)
Also, asprintf is a GNU-extension, so if you want to write portable code, it's a no-go (as for everything usefull in C).
Re:Why Go is doomed to succeed by Elrac on Sunday June 14, 2015 @10:16AM (#9714980)
Thankfully, I'm not doing much C any more. Those hoity-toity hand-holding languages have spoiled me, and now I don't want to be bothered about memory management and other "trivia." :)
Re:Why Go is doomed to succeed by pjmlp on Sunday June 14, 2015 @04:01AM (#9714128)
Not in ANSI C nor POSIX.
Re:Why Go is doomed to succeed by okasaki on Saturday June 13, 2015 @03:17PM (#9712232)
Well, C++ has all of that.
Re:Why Go is doomed to succeed by Elrac on Saturday June 13, 2015 @03:58PM (#9712402)
Only for small values of "all." The magic of concatenation and auto-conversion of strings that's baked into the Java compiler and, to a lesser extent, the Go compiler, is missing in C++ - not vital but convenient. Similarly, hashmaps, while built directly into the language in Go, are a library class in C++. Finally, garbage collection will likely never be part of C++.
Re:Why Go is doomed to succeed by klibertp on Saturday June 13, 2015 @07:54PM (#9713226)
What do you mean by "the magic concatenation and auto-conversion of strings"?

Also, having a map implemented in a library is a Good Thing. It means that your language is extensible and expressive enough for this. AFAIK Go is - by design - not that extensible.

Re:Why Go is doomed to succeed by Elrac on Saturday June 13, 2015 @08:31PM (#9713320)
Magic concatenation: the "+" operator is understood by the compiler to be the concatenation operator if either operand is a String. "Magic" in the sense that it's an exceptional affordance made by the language (not the library) for this one data type and operator.

Auto-conversion: "2" + 5 = "25". This looks horribly hackish, like some type buggering perl might do, or js. But it comes in handy when you want to build a message string.

And yes, as the article tells us, a lot of things are very purposely left out of Go, which has advantages and disadvantages like most trade-offs.

Re:Why Go is doomed to succeed by okasaki on Sunday June 14, 2015 @02:18AM (#9713917)
Magic concatenation:

        string hello = "hello";
        string world = "world";
        string hw = hello + ' ' + world;
Auto-conversion:

        stringstream ss;
        ss << "2 + 2 = " << 2 + 2 << endl;
        string result = ss.str();
Re:Why Go is doomed to succeed by Elrac on Sunday June 14, 2015 @04:29AM (#9714204)
1 point for "magic concatenation;" I wasn't aware that works!

"nice try" on "auto-conversion".

Re:Why Go is doomed to succeed by reagency on Saturday June 13, 2015 @06:15PM (#9712905)
The main problem of C++ is that it has far too large values of "all".
Re:Why Go is doomed to succeed by pjmlp on Monday June 15, 2015 @08:49AM (#9718960)
Which is still too less when compared with Java, CPAN, Gems, .NET....
Re:Why Go is doomed to succeed by danieldk on Sunday June 14, 2015 @04:23AM (#9714188)
Similarly, hashmaps, while built directly into the language in Go, are a library class in C++.

And this is a problem because?

(It's actually a weak point of Go that you cannot define them in a library without sacrificing type safety.)

Re:Why Go is doomed to succeed by Elrac on Sunday June 14, 2015 @04:30AM (#9714209)
I didn't say it was a problem. I was objecting to "C++ has all that."
Re:Why Go is doomed to succeed by danieldk on Sunday June 14, 2015 @04:51AM (#9714244)
Ah, but the standard library (including unordered_map) is part of the C++11 standard.
Re:Why Go is doomed to succeed by pjmlp on Sunday June 14, 2015 @04:03AM (#9714134)
> Finally, garbage collection will likely never be part of C++.

C++11 has a GC API defined.

Reference counting is part of any GC book in CS speak.

Re:Why Go is doomed to succeed by wyager on Sunday June 14, 2015 @04:07AM (#9714147)
There are a large number of people who would strongly disagree with the claim that implicit casting is a good thing.
Re:Why Go is doomed to succeed by Elrac on Sunday June 14, 2015 @04:35AM (#9714216)
Absolutely, and it's something I consider somewhat of a liability in (e.g.) Scala. You can drive yourself crazy if you're not careful.

However, I feel that doing the "implicit casting" thing only for the single, limited case of string concatenation strikes a happy medium between providing useful convenience and giving you enough rope to hang yourself with.

Re:Why Go is doomed to succeed by okasaki on Saturday June 13, 2015 @04:35PM (#9712549)
It has garbage collection through shared_ptr.
Re:Why Go is doomed to succeed by albinofrenchy on Saturday June 13, 2015 @08:24PM (#9713304)
Not sure if you are serious but the hard part of gcs is resolving and identifying cycles. Cycles with shared pointers are just leaks.
Re:Why Go is doomed to succeed by threeseed on Saturday June 13, 2015 @08:16PM (#9713290)
Exception handling may be an acquired taste.

But it is infinitely better tasting than Go's ridiculous error handling which is something you would expect in the 1980s.