5 ms·
That really depends on what you mean by "most of the time". After all, you only write a generics based library once, and you reuse it many times - therefore on
by spion 12y ago
That really depends on what you mean by "most of the time". After all, you only write a generics based library once, and you reuse it many times - therefore on the outside it appears that you don't really use generics all that much.
In my opinion, depriving a "normal" language user of generics is like depriving a Lisp user of macros. Whatever it is, its definitely not just "bold".
- eloff 12y agoI've done most of my Go programming on library code. A sync library for relational databases to sqlite (for mobile devices) and an embedded database. Lack of generics has bothered me a little, but copy and paste with a multiple-cursor editor really makes short work of it. I think the worst part is really our natural aversion to code duplication and the ugliness of it. e.g. having to write min/max for integers is pretty ugly (although not as ugly as converting your ints to float64 and using the stdlib min/max.) However, I spent more time thinking that it was ugly than writing min and max. Sure it's ugly, but programming is not art, it's engineering, and Go is a language for engineers.
- echaozh 12y agoI never thought people will actually come up and defend code duplication. It's definitely more than ugliness. The need to fix all the copies when they need to be updated is a bigger problem.
- apta 12y agoOr the fact that I actually saw someone on the mailing list also implement min() incorrectly due to copy-paste :) > I never thought people will actually come up and defend code duplication. Indeed. Some of the responses by some Go fans really leave me surprised to say the least.
- pjmlp 12y agoIt was the community attitude towards generics and code distribution that eventually made me focus on Rust and D. At least those communities embrace modern computing abstractions and code distribution practices.
- nknighthb 12y agoIt's fine that you don't agree with our tastes, but it would be nice if you could stop coming into every Go thread and being condescending about it. Like PostgreSQL and OpenBSD, I've been permanently turned off Rust because I never want to be left at the mercy of a community that invests so much time in harassing and insulting others.
- pjmlp 12y agoExcept, I also talk good about Go in what concerns using it to replace C, specially in possible uses for real systems programming in a GC enabled language. After all, when compared with the first Oberon version, Go only needs a few more primitives in runtime and unsafe, Kernel and SYSTEM in Oberon respectively. This is what attracted me to the language in first place.
- ben0x539 12y agoLook, we gotta keep busy while waiting for the rustc build to finish. :(
- pyvpx 12y agoeven if I think it's horribly naive if not flat out erroneous, I can see how someone could feel that way about OpenBSD...but Postgres?! who is harassing or insulting anyone in the Postgres world?!?!
- Jweb_Guru 12y agoPlease tell me where you've been harrassed and insulted by the Postgres community? Sometimes people come into the IRC channel and say something that doesn't make sense and are told it doesn't make sense, and sometimes those people get very upset, but I wouldn't classify that as harrassment. And that's basically the strongest reaction you'll ever get from anyone in the community.
- spion 12y agoYeah, the deficiency isn't the most harmful part - its the attitudes that come with defending that deficiency.
- StandardFuture 12y agoNow you are shifting to a editing dilemma. Code duplication is not machine code duplication which is what really matters at execution time. Reading is also easier (even for non-Go programmers at least familiar with C) without templating-like syntax.
- nine_k 12y agoMachine code duplication is spending a few extra megabytes on perfectly valid, if duplicate, machine code. Source code duplication is a risk of spending an hour, or maybe a day, of developer's time to detect the duplication, change it in concert in several places, with an occasional need of detecting and fixing a subtle discrepancy between the copies. RAM is $0.015 per megabyte. Developer time is $50 per hour.
- jesstaa 12y agoYou could also spend that developer time trying to untangle code reuse between various components, or the more subtle breakages caused by changes that don't account for the expectations of all callers. Code reuse is still a tradeoff.
- the_af 12y agoIt should be noted that generic code is harder to break. It is, by definition, less entangled with its callers. There are also fewer operations you can do with generic parameters, so there are fewer ways to screw up.
- the_af 12y agoCode duplication is definitely a programmer problem, not a machine problem. It's also a major problem. Code duplication increases the probability of programming errors, and makes maintenance harder. Any modern language with poor tools for keeping duplication at bay is suspect.
- sagichmal 12y ago> I never thought people will actually come up and defend > code duplication. DRY is a principle, not an axiom. Overapplication of DRY as axiomatic has led to much pain and suffering.
- the_af 12y agoAgreed! But what this means is that when you decide not to apply DRY, you need to have a reasonable justification. Code duplication in general is a bad thing.
- apta 12y ago> I think the worst part is really our natural aversion to code duplication and the ugliness of it. e.g. having to write min/max for integers is pretty ugly Sometimes ugliness is a sign that something is designed incorrectly, especially if the language aids in making that more visually evident. > (although not as ugly as converting your ints to float64 and using the stdlib min/max.) Not to mention incorrect. > it's ugly, but programming is not art, it's engineering Not mutually exclusive. A good language would make incorrect or inefficient code "ugly" or "uglier" than correct code. > and Go is a language for engineers. So are languages with generics like C++, Java, Rust, Haskell, etc.
- pmontra 12y agoPlus all those dynamically typed languages which are intrinsically built on the concept of generics (JavaScript, Perl, PHP, Python, Ruby). /sarcasm Nobody uses them because nobody needs generics.
- tel 12y agoThey are intrinsically built atop generics. Duck typing is row polymorphism. Dynamic languages often depend upon that flexibility to operate—and they enable it by allowing everything. Static languages without polymorphism are at a low point in that trade-off space since they restrict useful operations and provide no way to express the invariances needed to recover that flexibility.
- notduncansmith 12y ago"My editor makes it really easy to do this terrible thing, so it's okay!" I'm sorry, I quite enjoy many aspects of Go - but the argument that committing one of the cardinal sins of programming is okay because your editor makes it easy is worse than the actual language shortcoming itself.
- sagichmal 12y agoCode duplication is not a cardinal sin of programming. In fact, the attitude that it _is_ has probably done more harm to [modern] programming than duplication ever did :)
- nine_k 12y agoThis comment wins the thread! Sorry, I meant to say that the language's shortcomings, even if temporary, start to attract a wrong attitude, which is sad (and you, golang team, should feel sad).
- mamcx 12y agoOffTopic: This sync library is available?