5 ms·
No one knew about generics until languages like Pony and Crystal proved that they were important? This may be a pedantic point, but technically, generics or tem
by jhpriestley 9y ago
No one knew about generics until languages like Pony and Crystal proved that they were important? This may be a pedantic point, but technically, generics or templated types were already being used in some obscure, academic languages like Java, C#, and C++.
- cratermoon 9y agoAs I read it, the author wasn't discounting those languages or saying nobody had heard of generics, he was saying that newer languages demonstrate that generics are now expected. Remember, both c++ and Java got generics added on (and c# followed Java's lead). The introduction of languages that have generics designed in from day one is key. Even though Go doesn't (yet?) have them, the fact that its designers wrestled with the question from the start is an indicator that the concept has become central to programming language design.
- munificent 9y ago> Remember, both c++ and Java got generics added on (and c# followed Java's lead). C++ got templates 27 years ago. Java got generics 13 years ago. C# got them 12 years ago. Go was launched 10 years ago. I can't think of a single statically typed language with significant use when Go was developed that didn't have some for of type parametricity. Maybe C, but you could argue C users can simply opt into C++ if they want that. The Go folks aren't risking being on the wrong side if they history if they don't add generics. They were on the wrong side of history when the language launched. I do understand that generics are very difficult in an ahead-of-time compiled language where fast modular compiles are a priority one goal. I'm not saying its easy, at all. But there's no shortage of brilliant folks on the team. If they put their minds to it, they could solve this. Maybe it was because they had the luxury of controlling the language and core libraries. They could make the types and functions they cared about -- channels, arrays, slices, maps, append(), etc. generic since they could bake them right into the language. It's really easy to not empathize with a user's problem if you don't experience it yourself.
- pjmlp 9y agoYou got your history wrong. C++ got templates during the time it was being designed. Between C++ ARM and ANSI C++98, C++ compilers experimented with them, and its design reflected on the standard work. Borland was one of the first PC compiler vendors to support templates, still on their MS-DOS/Windows 3.1 compilers, with the release of Borland C++ 3.0. Microsoft Research already had a .NET prototype with generics support, by the time v1.0 was about to get released, but they decided it was more relevant to ship v1.0 than waiting for the generics support to be fully done. Don Syme from the F# team has a few blog entries about this. One of the first languages to get generics was CLU in 1975, shortly followed by ML and Ada in the early 80's.
- rst 9y agoC++ did not have templates when the first commercial compilers shipped and the first books were published. It got templates around 1990, five years after the first release of a commercial C++ compiler and the first publication of "The C++ Programming Language". ref: http://www.stroustrup.com/hopl-almost-final.pdf http://www.stroustrup.com/hopl-almost-final.pdf
- pjmlp 9y agoC++ was only set in stone in 1998 with the release of ANSI C++98. Until then, it was a moving target, with C++ compilers catching up with CFront and ongoing work at ANSI/ISO meetings.
- pjmlp 9y agoOne of the early languages to support generics was CLU, made available in 1975. Ada was standardised in 1983 and had enough generics support to be used for the early work of Alexander Stepanov. There are lots of examples with generics support since the mid 70's.
- finnh 9y agoYeah, this part was pretty funny too: > By the time this decade rolled around, Node.js and Go had arrived on the scene, highlighting the need for concurrency as a first class concept. Again, no mention of Java? Seems like an odd blind spot.
- kbutler 9y agoAnd he doesn't realize that node.js is single-threaded...
- rmrfrmrf 9y agonode.js isn't single-threaded. The JS code gets executed in a single thread, but I/O happens in multiple threads (that stuff is all abstracted away by libuv, but I still consider libuv to be an integral part of node.js).
- kbutler 9y agoPython I/O also releases the GIL (and has for decades). And FWIW, libuv is also available in Python. https://magic.io/blog/uvloop-blazing-fast-python-networking/ https://magic.io/blog/uvloop-blazing-fast-python-networking/ claims significantly faster than nodejs.
- rmrfrmrf 9y ago> Python I/O also releases the GIL (and has for decades). I didn't know this; thanks! I'm not familiar with Python internals at all (in fact, I had to look up what GIL was when I read the article). Seems strange, then, that the author would imply a contrast between Python and node.js (which I'm now realizing was your point to begin with). Thanks for being patient with me :). > And FWIW, libuv is also available in Python. > https://magic.io/blog/uvloop-blazing-fast-python-networking/ https://magic.io/blog/uvloop-blazing-fast-python-networking/ claims significantly faster than nodejs. Yep! There are bindings for quite a few languages now. The only reasons why I conflate libuv with node.js are because libuv was developed specifically for node (as a cross-platform libev implementation) and because libuv comes with node by default.