What we like to keep missing is that golang innovates not as a language, but as a tool to contribute to software project success. Project success in the software industry is abysmal, and we still keep thinking we can spin up another language that will contribute to project success because it let's us express ourselves in new ways. Well, how's that working out so far? The reason why golang appears to have such wide ad…
What Golang Is and Is Not
261–270 of 279 posts
Re: What Golang Is and Is Not
#262As some people like to point out, I'd also like to remind that in 1968 Algol had: - user defined record types - user defined sum types - switch/case statement with support for sum types - unified syntax for value and reference types - closures with lexical scoping - parallelism support - multi-pass compilation Given that many mainstream languages don't offer even what Algo68 had, I personally understand how a Go deve…
Re: What Golang Is and Is Not
#263> “There is nothing new under the sun” rings true in all languages since the 80’s. Really? Nothing? Sure a language like Rust has drawn from many other concepts in other languages, but it has done so while actually bringing high level features to a language that has zero overhead costs. But yes, it's not simple like Go. Did Go need to make all errors unchecked? There are no guide rails telling you that you forgot to…
Poor old Tony Hoare (algol was mentioned earlier (rightly) as an exemplar of innovation) but Null in a safe memory managed context is a different beast to a true Null reference.
Null appears then as something between a known state and an not quite an exception, it carries different semantics from either, and whilst this could be seen as more complexity, I think the "I just don't know" case in practicality is useful, if harder to reason about.
Your point about the runtime is very true. Partly because of this - error checking is overrated! Yes I said it! We have go code that has been running in a reasonably high scale production environment for over two years and there are `if:...;err != nil` blocks that have never been touched in millions of calls per day, for 2 years. We have redundant services and trap panics in the rpc handlers, the nil becomes very clear and the rest of the system makes good progress. We save lines, save tests, and release a single binary fast. One example of where Go helps us deliver value faster, by being able to choose to ignore exceptions. Many people find this very uncomfortable. I say they are mistaking where the true project risks lie.
Re: What Golang Is and Is Not
#264Re: What Golang Is and Is Not
#265As someone who writes Go every day for work, I can't agree that Go is simple. Using a language for analytics without generics can be quite painful and error prone. Go is a language that pushes remembering corner cases and failure conditions onto the programmer rather than the language and runtime itself. When you already have to remember a myriad of corner cases for business logic, also remembering so many corner cas…
Re: What Golang Is and Is Not
#266Earlier quoted context omitted.
> Improving asymptotic bounds. Providing functionality typically not supported by common data structures. It's nice to know that you remember stuff from the textbook. However, how often do you need to do something like this for real production code? Depending on what it is you normally do, it's entirely possible that you need to do this every other project. It's also possible that you never have a real need to do the…
> It's also possible that you never have a real need to do these things. What I don't have a real need for is the ability to destroy the internal invariants of other modules. :-p > True, which is why I'm pretty confident that 15 years of Smalltalk development on many large code bases without running into a heterogeneous collection debugging conundrum is possibly a valid data point. Who says homogeneous collections ar…
I only ever recall this happening when someone inadvisedly modified or added a method to a library. In my actual industry practice, type information never did anything to "preserve the internal invariants of other modules." The only time we lamented the lack of type information was in large scale refactorings.
Who says homogeneous collections are the only use case for parametricity?
No one. However, that was your example. My argument is that's a really poor example. And now you are abandoning it.
I don't separate concerns to be “clever”.
I also like separating concerns. I'm also not a dynamic typing bigot, though you seem to be imagining you are arguing with one. You seem to have devolved into abandoning your points of arguments and portraying your discussion partner as a series of strawmen. How in the heck did you get here from parametric algorithms? This smacks of intellectual dishonesty.
“Hubris” is a term I would reserve for those who write large programs whose constituent parts don't have fixed structure
And earlier, you were claiming something about refactoring. Do you see a contradiction here?
Re: What Golang Is and Is Not
#267Earlier quoted context omitted.
> It's also possible that you never have a real need to do these things. What I don't have a real need for is the ability to destroy the internal invariants of other modules. :-p > True, which is why I'm pretty confident that 15 years of Smalltalk development on many large code bases without running into a heterogeneous collection debugging conundrum is possibly a valid data point. Who says homogeneous collections ar…
What I don't have a real need for is the ability to destroy the internal invariants of other modules. :-p I only ever recall this happening when someone inadvisedly modified or added a method to a library. In my actual industry practice, type information never did anything to "preserve the internal invariants of other modules." The only time we lamented the lack of type information was in large scale refactorings. Wh…
Most languages don't have abstract types (not to be confused with abstract classes!), so there's that. Abstract types protect invariants of modules from external tampering. This is a mathematical fact.
> However, that was your example. My argument is that's a really poor example. And now you are abandoning it.
I'm not abandoning anything. I'm only saying that the use cases of parametricity go far beyond parametric collections.
> I also like separating concerns.
Good! Then what do you gain from the existence of reflection (which is pretty much the opposite of type abstraction), or the possibility of sending wrong messages? This is as anti-separation-of-concerns as it gets.
Even more worrisome is what you have said in another post: “Decompilation in Smalltalk is trivially perfect, excluding local variable names, so closed source was fairly pointless.” (https://news.ycombinator.com/item?id=12340864) How can you pretend this is compatible with separating concerns? You're talking about inspecting the structure of arbitrary parts of a program!
> I'm also not a dynamic typing bigot, though you seem to be imagining you are arguing with one.
I've just made technical claims. I haven't personally attacked you. If you think I did, my apologies.
> How in the heck did you get here from parametric algorithms? This smacks of intellectual dishonesty.
I also request that you refrain from making personal attacks.
Anyway. Parametricity means more than you think. The inability to inspect the representation of an abstract type is an example of parametricity too.
> And earlier, you were claiming something about refactoring. Do you see a contradiction here?
Nope, I don't see it. Refactoring produces a different program with a different fixed structure. And the difference shows up when the old and new programs have different types. The reason why types are helpful is precisely because they guide the evolution from the old to the new program.
Re: What Golang Is and Is Not
#268> “There is nothing new under the sun” rings true in all languages since the 80’s. Really? Nothing? Sure a language like Rust has drawn from many other concepts in other languages, but it has done so while actually bringing high level features to a language that has zero overhead costs. But yes, it's not simple like Go. Did Go need to make all errors unchecked? There are no guide rails telling you that you forgot to…
Thank you, and may I say what a well written comment. Poor old Tony Hoare (algol was mentioned earlier (rightly) as an exemplar of innovation) but Null in a safe memory managed context is a different beast to a true Null reference. Null appears then as something between a known state and an not quite an exception, it carries different semantics from either, and whilst this could be seen as more complexity, I think th…
It's funny, every language I know gives you an option to basically ignore the error and just pray. I get what your saying, but if this is the type of code you want to produce, you can still do that in other languages that have strong types around Null and Errors.
In Rust for example:
my_possible_error.unwrap()
In places where you are explicitly making that choice. And to me that's the big difference. Is it explicit or implicit/unknown?Re: What Golang Is and Is Not
#269Earlier quoted context omitted.
Examples that bother me sometimes. YMMV of course. Writing to a closed channel panics, but writing to a nil channel blocks forever. Appending to a nil slice works fine, but inserting into a nil map panics. If you have a function that returns an error struct, and you wrap it with another function that returns the error interface, nil returns from the inner function will no longer test equal to nil. Defining a method w…
What you describe is all true, but honestly, this is such a small number of corner cases compared to traditional languages(C, C++, python, javascript, etc.), that it is really not a big deal. Also most of this is clearly documented.
- Using an iterator more than once silently produces nothing. I notice this when I insert print statements to debug something, but then accidentally turn the following for-loop into a no-op. The Python 3 change that made more top-level functions return iterators made this problem more common, though I agree with the performance justification for doing it. It would be nice if iterating again after hitting the end raised an Exception, though I'm sure that would break all sorts of code that assumes it doesn't.
- Mutating function default arguments affects all subsequent calls. This is most common Python gotcha people seem to talk about.
Re: What Golang Is and Is Not
#270Earlier quoted context omitted.
I still don't see what you are gaining here. Outside of code golf, the goal should not be to try and write code as short as possible, regardless of the language you are using. But this just seems to validate Pike's assertion that a for loop is more suitable to the problem. Perhaps an example of where map/reduce is a significant improvement to the expressiveness would be appropriate for the discussion?
I wrote an aimbot for a FPS game. The basic idea: Take all the players, and all the buildings. Filter out those that aren't enemies. Filter out those that are currently invincible. Transform that into a list of actual points in worldspace- the hitboxes for players, the AABB centers for buildings. (Not all player models have the same hitbox count.) Unless we are holding a weapon that does splash damage- then go for th…
Suppose that you have a bunch of things implemented using map or filter. When someone writes parallelized versions of map and filter, all of the existing code gets the benefits.
Now suppose you have a bunch of basic functions implemented using reduce (sum, product, min, max, reverse, ...). Can these be parallelized? Yes - by throwing away the 'reduce' implementation, and starting from scratch.
The problem with reduce, compared to its more useful cousins map and filter, is that it is too powerful. Map and filter are more limited than reduce, but if you can express your computation in terms of maps and filters, you get something valuable in return. If you can express is in terms of reduce, you save a few keystrokes, and that's about it.
For anyone interested in this kind of stuff, I recommend Guy Steele's talk "Organizing Functional Code for Parallel Execution; or, foldl and foldr Considered Slightly Harmful": https://vimeo.com/6624203