6 ms·
> Empirically, languages that have large standard > libraries (e.g. Java, Python, Go) seem to do better than > their competitors. You seem to be overlook
by kibwen 10y ago
> Empirically, languages that have large standard
> libraries (e.g. Java, Python, Go) seem to do better than
> their competitors.
You seem to be overlooking the ultimate counterexample: C. :P
- saghm 10y agoJS, too, right? Forget "large" standard library, there really isn't any standard library at all
- brandonbloom 10y agoYou don't consider the dynamic, rich document presentation engine that is HTML to be a standard "library"? Seems like it is to me.
- kibwen 10y agoHTML doesn't do anything for JS other than provide a way to create visual interfaces. It might be comparable to the role that `tkinter` plays for Python's stdlib, but HTML alone is emphatically not a standard library.
- brandonbloom 10y agoMy point is that most languages are totally useless on their own. JavaScript the _language_ doesn't offer any FFI or other mechanism to call outside services. Without a browser or something like Node's libuv, JavaScript wouldn't be useful at all. The capabilities provided in the box are part of the language in terms of what actually matters in motivating people to choose to use the language, no matter what form those capabilities come in.
- tibbe 10y agoYou don't need a standard library to win if you don't have any competitors (in the browser). :) Fitness for purpose is relative to the other options.
- saghm 10y agoWell, JS was originally competing with Java applets in the browser, but, like you said, fitness for purpose is pretty significant! My point (or rather, the point of the parent comment that I'm agreeing with) there's a lot more than just the presence and characteristics of a standard library that determine how widespread a language becomes
- Touche 10y agoThat's overly dismissive, Node.js has the same issue as JS in the browser and does very well. Small core doesn't matter there.
- hibbelig 10y agoYou have these built-in objects like Math and String and Array. Are those not the standard library?
- saghm 10y agoI'm not sure I'd classify them as a standard library; they're essentially just pervasive global variables. For a comparison, think of Java; the standard library is things like `java.util` and `java.swing`, which goes far beyond having the `System` and `Math` classes available in `java.lang`.
- tibbe 10y agoBut C didn't have competitors with large standard libraries, so it didn't suffer as much for it.
- pjmlp 10y agoIt had, Modula-2 and Pascal dialects usually had richer libraries. For example check Turbo Pascal libraries, including Turbo Vision, already on MS-DOS. C took off thanks to UNIX's adoption, like JavaScript on browsers nowadays, it became the language to use for anyone working on the enterprise on those new shiny UNIX boxes. In Europe it was just another systems language to choose from, back when CP/M and other 8 / 16 bit systems were common.
- rjsw 10y agoC was usable on MS-DOS before Modula-2 or Turbo Pascal were available.
- pjmlp 10y agoBoth C compilers and Turbo Pascal already existed in CP/M, which preceded MS-DOS. Also there were C, Pascal and Modula-2 compilers available for ZX Spectrum. And on my part tiny of the globe I can guarantee that everyone only cared about x86 Assembly, Turbo Basic and Turbo Pascal, with Clipper for business stuff. I only got to learn C in 1993, after having been a Turbo Pascal 3, 5.5 and 6.0 user.
- rjsw 10y agoBeing able to compile stuff on CP/M wasn't much help if you wanted to develop MS-DOS applications. I first used C in 1983 on MS-DOS, I didn't use UNIX until a couple of years later. I bought Turbo Pascal 1.0 when it was released but already had a C compiler at that point.
- pjmlp 10y agoMy first contact with MS-DOS was with version 3.x on a PC 1512, until then I was on Z80 systems. So I got to see the language world in a different way, given the local choice of languages as I mentioned. EDIT: Reformulated the answer
- brandonbloom 10y agoYou were being down voted, maybe for perceived snark, but I think you raise an interesting point. To me, C did have a standard library: Unix. It's a runtime system too! Due to the nature of the original C bootstrapping process it just happens to be possible to remove this standard library, and Windows was evidence of this. There is another interesting potential counter example: Lua. It's minimalistic standard library is part of what makes it so attractive for embedding, eg. in game engines. However, Lua's embedding API is so good, you could almost say that it comes with a large standard library too: Your existing C code! I guess my larger point is that languages rarely are able to stand completely on their own. They need some sort of valuable body of code to justify people to choose the language and libraries together. It might have been the case 40 years ago that you'd reasonably choose to build something "from scratch", but today, if you start on an island, you need to build a bridge, lest you remain on an island forever. Better to start on the mainland. It's one thing to build a layered system with a small core. It's another thing to completely ignore the fact that the libraries and community _are_ the language, in the only ways that actually matter.
- kibwen 10y ago> It's another thing to completely ignore the fact that > the libraries and community _are_ the language, in the > only ways that actually matter. I'm unclear, what is this aimed at? Who's ignoring anything?
- ufo 10y agoLua's lack of a stdlib is also a curse. I can't imagine how many incompatible versions of string.trim and OOP libraries are out there in the wild right now... Things have been getting better lately because of Luarocks but its still an uphill battle.
- wahern 10y agoString trim is just: foo:gsub("%s*$", "") or foo:gsub("^%s*", "") The standard idiom for OOP in Lua is a one-liner: return setmetatable(self, mt) where mt.__index has all the methods. How you assign to mt.__index can vary across modules according to style, but that's a _purely_ asethetic issue. The mechanics are identical. Using a module to accomplish it creates a useless dependency. There are many criticisms one could make of Lua, but I don't think those two particular criticisms are legit. They're classic bikeshedding.
- pjmlp 10y agoIt is called UNIX and re-branded as POSIX. C would not have gotten where it is today if it wasn't for the rise of UNIX in the industry, fueled up by free UNIX clones.
- comex 10y ago> You seem to be overlooking the ultimate counterexample: C. :P I think one reason (of many) that C++ has replaced C almost completely for new development is the STL. Of course, the STL fundamentally depends on the language feature of templates, which you can only approximate in C, but considering that Java and Objective-C, among other languages, lasted pretty long with no generics and only non-type-safe containers, I think C could have benefitted greatly from basic things like resizable arrays, hash tables, trees, better strings, etc. in the standard library. Now it is probably too late for it to matter (which most people consider a good thing).
- krylon 10y agoFWIW, the last time I cooked up something in C, I liked Judy very much: http://judy.sourceforge.net/ http://judy.sourceforge.net/ It has slightly awkward but very simple API, and it's very fast.