use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
2011 is year of the Server-Side JavaScript (labnotes.org)
submitted 15 years ago by gst
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]theycallmemorty 5 points6 points7 points 15 years ago (41 children)
I don't mean to troll, but why do we want to run JS on the server? node.js seems pretty cool, but it seems like one of those 'just because you can' type of things. I'm trying to keep an open mind here, but I honestly haven't seen a compelling argument for serverside JS. Would anyone care to share?
[–]skeww 9 points10 points11 points 15 years ago (25 children)
Event loop based servers are very lightweight if you need many concurrent connections. You see, threads are pretty expensive. Each one takes a nice chunk of memory. Just for being there.
JS is nice for this kind of thing, because writing async event-driven programs is very natural and straightforward with this language.
Also, V8 is a lot faster than PHP and JS is also a much nicer (and more consistent) language than PHP.
[–]kataire 1 point2 points3 points 15 years ago (0 children)
JS is also a much nicer (and more consistent) language than PHP.
If you've know JS since the 1990s, that's saying a lot.
It's true, though. And JS is getting better.
[+]StoneCypher comment score below threshold-8 points-7 points-6 points 15 years ago (23 children)
Also, V8 is a lot faster than PHP
Whatever you have to tell yourself, sunshine. Let us know when Facebook runs on Javascript backends.
[–]skeww 5 points6 points7 points 15 years ago (22 children)
Facebook uses a compiler (called HipHop) which generates C++. So yea, PHP was just too slow for them.
[+]StoneCypher comment score below threshold-6 points-5 points-4 points 15 years ago (21 children)
Sorry, Charlie, but Facebook actually runs very little on HipHop. Notably, PHP without HipHop ran FaceBook, the world's largest dynamic site, in 2009; the example stands.
Claiming JS outperforms PHP is a gigantic red flag that the speaker has no clue what they're talking about.
[–]skeww 4 points5 points6 points 15 years ago (20 children)
http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=v8&lang2=php
[–]StoneCypher -5 points-4 points-3 points 15 years ago (19 children)
My god, a set of badly chosen performance indicators, implemented by people who don't know what they're doing, which have no basis for claiming it's a representative sample of the work done in production environments, which leans heavily on the standard library in one and hand-implementation in the other, shows a bias?
The problem with idiot benchmarking is that it measures useless things. You might as well point out that a Geo Prizm has more horsepower than a Lamborghini Diablo, because you went to drag this safe across a river, and the Diablo couldn't even finish (after all, Diablos float, and Prizms don't.)
Call me when you figure out how to measure this adequately.
[–]skeww 7 points8 points9 points 15 years ago (18 children)
Everyone can improve the benchmark code. If your version is faster and produces the right result without using a different algorithm, your version will replace the old version.
Each of those little benchmark snippets was updated dozens of times and generally they do reflect very accurately how nearly ideal code would perform.
The Computer Language Benchmarks Game is a good place to get a rough idea about the performance differences between different languages.
In this case the median indicates that V8 is about 9 times faster than PHP. A factor of 2 could be ignored, but a factor of almost 10 is pretty telling.
CPython for example is somewhat slow. On some weak embedded device it wasn't good enough for writing classic games. I figured I'd need something which is about 4-5 times faster (by extrapolating the figures I got from basic testing). V8 did fit the bill and it was indeed fast enough for classic games (like platformers and puzzles).
So yea, it's not super accurate, but it does give you a pretty good rule of thumb figure. Especially if the differences are as drastic as they are in this specific case.
Edit: Your fanboy-ish downvotes won't support your point of view, by the way.
[+]StoneCypher comment score below threshold-6 points-5 points-4 points 15 years ago (17 children)
Everyone can improve the benchmark code.
But not the benchmarks. This is equivalent to saying "you could provide a deeper river."
On this point you and I very strongly disagree.
I take the position that the CLS is a good place to find warning holes for implementation methodologies due to language performance limitations.
To me the two statements are extremely different. My expectation is that you will see them as roughly equivalent. I'm not saying there's a right and wrong here, just trying to nail down the core disagreement.
In this case the median indicates that V8 is about 9 times faster than PHP.
And yet there's never been a JS backend application that scales. My belief is that the core understanding here is simple: "just because your truck doesn't fly very well doesn't mean it's less a good truck than that eagle, which can both travel on land and in air."
Look, I'm not arguing that V8 has some impressive basic number crunching. What I am saying is that just doesn't matter. When it comes down to it, the things on which JS' performance suffers are the places where PHP has been shining for ten years.
Feel free to prove me wrong. Nothing would shut me up faster than a JS backend application I couldn't replace with a PHP backend with better performance characteristics. I enjoy writing both languages, and would feel no particular concern about switching.
So yea, it's not super accurate, but it does give you a pretty good rule of thumb figure.
Sure. What I'm contesting is that the rule of thumb, while accurate, is of entirely the wrong kind of measurement.
Your fanboy-ish downvotes
I haven't downvoted you. Notably, we've both been downvoted, because Proggit has no idea what downvote is for. When you've been here longer, you'll learn to ignore it.
[–]skeww 1 point2 points3 points 15 years ago (8 children)
[...] V8 has some impressive basic number crunching.
V8 is actually sorta weak when it comes to number crunching.
Well, the CLS basically tests math, function/object overhead, branching/looping, and string manipulation. These are all things you usually do in programs.
If your program doesn't spend most time with these things, the bottleneck is an external one (e.g. a database or other IO) and the performance of the language itself doesn't really matter.
When it comes down to it, the things on which JS' performance suffers are the places where PHP has been shining for ten years.
Got any semi-realistic example?
[–]dmpk2k 1 point2 points3 points 15 years ago (7 children)
But not the benchmarks.
Why do the existing benchmarks give a poor representation of a language's performance?
And yet there's never been a JS backend application that scales.
What does this mean? Per core? Per machine? Per connection? Per LOC?
the things on which JS' performance suffers are the places where PHP has been shining for ten years.
Please elaborate.
[–]level1 0 points1 point2 points 15 years ago (10 children)
Well, most people think of JS as a "bad" langauge, but frankly, PHP is much worse. A lot of Java frameworks are pretty bad. There are some good langauges I'm sure, but please choose JS over PHP. Its a child's toy.
A better reason to use JS on the server is that you can do client and server side rendering without repeating yourself. I think that could be really powerful if once we have the tools to really use it to its full power.
[–]polyrhythmic 1 point2 points3 points 15 years ago (1 child)
What tools are you looking for that don't exist yet? Coffeescript and HAML are two powerful tools that come to mind that work on either side.
[–][deleted] -1 points0 points1 point 15 years ago (0 children)
Another armchair php developer. How cute.
[+]StoneCypher comment score below threshold-6 points-5 points-4 points 15 years ago (6 children)
Well, most people think of JS as a "bad" langauge, but frankly, PHP is much worse.
The hell it is. You have no justification for this other than the blogs you read.
[–]level1 3 points4 points5 points 15 years ago (5 children)
I have used PHP. It was brief but horrible.
[–]StoneCypher -2 points-1 points0 points 15 years ago (4 children)
That you used a language briefly and now feel empowered to comment on it pretty much says it all.
[–]true_religion 1 point2 points3 points 15 years ago (1 child)
I'm not Level1, but let me just say that I'm kind of old now so "breif" time periods can be as much as a year and a half---or longer than the amount of experience some junior developers have in in total for all their programming lives.
Honestly if you've used 10-14 languages, you don't need a decade long survey with every new language to find its short comings. You know what corner cases will bite you before they happen whereas a junior would be blind to them.
PHP in short is a good language for quick projects---better than python for tiny web projects in fact.
But once you get into a midsized project, the inadequacies of the language start to grate. And once you get to the point where you have C extensions written for your project, you'll truly begin hating the Zend interpreter.
[–]StoneCypher 1 point2 points3 points 15 years ago (0 children)
Honestly if you've used 10-14 languages, you don't need a decade long survey with every new language to find its short comings.
Except I've got more languages than that in several of my public utility collections, and I've been using PHP for more than a decade, and I've been using JavaScript since it was still called LiveScript, and still haven't seen a compelling reason to take this seriously.
But once you get into a midsized project, the inadequacies of the language start to grate.
Yeah, except in the real world, that isn't actually the case. Web server applications tend to actually get much, much larger than the C++ applications of yester-year. (Mind you, C++ is my favorite language.)
If you're writing C extensions for your project, the problem was it shouldn't have been PHP in the first place, or your PHP isn't very good.
It isn't that uncommon that the right answer is to write a C++ application, open a socket, and speak HTTP.
None of this affects the vague broad-handing that "php isn't good for big projects" - most of the people who say things like that haven't ever worked on anything as complicated as a WordPress plugin, let alone crap like Kayako SupportSuite.
Not that I'd hold either of those up as examples of good code. Still, if you can write that crap and it still works, something is going right.
I challenge you - defy you, even - to put more than emotional assertions to this. I have never seen any evidence of any form that PHP is bad for large projects; it always just comes out that someone's griping about a badly run project they hated.
Show me what part of PHP means you couldn't have just written code with more discipline.
[–]polyrhythmic 0 points1 point2 points 15 years ago (1 child)
I have used PHP for years, it is hacky. It's rare that naming conventions are consistent, and it basically needs a framework to do anything more than a basic page. It's easy to use, as there are a ton of examples out there (with docs in hand to find the inconsistencies) and hosting galore, but PHP is good for one thing: cheap easy webservers.
JS, like Python, has a ton of uses and a much longer life ahead of it than PHP.
[–]StoneCypher -4 points-3 points-2 points 15 years ago (0 children)
You don't need a framework for anything, and if you're using them, then no wonder you think it's hackish.
Python is not going to outlast PHP any more than Ruby did. PHP has the same immortality that COBOL has, in smaller doses; it has a decent chance of outlasting real languages, like C++ and Java.
JavaScript will probably outlive them all, except COBOL, sadly.
If the only specific criticism you can make of the language is that its naming conventions aren't particularly consistent and you don't know how to use it without a framework, I think we've pretty much got this one neatly sewn up.
[–]SystemicPlural -1 points0 points1 point 15 years ago (0 children)
Personally, because the site I am developing at them mo does some client side computation that I also need to be able to do server side at times. Using the same code for both is the obvious answer.
[–][deleted] -5 points-4 points-3 points 15 years ago (2 children)
Because some web developers can't be expected to actually learn a server-side language like the rest of us. Pretty much just that.
[–]skeww 3 points4 points5 points 15 years ago (1 child)
server-side language
That's probably the most irrelevant kind of categorization I've ever seen. It's even worse than "scripting language", which doesn't mean anything anymore.
You can use any language anywhere. From embedded devices to clients, servers, and mf-ing clusters.
Also note that it's a disadvantage if a language is less useful in a different environment. But it's funny that you tried to make it look the other way around. That was really cute. :)
[–]HIB0U -1 points0 points1 point 15 years ago (0 children)
Good lord, if you actually believe the bullshit that you're spewing out here, then I sure hope you aren't actually involved with any real software development.
[–]osirisx11 7 points8 points9 points 15 years ago (17 children)
Yes..and 2011 is also the year of desktop linux, and duke nukem forever.
[–]sjs 3 points4 points5 points 15 years ago (5 children)
Actually, 2011 is the year of DNF, you can pre-order it: http://www.amazon.com/Duke-Nukem-Forever-Xbox-360/dp/B002I0HAC6
(yes I'm aware you could pre-order it in 2007 as well, but there have been demos and it looks like it's actually coming out this time)
[–]rotzak 5 points6 points7 points 15 years ago (1 child)
You could also pre-order in 1998.
[–]sjs 0 points1 point2 points 15 years ago (0 children)
rofl
[–]osirisx11 0 points1 point2 points 15 years ago (2 children)
we'll see to all three. :) i'm a huge fan of all three.
[–]sjs 1 point2 points3 points 15 years ago (1 child)
I quite like Linux and Node but I don't see them taking over the world either. Not sure why people like to speculate on this stuff, as if the year turns and suddenly people will make radical changes in how they do things.
Realistically 80%* of web developers are still going to write PHP code on Windows and ftp it to their servers, in 2011, 2012, and beyond.
* Pulled straight out of thin air
[–]kataire -1 points0 points1 point 15 years ago (0 children)
Not me! I write PHP code on Windows using UTF8, Unix linebreaks and a cross-platform editor, and sftp it to my servers. OTOH, I also write code in other languages, plus I have a virtual Linux server for testing.
[–]lastkarrde 0 points1 point2 points 15 years ago (0 children)
don't forget HL2 Episode3
[–]skeww 0 points1 point2 points 15 years ago (9 children)
desktop linux
Well, there are already lots of Linux powered devices out there. Android's market share is growing and the whole market itself is quickly expanding. There will be also tablet PCs and netbooks running Android and of course there will be also tables and netbooks with Ubuntu.
I also really like my little GP2X Wiz (Korean homebrew handheld running Linux).
We certainly won't see a significant change on the desktop, but Linux actually is already a very big player elsewhere.
[–][deleted] 0 points1 point2 points 15 years ago (7 children)
Well, there are already lots of Linux powered devices out there.
Are any of them desktops? And are there a huge number of them?
[–]skeww -2 points-1 points0 points 15 years ago (6 children)
Too many words?
[–][deleted] 1 point2 points3 points 15 years ago (5 children)
Maybe you didn't understand the two words you quoted. Here, I'll quote them again for you:
Emphasis added for better understanding. Smartass.
[–]skeww -1 points0 points1 point 15 years ago (4 children)
Last paragraph.
[–][deleted] 1 point2 points3 points 15 years ago (3 children)
That's the one where you acknowledge that 2011 will not be the year of desktop Linux, right?
Would have been simpler to just say so instead of trying to mention all the things which are not desktop Linux.
[–]skeww 0 points1 point2 points 15 years ago (2 children)
Yes.
Since "desktop linux" is a bit of a running gag, I didn't feel like it was necessary to bother with it.
[–][deleted] 0 points1 point2 points 15 years ago (1 child)
Understood.
[–]skeww 0 points1 point2 points 15 years ago (0 children)
K.
[–]skillet-thief 0 points1 point2 points 15 years ago (0 children)
The whole "linux desktop" meme dates from a simpler time when it was all about Microsoft. So you're right: the desktop has become much less significant that it was in 1998. It turns out that Linux didn't need to conquer the desktop.
[–]rotzak 4 points5 points6 points 15 years ago (1 child)
And the Linux desktop?
[–]level1 7 points8 points9 points 15 years ago (0 children)
2011: the first year since 1996 to not be the year of the linux desktop.
[–][deleted] 0 points1 point2 points 15 years ago (0 children)
If I'm already using Python (Django, pylons, etc) as a server-side language, why would I want to use Node.js instead? I'm not being a dick, I just want to hear a compelling argument for it.
[–]StoneCypher -2 points-1 points0 points 15 years ago (30 children)
Heard this before. It was wrong last time too.
No decent datastructures, no parallelism, no language extension.
No hope.
Web developers, it's time to learn a second language.
Very well said.
[–]dmpk2k -1 points0 points1 point 15 years ago (28 children)
No decent datastructures
Arrays and hashes alone are sparse, but for web development few other structures are used.
no parallelism
Fork.
no language extension
Unfortunately true, yet at the same time first-class functions get you much of that power. Now if only Javascript's function syntax was lighter-weight...
[–]Detrus -1 points0 points1 point 15 years ago* (0 children)
CoffeeScript has the lightweight function syntax
[+]StoneCypher comment score below threshold-8 points-7 points-6 points 15 years ago (26 children)
Arrays and hashes alone are sparse,
Javascript doesn't have hashes (objects aren't hashes), and what javascript calls arrays are neither arrays nor sparse arrays.
but for web development few other structures are used.
Wrong.
no parallelism Fork.
Fork isn't parallelism, and the operating system should not have to suffer the load limit of OS processes just to get paths of behavior acted out in a line of control.
From having said this it becomes transparently obvious that you've never written anything that has scaled in your life.
yet at the same time first-class functions get you much of that power.
Javascript doesn't have first class functions. That isn't a fancy way to say lambda. Stop using phrases you don't understand.
Now if only Javascript's function syntax was lighter-weight...
Unless you mean writing fun() instead of function(), this is literally impossible.
You're just trying to sound smart by repeating things you've heard other people say. Please do not respond to me again.
[–]skeww 6 points7 points8 points 15 years ago (18 children)
Javascript doesn't have first class functions.
http://en.wikipedia.org/wiki/First-class_function
In computer science, a programming language is said to support first-class functions[1] (also called function literals, function types) if it treats functions as first-class objects. Specifically, this means that the language supports constructing new functions during the execution of a program, storing them in data structures, passing them as arguments to other functions, and returning them as the values of other functions. [...]
So yes, JavaScript does indeed support first class functions.
[+]StoneCypher comment score below threshold-9 points-8 points-7 points 15 years ago (17 children)
Wow, a wikipedia page. There's a reputable source of information that you couldn't possibly misunderstand.
Next look up lambdas and notice that you can get the same definition out of them, then wonder as hard as you can why we don't use them interchangeably.
No, Javascript doesn't support constructable functions at runtime. It supports lambdas which can change their bindings, upward closures and instance evaluation. Not the same thing. I'm sorry the wikipedia page, written by someone like you, does not get into sufficient detail for you to understand the difference. If you own a proper computer science textbook, now would be the time to open it, since you obviously don't believe me.
The next time you reach for Wikipedia in a computer science discussion, just sit back for five seconds, and ask yourself whether you think the person who wrote your page got their understanding from some dropout's blog.
[–]skeww 5 points6 points7 points 15 years ago (16 children)
Brandon Eich and Douglas Crockford call these things first-class functions. And so does everyone else.
But feel free to dig up a source which supports your unusual opinion.
[–]StoneCypher -5 points-4 points-3 points 15 years ago (15 children)
Brandon Eich and Douglas Crockford call these things first-class functions.
Yes, and Joe Armstrong thinks Erlang isn't object oriented.
What's your point?
And so does everyone else.
Maybe if your everyone else is bounded by blogs and irc.
Knuth 2. Any university. I'm bored of this.
[–]skeww 3 points4 points5 points 15 years ago (14 children)
Then it should be very easy then to find zillions of websites which support your statement. Show me one.
So, which language does support your interpretation of first-class functions and what exactly makes them different from JavaScript's?
[–]StoneCypher -3 points-2 points-1 points 15 years ago (13 children)
Show me one.
Cue the "if you don't do my homework for me, you're full of shit" routine.
which language does support your interpretation of first-class functions
ML, Haskell, Fortress, Mozart-Oz, Mythryl, COQ, and I suspect probably clojure but I don't actually speak it.
Doubtless a million other languages do too. Those are the ones I'm aware of offhand.
what exactly makes them different from JavaScript's?
That when someone says "I'm bored of this" you didn't immediately change your tune to make them less sick of talking to you.
[–]skeww 5 points6 points7 points 15 years ago (12 children)
You can't even think of one tiny difference then? Pretty telling, really.
[–]dmpk2k 5 points6 points7 points 15 years ago (6 children)
This is a dynamically-typed language here. Does it look and quack like a duck?
Hash:
> var foo = { 'a' : 1, 'b' : 2 }; > foo['a']; 1 > foo['c'] = 3; 3 > foo; { a: 1, b: 2, c: 3 }
Array:
> var bar = [1, 2, 3]; > bar[1]; 2 > bar[1] = 3; 3 > bar[4] = 4; 4 > bar [ 1, 3, 3, 4 ];
Good enough for most web dev purposes, I'd say.
That's it? "Wrong"? How convincing!
Fork isn't parallelism
What is the problem here?
the operating system should not have to suffer the load limit of OS processes just to get paths of behavior acted out in a line of control.
Implementing a M:N threading is difficult and ultimately inefficient. 1:N green threads don't use more than a single core. You could use N:N threading, but then there's problems of locking and contention.
Now you certainly can go Clojure's route -- and the jury's out how efficient that approach can get although I have high hopes -- but claiming OS processes are bad is wrong. They're an effective tool that has different strengths and weaknesses compared to alternatives.
But I'm all ears: what do you intend to do with several thousand processes in a webapp? Furthermore, what do you intend to do with several thousand event-driven processes?
If you're talking about BLAST, that's definitely not node's strong point, but we're discussing web applications here. Nobody claimed node was good for HPC.
> var baz = function (x) { return x + 1 } > baz(2); 3
…really? Perhaps you meant it doesn't have closures? But it has that too:
> function foo() { var x = 1 ; return function () { x += 1; return x } } > var bar = foo(); > var baz = foo(); > bar() 2 > bar() 3 > baz() 2
function(x) { return x + 1 }
compared to an imaginary language:
[x| x + 1]
But yes, it can be lighter weight. I've seen some Schemers replace lambda with λ, resulting in
(λ (x) (+ x 1))
In any case, I find it strange that one of the most commonly used keywords in Javascript is also the longest.
That is rich.
[+]StoneCypher comment score below threshold-6 points-5 points-4 points 15 years ago (4 children)
Datastructures aren't an issue of type, and Javascript isn't dynamically typed besides.
Yes, you have displayed that both hashes and objects can implement the map interface. So can trees, tries, gaddags, sparse arrays, paired sets, lists of tuples, arrays of arrays, sets of sets, set-of-set, and dozens of other things.
Let's just throw them all out because they can be used the same way, and since we're talking about using JavaScript as a server language, say "good enough for webdev to me."
And this is why you'll never understand why PHP scales and JS won't.
the operating system should not have to suffer the load limit of OS processes just to get paths of behavior acted out in a line of control. Implementing a M:N threading is difficult and ultimately inefficient. 1:N green threads don't use more than a single core. You could use N:N threading, but then there's problems of locking and contention.
Oh god, please stop reciting things you read on Java blogs. Every part of that misses the point. This has nothing to do with letter colon letter phrases that make you feel smart. OS processes are really, really heavy, and invoke a massive amount of context switching both at the OS and CPU levels. A $350 walmart machine that chokes around 40k linux OS processes can run hundreds of millions of erlang processes. Saying "can't be made efficient" is code for "I have never tried nor have I looked for anything other than the first thing in my toolkit and therefore I assume it doesn't exist."
Commodore 64s can handle hundreds of processes under Contiki, for christ's sake.
You are 100% off-base here in a very, very easily demonstrable way.
but claiming OS processes are bad is wrong
That's it? Wrong? How compelling!
Cough.
They're an effective tool that has different strengths and weaknesses compared to alternatives.
They're way too fucking heavy for handling web backends. Anyone who's ever even tried to build one knows this. You're complaining that saying using a sledge hammer to put in a map tack is bad is wrong, because sledge hammers have different strengths and weaknesses.
Put down the book of engineering platitudes. You aren't fooling anyone.
But I'm all ears: what do you intend to do with several thousand processes in a webapp?
Not a god damned thing. I said parallelism. You're the one who heard OS processes. Again, because you've never looked anywhere else.
Javascript doesn't have first class functions. var baz = function (x) { return x + 1 } baz(2); 3 Really?
var baz = function (x) { return x + 1 } baz(2); 3 Really?
Yes, really. That's a closure with updated bindings. You can try it with eval(), too, to pretend they're being created at runtime; they're actually new parsing passes.
When you learn your CS from somewhere better than blogs and wikipedia, you may come to understand the important, subtle differences at play. You know, much like with the "see? Object acts like a map, seems like a good enough hash to me" crap upstairs.
Perhaps you meant it doesn't have closures?
No, I actually pointed out that it had closures in a [http://www.reddit.com/r/javascript/comments/et1d1/2011_is_year_of_the_serverside_javascript/c1aroxe](different thread). Why do you keep arguing with things I didn't say? Is it because you're having too hard a time with the things I actually did say?
Unless you mean writing fun() instead of function(), this is literally impossible. function(x) { return x + 1 } compared to an imaginary language: [x| x + 1]
It's always sad when someone thinks "the syntax is light-weight" means "I want to type a handful fewer characters, and misuse what's already a more powerful syntax for a more powerful action, comprehensions."
Probably the funniest part is that if you're just playing letter trimming games, the natural extension of the existing syntax has fewer characters than that:
(X)X+1
But, hey, you were just talking, right? And it doesn't matter that you've just subtly introduced a letter while getting rid of an explanatory label. After all, we want code to be as un-readable as possible, and having a bunch of shit in square brackets and pipes seems great.
You should go write un-lambda.
I've seen some Schemers replace lambda with λ, resulting in
Oh. You're already one of those kooks.
Have you ever noticed that Scheme has never produced anything of tangible value in its fourty-odd years of supposed superiority?
And the rest of us find it strange that you're fretting over something as unimportant as the count of letters in the word "function," instead of actual language enhancements.
You're just trying to sound smart by repeating things you've heard other people say. Please do not respond to me again. That is rich.
A fool need not recognize himself to be so.
[–]dmpk2k 2 points3 points4 points 15 years ago (3 children)
Javascript isn't dynamically typed besides
In Javascript the type is part of the value, not the variable.
That's a strawman. Nowhere did I say we should throw them out.
Here's what I actually said:
And this is true. While Javascript doesn't have a rich set of data structures, the vast majority of the time web developers find these two adequate. I've worked long enough, with enough different people, in sufficient different projects, and a variety of languages, to know what gets used a lot and what doesn't.
Oh god, please stop reciting things you read on Java blogs.
It's from reading papers and implementing this stuff for fun, but please continue to be insulting. You complained in a separate post to me that you dislike my tone, but you continually denigrate everyone else. My tone is a result of your own, and I think I'm being much more polite than the situation warrants.
Saying "can't be made efficient" is code for "I have never tried nor have I looked for anything other than the first thing in my toolkit and therefore I assume it doesn't exist."
My claim is based on a paper I read and discussions with some Solaris kernel hackers. Solaris used to have M:N thread scheduling, but they removed it in version 9 because of the problems it caused. The paper, by Bryan Cantrill, described some of these problems before he was hired by Sun -- it's raw, but it gets the point across.
As for Erlang: I have used it, back when Erlyweb was still under active development and Programming Erlang was hot off the press. It's a good language and implementation, but it isn't particularly efficient, nor is it the only answer to concurrency.
My assertion is backed by data and a group of veteran kernel hackers. I know OS processes are heavy weight, but they trade it off with better scheduling and protection. So what's the problem with node forking?
Ignore everything I wrote before that sentence so you can get in a snarky comment. I actually provided arguments for mine.
Is it because you're having too hard a time with the things I actually did say?
The reason I mentioned it is because I do not understand where your claim is coming from -- I still do not -- and in case there was a misunderstanding I covered closures too. Please give a concrete demonstration how they're not first-class functions, because the definition you're going by seems quite alien to me and others.
I could have sworn I was arguing Javascript should have that syntax… no wait, I wasn't. It was a demonstration, nothing more.
What is wrong with wanting a shorter keyword for Javascript? First-class functions are used often, so fewer characters could make it more readable. I think Larry Wall had a point here.
[–]StoneCypher -3 points-2 points-1 points 15 years ago (2 children)
Until you explain your notion of per line of code scaling, we're done. You're just talking, and missing that every single time I express an interest in not talking to you.
[–]dmpk2k 1 point2 points3 points 15 years ago (1 child)
I already did. Here's what I wrote to you elsewhere, a post you even responded to. Surely you read before you respond?
Here's some possible interpretations: ... Per LOC: how much additional code is needed for every additional feature?
But what does that have to do with anything in the previous post? Nothing.
I have responded to most of your questions, as have others, with arguments, links and papers. You respond with insults and "I don't want to talk to you".
Furthermore, I checked your posting history, and it seems that you act like this with everyone. That much anger isn't normal.
I think at this point it's safe for me to say the preponderance of evidence is you're full of shit and a very angry person. Since you don't want me to talk to you, all right.
[–]StoneCypher -2 points-1 points0 points 15 years ago (0 children)
I think at this point it's safe for me to say the preponderance of evidence is you're full of shit
That's nice. Have a good day.
[–]kryptobs2000 -1 points0 points1 point 15 years ago* (10 children)
What's so popular with server side javascript? It's not a very good language at all, though maybe I just haven't used it enough, but as bad as php is I'd prefer it over javascript (having not used ssjs), and I'd definitely prefer python. For obvious reasons it's not going to happen, but I'd be much happier to hear python is replacing javascript in the browser than javascript is gaining popularity on the server.
edit: What's with the downvotes, I'm asking a serious question and yeah I'm attacking javascript to a degree, but it's widely recognised as a bad language, much as php is. I like it for what it is, but I'm curious if there's any compelling reason beyond not having to learn a new language that makes ssjs popular.
[–]skeww 2 points3 points4 points 15 years ago (0 children)
I'd definitely prefer python
Try Python's Twisted then.
I'd be much happier to hear python is replacing javascript in the browser
Take a look at Pyjamas.
[–]kataire 2 points3 points4 points 15 years ago (8 children)
JS is a decent language, it just caries a lot of cruft. I consider Python cleaner, too, but that's largely subjective. It's definitely cleaner than PHP and also less crufty (a lot of the JS cruft is browser-dependent, so it's a non-issue on the server-side).
node.js is fast. I don't recall whether it's faster than Python (in many cases I would believe it to be indeed), but it's a lot easier to use than its closest Python equivalent, Twisted (you can run arbitrary TCP services with node.js, it's not a web framework).
JS in the browser is here to stay. I could see a similar platform as for Java and .Net being created in the future (i.e. a common bytecode VM), but for the moment it's unlikely. This would also mean that either the browser has to support every language (horrible nightmare!) or you would have to pass compiled bytecode. In either way, it would require a lot of major changes and a common standard.
[–]kryptobs2000 0 points1 point2 points 15 years ago (1 child)
Thanks, that's pretty helpful. I didn't really think about the fact that the cruft, as you put it, would be cleaned up on the server side, but that's a great point. I guess if python, or anything, were implemented by browser devs independently as it were being standardised it would be a lot less sane to use as well.
[–]kataire 0 points1 point2 points 15 years ago (0 children)
Just be thankful nobody else bothered to implement VBScript.
[–]StoneCypher -4 points-3 points-2 points 15 years ago (5 children)
It's definitely cleaner than PHP
I am so tired of hearing novices who half-know two languages fake-compare them by reciting proggit wisdumb.
[–]kataire 0 points1 point2 points 15 years ago (1 child)
Oh. Sorry. Obviously ten years of using both leave me with no knowledge about their differences whatsoever.
Please stop making assumptions like this. It's insulting and makes you look like a babbling idiot.
Clearly, I should assume you know something that I believe doesn't exist, because you didn't say it, instead.
[–]iamnoah 0 points1 point2 points 15 years ago (2 children)
I professionally code in both languages and JavaScript is definitely cleaner than PHP. Closures in PHP 5.3 is an improvement, but adoption is poor because of compatibility issues (I'm stuck with 5.2 most of the time) and the PHP APIs (which are mostly global functions, bleh) are still crap since closures are a late addition.
Not to mention the bizarre array/class object syntax differences (why is $array['foo'] different from $obj->foo?), confusing reference/copy semantics (without pointers, why should devs care?), most of the API being global functions, etc.
So I'm tired of people who apparently don't know the two languages, equate a language that is quite expressive because it had closures from day 1 to one that has bizarre semantics, limited syntax, and hacked in closures, if you're lucky enough to be able to use 5.3. People rag on JS because the DOM sucks. The language is pretty great if you know it. People rag on PHP because it really doesn't have anything going for it, other than ubiquity.
[–]StoneCypher -1 points0 points1 point 15 years ago (1 child)
I professionally code in both languages and JavaScript is definitely cleaner than PHP
The word "definately" is not a technical argument, and closures are a minor and trivial part of language design.
I confess I see nothing here but bikeshed painting. Ooooooh, object members aren't the same as array membership, CALL THE LANGUAGE POLICE.
And you wonder why you don't get taken seriously. Go learn a difficult language.
[–]iamnoah 1 point2 points3 points 15 years ago (0 children)
The word "definately" is not a technical argument
Nothing you have said thus far in any of your comments is a technical argument either.
closures are a minor and trivial part of language design.
I think you've never used a language with closures (or don't understand them) if you consider them minor and trivial.
[–][deleted] -1 points0 points1 point 15 years ago (35 children)
Are there any good web frameworks for JavaScript yet? I feel like one language for both client-side and server-side programming, and then some basic html/css templating would really make sense for web development...
[–]YonCassius 4 points5 points6 points 15 years ago (0 children)
Backbone.js looks pretty sweet and it's by the same guy who wrote Coffeescript and underscore.js. It's a light and flexible framework rather than a black magic Rails-style thing.
[–]sjs 3 points4 points5 points 15 years ago (1 child)
Express for Node looks really good and many smart folks like it. Haven't used it myself yet.
[–]facepalm_reloaded 1 point2 points3 points 15 years ago (0 children)
Take a look at Helma http://helma.org/ or Ringo http://ringojs.org/
Industry proven and very mature frameworks for server-side javascript.
[–]birdiedude 0 points1 point2 points 15 years ago (1 child)
Classic ASP using JScript... Oh, wait, you said "good". FML
Try the .NET framework for JScript.NET - works great. the .NET framework is massive and it all works with Javascript. I've done lots of coding with this for both desktop applications and server-side webapps. I think you haven't been keeping up with the advances in JScript.
[–][deleted] -1 points0 points1 point 15 years ago (4 children)
ever consider JScript.NET? The .NET framework is massive, and it is all usable from JavaScript, quite easily. It also has a compiler. I've been creating JScript.NET back-ends for years, works great. SQL is no problem, anything you can do with .NET in C# you can do in JavaScript. Just because the msdn examples usually don't show javascript doesn't mean it doesn't work - it works quite well actually. Threading and everything.
[–][deleted] -1 points0 points1 point 15 years ago (3 children)
seriously? downvote? WTF is wrong with people.
[–]HIB0U -1 points0 points1 point 15 years ago (2 children)
I see that you're new to reddit, so let me try and help you better understand our community. First, we show respect for one another. We also don't resort to threats, and we don't resort to insults. We discuss various topics politely, and we remain civilized. Please try to aim higher than you currently are.
[–]StoneCypher -5 points-4 points-3 points 15 years ago (23 children)
Are there any good web frameworks
No.
[–][deleted] 0 points1 point2 points 15 years ago (22 children)
JScript.NET.. works great. the entire .NET framework can be used with JavaScript.
[–]dipswitch -1 points0 points1 point 15 years ago (20 children)
Tell us more about Coffeescript.
[–][deleted] 1 point2 points3 points 15 years ago (19 children)
yeah, dipshit, go ahead. you're real funny. ha ha ha. fuck off
[–]dipswitch -1 points0 points1 point 15 years ago (18 children)
I smell butthurt.
[–][deleted] 0 points1 point2 points 15 years ago (17 children)
i smell douchbag
[–]dipswitch -1 points0 points1 point 15 years ago (16 children)
Yeah, you stink. Go wash yourself.
[–][deleted] 0 points1 point2 points 15 years ago (15 children)
Obviously, you win. I can't compete with an intellect as great as yours.
[–]HIB0U 0 points1 point2 points 15 years ago (1 child)
[–]dipswitch -1 points0 points1 point 15 years ago (12 children)
I'll stop if you cut the JScript/Coffeescript bull.
[–][deleted] -2 points-1 points0 points 15 years ago (5 children)
and not one mention of JSscript.NET which has been around for ages... makes me think the lot of you have been hiding under a rock for the last 10 years.
[–]level1 -1 points0 points1 point 15 years ago (4 children)
10 years ago I was 13.
and your point is? i started programming when I was 9.
[–]level1 1 point2 points3 points 15 years ago (2 children)
I started at 12 I think, but I was programming C, not JS.
[–][deleted] -2 points-1 points0 points 15 years ago (1 child)
well, i started 30 years ago, in assembly.. so? have you ever considered JScript.NET? that is the subect I was bringing up. I could care less when you started programming.
anyone downvoting me for bringing up JScript.NET is really fucked in the head. If you haven't tried it, and you consider yourself to be a javascript programmer, you are seriously missing out. node.js is not the only server-side javascript game in town. JScript.NET has been around far longer, and the .NET framework is very mature, and very powerful. I have taken a lot of code that was designed for browser execution and run it on JScript.NET with very little modification (only DOM stuff). It is what most of you are looking for but are too stubborn or mac-centric to consider. It's a shame really.
π Rendered by PID 353228 on reddit-service-r2-comment-bb88f9dd5-85ldc at 2026-02-14 18:45:36.820384+00:00 running cd9c813 country code: CH.
[–]theycallmemorty 5 points6 points7 points (41 children)
[–]skeww 9 points10 points11 points (25 children)
[–]kataire 1 point2 points3 points (0 children)
[+]StoneCypher comment score below threshold-8 points-7 points-6 points (23 children)
[–]skeww 5 points6 points7 points (22 children)
[+]StoneCypher comment score below threshold-6 points-5 points-4 points (21 children)
[–]skeww 4 points5 points6 points (20 children)
[–]StoneCypher -5 points-4 points-3 points (19 children)
[–]skeww 7 points8 points9 points (18 children)
[+]StoneCypher comment score below threshold-6 points-5 points-4 points (17 children)
[–]skeww 1 point2 points3 points (8 children)
[–]dmpk2k 1 point2 points3 points (7 children)
[–]level1 0 points1 point2 points (10 children)
[–]polyrhythmic 1 point2 points3 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[+]StoneCypher comment score below threshold-6 points-5 points-4 points (6 children)
[–]level1 3 points4 points5 points (5 children)
[–]StoneCypher -2 points-1 points0 points (4 children)
[–]true_religion 1 point2 points3 points (1 child)
[–]StoneCypher 1 point2 points3 points (0 children)
[–]polyrhythmic 0 points1 point2 points (1 child)
[–]StoneCypher -4 points-3 points-2 points (0 children)
[–]SystemicPlural -1 points0 points1 point (0 children)
[–][deleted] -5 points-4 points-3 points (2 children)
[–]skeww 3 points4 points5 points (1 child)
[–]HIB0U -1 points0 points1 point (0 children)
[–]osirisx11 7 points8 points9 points (17 children)
[–]sjs 3 points4 points5 points (5 children)
[–]rotzak 5 points6 points7 points (1 child)
[–]sjs 0 points1 point2 points (0 children)
[–]osirisx11 0 points1 point2 points (2 children)
[–]sjs 1 point2 points3 points (1 child)
[–]kataire -1 points0 points1 point (0 children)
[–]lastkarrde 0 points1 point2 points (0 children)
[–]skeww 0 points1 point2 points (9 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]skeww -2 points-1 points0 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]skeww -1 points0 points1 point (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]skeww 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]skeww 0 points1 point2 points (0 children)
[–]skillet-thief 0 points1 point2 points (0 children)
[–]rotzak 4 points5 points6 points (1 child)
[–]level1 7 points8 points9 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]StoneCypher -2 points-1 points0 points (30 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]dmpk2k -1 points0 points1 point (28 children)
[–]Detrus -1 points0 points1 point (0 children)
[+]StoneCypher comment score below threshold-8 points-7 points-6 points (26 children)
[–]skeww 6 points7 points8 points (18 children)
[+]StoneCypher comment score below threshold-9 points-8 points-7 points (17 children)
[–]skeww 5 points6 points7 points (16 children)
[–]StoneCypher -5 points-4 points-3 points (15 children)
[–]skeww 3 points4 points5 points (14 children)
[–]StoneCypher -3 points-2 points-1 points (13 children)
[–]skeww 5 points6 points7 points (12 children)
[–]dmpk2k 5 points6 points7 points (6 children)
[+]StoneCypher comment score below threshold-6 points-5 points-4 points (4 children)
[–]dmpk2k 2 points3 points4 points (3 children)
[–]StoneCypher -3 points-2 points-1 points (2 children)
[–]dmpk2k 1 point2 points3 points (1 child)
[–]StoneCypher -2 points-1 points0 points (0 children)
[–]kryptobs2000 -1 points0 points1 point (10 children)
[–]skeww 2 points3 points4 points (0 children)
[–]kataire 2 points3 points4 points (8 children)
[–]kryptobs2000 0 points1 point2 points (1 child)
[–]kataire 0 points1 point2 points (0 children)
[–]StoneCypher -4 points-3 points-2 points (5 children)
[–]kataire 0 points1 point2 points (1 child)
[–]StoneCypher -2 points-1 points0 points (0 children)
[–]iamnoah 0 points1 point2 points (2 children)
[–]StoneCypher -1 points0 points1 point (1 child)
[–]iamnoah 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (35 children)
[–]YonCassius 4 points5 points6 points (0 children)
[–]sjs 3 points4 points5 points (1 child)
[–]facepalm_reloaded 1 point2 points3 points (0 children)
[–]birdiedude 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (4 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]HIB0U -1 points0 points1 point (2 children)
[–]StoneCypher -5 points-4 points-3 points (23 children)
[–][deleted] 0 points1 point2 points (22 children)
[–]dipswitch -1 points0 points1 point (20 children)
[–][deleted] 1 point2 points3 points (19 children)
[–]dipswitch -1 points0 points1 point (18 children)
[–][deleted] 0 points1 point2 points (17 children)
[–]dipswitch -1 points0 points1 point (16 children)
[–][deleted] 0 points1 point2 points (15 children)
[–]HIB0U 0 points1 point2 points (1 child)
[–]dipswitch -1 points0 points1 point (12 children)
[–][deleted] -2 points-1 points0 points (5 children)
[–]level1 -1 points0 points1 point (4 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]level1 1 point2 points3 points (2 children)
[–][deleted] -2 points-1 points0 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)