Earlier quoted context omitted.
A well known and tested approach, sum types (tagged unions), would have been way better, but it was cast aside because the designers were apparently unaware of the improvements to union types made since C's inception: http://www.reddit.com/r/programming/comments/w1ig0/things_i_...
You're jumping to a false conclusion that Go's designers were not aware of those language features, and that that was the reason why they aren't in Go.
Go at SoundCloud
91–100 of 112 posts
Re: Go at SoundCloud
#92I'm still a bit of a novice, could someone elaborate on what he means by operator overloading being "problem creating?" I thought that was one of the main, 'core' concepts of OOP. Inheritance, and polymorphism. How would you make something like a GUI without being able to specialize classes by overriding certain methods? Have I misunderstood his point?
The argument is roughly that it is, in fact, not very useful, while opening up a vast array of misuses - especially in the domain of being all too clever. What does "+" mean on a list and an object? Add, probably. But what if it's two lists? Union? Or add the second list as the last element to the first? Named functions "add" and "union" aren't any less readable and loads more descriptive. The only situation you posi…
Those guys seem to manage the flexibility pretty well.
Re: Go at SoundCloud
#93Earlier quoted context omitted.
The argument is roughly that it is, in fact, not very useful, while opening up a vast array of misuses - especially in the domain of being all too clever. What does "+" mean on a list and an object? Add, probably. But what if it's two lists? Union? Or add the second list as the last element to the first? Named functions "add" and "union" aren't any less readable and loads more descriptive. The only situation you posi…
Doesn't ruby with its "operators are actually methods and fair-game for redefinition" implementation disprove the theory operator overloading is an a priori Bad Idea (tm)? Those guys seem to manage the flexibility pretty well.
doc / :div / ".foo"
If I saw it out of context I'd assume it was some sort of pseudocode.Re: Go at SoundCloud
#94Earlier quoted context omitted.
Opertor overloading is really horrible. By reading the code "foo + bar" you can't know what is really doing internally. He is talking about operator (+-*=[]&) overloading. Not method overloading.
I wish I could agree, but experience has shown that not having operator overloading makes (a) operating polymorphically over different number types and (b) creating new number types (decimals, bigints, etc.) really awkward. The former is much of the reason we had to add it to Rust. We have matrices that can operate over any numeric type T that implements the basic operations (so we can write matrix math once and have…
It might seem petty, but whilst I understand rust avoiding overloading functions entirely (due to type problems and code obfuscation), it was enough to turn me off entirely, in this case sending back to D.
Bear in mind this is not to say Rust is a bad language - there's plenty to like about it. ;)
Re: Go at SoundCloud
#95What sort of development environment are others here using for go (if using it at all, of course) ? I've had reasonably good experience with the go-mode in emacs.
Re: Go at SoundCloud
#96Earlier quoted context omitted.
It doesn't have classes or inheritance.
You don't count this as inheritance? Also, classes aren't required for OOP. function Parent() { // somestuff } function Child() { Parent.call(this); } Child.prototype = new Parent(); Child.prototype.constructor = Child
Re: Go at SoundCloud
#97I'm still a bit of a novice, could someone elaborate on what he means by operator overloading being "problem creating?" I thought that was one of the main, 'core' concepts of OOP. Inheritance, and polymorphism. How would you make something like a GUI without being able to specialize classes by overriding certain methods? Have I misunderstood his point?
I haven't seen a GUI written in Go yet, but the basic idea is that you don't customize via inheritance; you do it in a different way. For example, in many UI libraries, you can create a function and ask a widget to call you when you receive an event; the widget will have methods like: addClickHandler(myFunction) Any customization you could do with inheritance could be done with a callback function instead, provided t…
Re: Go at SoundCloud
#98Earlier quoted context omitted.
I wish I could agree, but experience has shown that not having operator overloading makes (a) operating polymorphically over different number types and (b) creating new number types (decimals, bigints, etc.) really awkward. The former is much of the reason we had to add it to Rust. We have matrices that can operate over any numeric type T that implements the basic operations (so we can write matrix math once and have…
How did you solve the problem in your matrix libraries of overloading a single operator multiple times? I was trying to make rudimentary, game-oriented linear algebra library in rust along the lines of glm. I immediately ran into the problem of not being able to implement "mat4 * float->mat4", "mat4 * vec4->vec4" and "mat4 * mat4->mat4" overloads at once. The alternative was only to go with "mult_float", "mult_vec4"…
Did you have a look at the Eigen library (C++)?
http://eigen.tuxfamily.org/dox/TutorialMatrixClass.html
I have never worked with this library but it seems to me that they have not the problems you described. Maybe having a look at it brings up some new ideas...
Re: Go at SoundCloud
#99Earlier quoted context omitted.
You don't count this as inheritance? Also, classes aren't required for OOP. function Parent() { // somestuff } function Child() { Parent.call(this); } Child.prototype = new Parent(); Child.prototype.constructor = Child
I call that prototypical construction. The point is, it's hardly java.
Btw, you can also do classes with JavaScript: http://mootools.net/docs/core/Class/Class
JavaScript's prototype-based OOP is a superset of class-based OOP.
Re: Go at SoundCloud
#100We've just started using Go as well. It smokes our Python app in terms of speed, and is fun to use (maybe just because it's new?). I have always wondered, however, that if moving to a new language seems great because of the language, or because you have such a better understanding of the implementation of the problem you are trying to solve.
Like any other compiled language would do.