5 ms·
I think it's less smugness (there certainly is some) and more disbelief / unfamiliarity. JS isn't the first language without great libraries (C's stdlib, `math
by afandian 11y ago
I think it's less smugness (there certainly is some) and more disbelief / unfamiliarity.
JS isn't the first language without great libraries (C's stdlib, `math.h`, `string.h` are good but don't have string padding functions, for example) so there's precedence going back a very long way. Most solutions involve coming up with a utilities library that contains the basic things (like a math library, or a strings library).
There's nothing wrong with creating utility libraries for JS. I think people are surprised because the approach taken - that they are composable down to the function - is so radically different from the industry standard. Coupled with a package manager that requires fetching so many deps for such trivial functionality.
People do tend to form isolated communities around languages (look at the language for basic data structures between PHP, Ruby and Python) and this kind of thing probably helps shake up that isolation which is probably good for both sides.
(I could be wrong it could just be sneering)
- swalberg 11y agosprintf and friends will pad strings for you, no? printf("%20s\n", "Hello");
- creshal 11y agoEven the Java ecosystem managed to get their crap together and make the excellent Apache Commons library collection to deal with a similar situation (anaemic to useless standard library). C++ has STL and Boost. Only the PHP and JS communities seem to think that not having a solidly designed "base" library is fine (and even PHP seems to be getting better at it with 7).
- morsch 11y agoThe Java standard library is anemic? As in Java SE? That's rich. Java SE is an everything but the kitchen sink standard library, with functionality like collection classes, local and networking IO, windowing toolkits (more than one), database connectivity, the list goes on. There is no language with a less anemic standard library, and Java SE is often criticized for being too large.
- opmac 11y agoThis is true. One wonders if OP has actually seen the vastness of Java SE or is just "hating" to "hate".
- creshal 11y agoI've seen it, and more often than not frustratedly turned to Apache Commons because the Java standard library is as vast as it is useless.
- usrusr 11y agoThe JRE lib seems to be a compromise between "common types for everybody, but leave the convenience to external libraries" and "batteries included". This leaves both camps deeply dissatisfied, but allows for a great deal of integration between libraries. Maybe I have looked at Microsoft flavored C++ one time too often, but the fact that a single string type could reign unchallenged for twenty years makes it easy for me to accept that I need to use weird imports to tackle exotic convenience desires via statics (that, and the sad underutilization of CharSequence).
- mdemare 11y agoJava SE includes a lot, but it does emphatically not include a reasonable amount of useful string methods. These are the javadocs for string: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html https://docs.oracle.com/javase/7/docs/api/java/lang/String.h... and these are the rubydocs: http://ruby-doc.org/core-2.3.0/String.html http://ruby-doc.org/core-2.3.0/String.html The difference is absolutely massive. When working on Java projects, I've always included commons/StringUtils reflexively, and even then Ruby is quite a bit ahead. The same applies to collections / enumerables. There's a lot in Ruby that I don't like, but powerful "batteries included" standard libraries for the basics like strings and collections are the bedrock of any programming language. It only takes hard work to write them and test them, not any specific skill, so there is no excuse for all the language out there that are skill lacking, in 2016, a sensible collection of utility methods.
- smt88 11y agoPHP is absolutely the last language I thought anyone would accuse of missing standard features. PHP is massive and includes absolutely insane numbers of functions to do everything. If you can think of 3 basic, universal functions that PHP doesn't include, I'd be shocked. Also, PHP 7 has absolutely nothing to do with standard libraries, as it doesn't really add anything in that regard.
- mreiland 11y agothe cool kids make fun of PHP. You must not be a cool kid.
- golergka 11y agoEverybody makes fun of PHP.
- coldtea 11y agoExcept people busy running businesses and creating with it.
- creshal 11y agoWe run almost everything on Wordpress and still make fun of PHP. And JS. And Java. And ObjC. And Ruby. And Python. Every language has its share of problems and sometimes you just have to vent.
- coldtea 11y agoSure, but: "we make fun of every language/every language has its share of problems, etc." is a completely different statement/message than "everybody makes fun of PHP" -- which singles it out as some huge abnormality...
- mreiland 11y agoapparently the humor of the post was lost on a few people...
- deleted 11y ago[deleted]
- acqq 11y agoI don't consider C++'s Boost something to be proud about. Last time I've checked, Google forbade a significant part of it to their developers, and in my opinion rightly so. But who likes everything there should just as well understand this Node affair.
- vinkelhake 11y agoBoost has been incredibly successful as a breeding ground for new C++ libraries. Much of the functionality that was added to the standard library in C++11 came from Boost. This continues to this day. It's a collection of libraries, no one is using all of it.
- GFK_of_xmaspast 11y agoGoogle's c++ guidelines are idiosyncratic at best.
- TeMPOraL 11y agoGoogle makes a lot of controversial decisions from engineering standpoint, not least of which is doing half of their stuff in Java. (It always bewildered me - why hire the best of the best, and then make them work with lowest-common-denominator tools?)
- acqq 11y agoFrom my point of view, if we remain by why not allowing everything Boost, it isn't controversial at all, for the same reason that Linus (an I too) believe that it is a good that Linux kernel is pure C and not C++. And the same reason why some people now see that the presented Node popular practices aren't something that the battle-tested players consider reasonable to do.
- rdancer 11y ago> C's stdlib, `math.h`, `string.h` are good but don't have string padding functions Of course they do; how would you align printouts otherwise? $ cat main.c #include <stdio.h> int main() { (void) printf ("%42s\n", "hello"); // right-align, 42 chars (void) printf ("%-42s\n", "hello"); // left-align } $ gcc main.c $ ./a.out | cat -A hello$ hello $ $ ./a.out | wc -L 42
- afandian 11y agoOf course you can use `asprintf` to pad a string like you can use a for loop to pad a string in JS. But it's not a dedicated named function to pad strings like the `leftpad` we're discussing. Kind of missing the point of the argument. Given how simple and popular `left-pad` module is (indicating the principle the community uses to determine granularity), I'd guess that if `String.format` was available in JavaScript there would still be a library to provide `leftpad`.
- fyolnish 11y agoIt's a memset followed by a strncpy, hardly worth linking to a library for. You'd be done writing the function before you finish googling for an existing one.
- afandian 11y agoThat's the whole point of the discussion.
- rdancer 11y agoI think the difference is that when a C programmer hits an undefined behaviour, they either blames the spec, the compiler, or themselves. A JavaScript programmer doesn't need a prompt to blame the spec proliferation and dilution, the necessity to write cross-platform by default, and their lack of foresight in not including a 3rd-party library that would have provided some vestiges of a targetable platform. The C code that started as a nice asprintf(3) for GNU/Linux will sprout a few if-defs once it has to run on some embedded PoS without a sane malloc().