[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

JavaScript

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 144
Thread images: 8

File: js.png (293KB, 1052x1052px) Image search: [Google]
js.png
293KB, 1052x1052px
JavaScript is the first lambda language to go mainstream.
JavaScript has more in common with Lisp and Scheme than with Java.
JavaScript is Lisp in C's clothing.
>>
>>56970533
Sort of true, yeah.
>>
>>56970533
JavaScript is shit.
>>
As a C programmer, JS is painful as hell to work with.
>>
>>56970533
Meme
>>
>Javascript has dynamic typing and functions as first-class objects
>It must be LISP lol

http://journal.stuffwithstuff.com/2013/07/18/javascript-isnt-scheme/
>>
>>56970533
>JavaScript is the first lambda language to go mainstream.
Python, Perl, Lua all have lambdas and came out before JS
>>
>>56970613
as a c programmer, which scripting language isn't a nightmare?
>>
>>56970684
>literally not a single substantial argument
>>
>>56970753
Perl
>>
>>56970823
ok grandpa
>>
Screwdriver is the first hammer to go mainstream.
Screwdriver has more in common with chisel and drill than with shovel.
Screwdriver is chisel in knife's clothing.
>>
>>56970753
python always is a dream
>>
Friendly reminder that Brendan Eich invented ECMAScript while trying to create a Scheme for browsers.

>>56970613
>as an imperative pleb, functional is painful as hell to work with
FTFY
>>
JavaScript has the most straightforward async API with good performance relative to other scripting languages.
>>
JavaScript

>glorious objects everywhere
>sane inheritance model
>superior to classes
>beautiful json
>easy cheesy lambdas
>easy cheesy lambdas as arguments
>promises neatly eliminate callback issues in a manner true to the style of the language

How I love thee
>>
>>56971063
wut? js is about as imperative as it comes
>>
>>56971069
And the most convoluted blocking api you'll ever see, and blocking is what you want 90% of the time when writing scripts.
>>
>>56971063

Functional programming actually requires more planning than imperative programming and it is less resistant to requirement changes.
>>
>>56970533

> C's clothing

explain
>>
>>56971147
>functions are first class citizens
>prototype-based objects
>standard library consists of higher-order functions
>>
>>56970785
>didn't even read the article
>I'll just say that there's nothing there, nobody verifies their sources anyway lol

Try again, sir.
>>
>>56971207

Incomplete higher-order functions when compared to languages like Haskell.
>>
>>56971148

You can use promises and in the next iteration of JavaScript, you can use async / await.
>>
>>56971244
>muh copy on pass immutability
>muh monads
Please

Why do Haskell fags have to be so obnoxious? Why can't they celebrate that functional programming is making its way into multiparadigm languages and be happy about it?

You guys are true code nazis with your constant nagging about how (racially) impure other languages are.
>>
Reminder that Haskellfags are actually proud about their language being useless
>>
>>56971207
>>56971147
cont'd
>currying
>partial application (partial bind)
>repl
>>
I lose respect for anyone who actually recommends writing JavaScript.

After using it for a while it becomes almost enjoyable but it's bit like how you start to miss your dad's cock after he is arrested.
>>
>>56970552
The only people who complain about JS are those too dumb to understand prototypal inheritance. It's actually orders of magnitude more flexible than traditional OO. Also, first class functions are so good that most C family languages are adopting it now.
>>
>>56971319
>i have strong opinions about stuff that have zero practical implications whatsoever
Autism / 10
>>
>>56970533
>JavaScript a lambayy lisp-lite
>>
>>56971319
Yes, I have no respect for anyone who bad mouths JavaScript either. It just shows that you're unable to take initiative in ordering your own well formed structure and organisation.

JS is great in the hands of great developers but mediocre developers need extreme hand-holding to produce anything beyond garbage. Disdain for JS just displays thoughtless coders who can follow predefined patterns only.
>>
>>56971334

There is no parametric polymorphism in JavaScript. How does that not make you upset?
>>
>>56971319
Literally name one problem you have with JavaScript.
>>
>>56970684
You beat me to it.
>If that’s [JavaScript is basically Scheme is] true, then C#, Lua, D, Erlang, Haskell, PHP, Scala, Go, Objective-C, Python, Ruby, and Smalltalk are basically Scheme. In other words, if JavaScript is Scheme by that criteria, then every language is Scheme, which of course means none of them are.
>>
>>56971382
It's dynamically duck typed. Generic programming doesn't make any sense in that context. Stop being autistic.
>>
>>56971268
The goal was to be good, not popular. JavaScript is to functional programming what Java is to object oriented programming.
>>
>>56971382
What? JavaScript would never need this feature because it doesn't have type safety.
>>
>>56971380

Once your code base becomes large enough and your familiarity with your own code weakens, you will understand why stricter languages help you write more reliable code in the long term.
>>
>>56971387
It's not Scheme :^)
>>
>>56971387
too popular
>>
Yall postan in a troll thread.
>>
>>56971417
So obnoxious and strict to the paradigm?

I personally think Haskell is to FP what Java is to OOP.
>>
>>56971428
>he doesn't rely on extensive automated testing
It's like you don't program for a living... Oh wait, this is /g/ after all.
>>
>>56971428
JavaScript has all the tools to be manageable no matter how large the project. It just requires discipline because good structure isn't enforced.
>>
>>56971380
>JS is great in the hands of great developers but mediocre developers need extreme hand-holding to produce anything beyond garbage.
So, like every language?

>Literally name one problem you have with JavaScript.
Type coercion, duck typing, and PHP level stupidity with equality. It's not that bad, but it's hated because the JSL (JavaScript as a Single Language) fuckers keep pushing it places it was never meant to be. Only the insane, underage, or ignorant would want to program microcontrollers or servers with JavaScript.
>>
File: eichmannmiun.jpg (2MB, 6720x4405px) Image search: [Google]
eichmannmiun.jpg
2MB, 6720x4405px
>>
>>56971464
Guess what? Assembly has all the tools to be manageable no matter how large the project. It just requires discipline because good structure isn't enforced. Everything closer to the machine than JavaScript is masochistic and everything closer to the ivory tower is memes. You are a blub programmer.

>>56971439
Java is nothing like SmallTalk.
>>
>>56971502
I never have issues with equality and it allows for some awesome shorthand hacks. Maybe you just need to step up your game?

>Only the insane, underage, or ignorant would want to program microcontrollers or servers with JavaScript.
t. someone who has never used Node

Fuck your bulky, convoluted backend architecture.
>>
File: you3.png (461KB, 870x722px) Image search: [Google]
you3.png
461KB, 870x722px
>>56971551
Here you go.
>>
>>56971541
>everything closer to the ivory tower is memes
>Haskell is a meme
For you.
>>
>>56971541
>Java is nothing like SmallTalk.
Smalltalk is nothing like Simula 67
>>
>>56971464

Any language requires discipline to write clean code.

Type systems help you understand code by naming invariants. This reduces cognitive load when reading and increases cognitive load when writing.
>>
>>56971610
Some editors and plugins can do type inference on the fly. Literally no reason for it to be in code.
>>
>>56971610
>what are sensible variable names
Hungarian notation exists for a reason.

Also, type interference is a thing you know and many IDEs and editors do that on the fly.
>>
>>56971575

Monad transformers are not efficient.
All IO is wrapped by some kind of a monad.
Composable IO is not efficient.
>>
>>56971663
But it's pure
>>
>>56971656
>Hungarian notation
>Why support types on variables when I can just add them to the name and have the interpreter completely fucking ignore me.

How many flavor-of-the-week js backend frameworks do I need to hop between before this kind of brain damage sets in?
>>
>>56971685
>But it's pure
1) No one cares.

2) The "but only the runtime is tainted, the code remains pure" is some insanity level mental gymnastics you'd have to come to terms with in order to accept Haskell's definition of "pure".
>>
Why not TypeScript?
>>
>>56971701
By all means, ignore my post completely and focus only on that.

Also, this: >>56971710
>>
>>56971551
Node is absolute dogshit
>>
>>56971610
>>56971634
>>56971656
>>56971701

TypeScript. See >>56971710
>>
>>56971709
>2) The "but only the runtime is tainted, the code remains pure" is some insanity level mental gymnastics you'd have to come to terms with in order to accept Haskell's definition of "pure".
So much this.

There's a reason why the joke is that the as soon as you understand monads you immediately lose the capability to explain them.
>>
>>56971763

TypeScript has no parametric polymorphism.
>>
>>56971763
It's tainted by Microsoft.

>>56971783
>muh generic programming buzzword memes
>>
>>56971783
T. AutismMcBuzzword
>>
Why do retards think having functions in a language make it a 'functional language'
>>
>>56971796
>>56971815

But muh

function myFunc(myObject: myType1) {}
function myFunc(myObject: myType2) {}
>>
>>56971831
Literally nobody ITT said that, now fuck off.
>>
File: coffee.png (717KB, 1303x848px) Image search: [Google]
coffee.png
717KB, 1303x848px
>>56971710
>>56971763
It looks disgusting, the syntax doesn't even match the JavaScript style in a lot of places despite the promise of "backwards compatibility", it always needs to be built.

If I'm going to use a language on top of JS, it's Coffeescript any single day of the week. Literally the most aesthetically pleasing syntax ever devised by mankind.
>>
>>56971831
Because that's what 'functional language' means.
>>
>>56971831

Why do retards think a 'functional language' is well defined and universally agreed on?
>>
>>56971841
http://pastebin.com/XcczWLZA
>>
>>56971855

Look at all those implicit contracts. How do you even know whats happening?
>>
File: coffeescript code.png (15KB, 339x369px) Image search: [Google]
coffeescript code.png
15KB, 339x369px
>>56971855
Not my code by the way. Just grabbed off jewgle images. I have CS projects open now but I'm not posting it here.
>>
>>56971855
significant white space?
>>
>>56971551
There are dozens of jokes about how much javascript type system and through that equality sucks. Hell, there is a language based on how much it sucks. Also those "awesome shorthand hacks" will lead to shitty spaghetti code and every experienced dev hates them. Also node is overrated shit that is only good for quick prototyping and should be kept away from any serious project.
>>
>>56971855
>muh syntax

Coffeescript is the most frivolous "language" with an active userbase ever and does nothing to improve on javascript's many semantic and fundamental design faults.
>>
>>56971855
Probably a good thing given that JS' syntax looks like dogshit
>>
>>56971866
> if (typeof(value) != 'string')

Why should I have to do this and why do people accept this?
>>
>>56971888
Everyone should already be keeping a consistent indentation level, so why do we need {}? They literally do nothing. Also, those hilarious times when you have 8 closing } and you don't know which one is which. Finally, {} just look like shit.

>>56971894
>implying JavaScript needs improvement beyond syntax

Coffescript JSON =

property: value
other: value

No retarded commas to shift around/forget. The absolute minimum characters needed to assign a value to a key. Find a fucking flaw.
>>
>>56971958
What's wrong with it?
>>
>>56971958
>Why should I have to do this and why do people accept this?
You don't have to do this, you just create the maybe once and then it's done.
>>
>>56971970

CoffeeScript doesn't simplify JavaScript enough to spin off an entirely new language.
CoffeeScript will eventually diverge (if not already) from the JavaScript spec, rendering it incompatible with the new JavaScript standards.
The CoffeeScript community has a large percentage of vocal, influential SJW types.
>>
>>56971978
Nothing, although a bit obtuse and unnecessary, it's a good example of how JS can be considered functional. Anon is just being deliberately anal because he's parroting some opinion about dynamic typing he read on comp.lang.c once.
>>
>>56971983

Types should be checked at compile time whenever possible.

Why would you want to get runtime exceptions for types that don't match the intended signature?
>>
>>56972026
>CoffeeScript doesn't simplify JavaScript enough to spin off an entirely new language.
Yeah because my projects which now have 20% the number of lines and a billion times less visual clutter were totally not worth converting.

>CoffeeScript will eventually diverge (if not already) from the JavaScript spec, rendering it incompatible with the new JavaScript standards.
No, it doesn't. It's just a better way to write JavaScript.

>The CoffeeScript community has a large percentage of vocal, influential SJW types.
Not an argument.
>>
>>56972030
>it's a good example of how JS can be considered functional.

What does pointless runtime introspection and string comparison to determine a variable's type have to do with being functional?
>>
>>56972070
>What does pointless runtime introspection and string comparison to determine a variable's type have to do with being functional?
That's not all that code does, you imbecile.
>>
>>56972095
> if (typeof(value) != 'string')

If that does anything else, it's the finest obfuscation I've ever read and all the more reason to avoid JavaScript.
>>
>>56972070
>maybe monad in JS
>hurr durr it's not functional enough muh immutability muh type inference muh strong typing muh parametric polymorphism

Why are Haskellfags so obnoxious?
>>
>>56972120
because we're the best
>>
>>56972111
See >>56972120

Also, it doesn't check if it's a string you retard. It checks if it's a number.
>>
>>56972141
I said it was doing string comparison, not "checking if it's a string".

Holy shit, reading comprehension.
>>
>>56972178
>this is how you implement a maybe monad in JS
>HURR DURR IT'S MERELY AN OBFUSCATED STRING COMPARISON WHY WOULD I DO THAT????!!!!!!!!

The Dunning-Kreuger is strong in this one.
>>
>>56972215
The whole past sequence of seven replies is concerning a single line of code. Again, reading comprehension.

>Dunning-Kreuger

Of all of reddit's memes I love this one the most, especially how it's always the wrong people using it.
>>
>>56972267
>The whole past sequence of seven replies is concerning a single line of code. Again, reading comprehension.
No, YOU are having an autistic fit based on a single line of code and failing to understand what the code even does.

You asked how JavaScript was functional and as the original comment pointed out, it's an example of how you implement a maybe monad in JavaScript.

You realised your cheap rhetoric failed and now you are backpedalling like crazy on the whole static vs dynamic typing thing.

Please, stop embarrassing yourself any further.
>>
>>56972068

You may have simplified your source code in terms of LOC at the added cost of compilation (transpilation) time.

The coffeescript class is not the same as an ES6 class for instance.

The community being SJW types is an argument if you have to work with those types of people. Of course, if you fit in, this is not a con.
>>
>>56972301
lol

>No, YOU are having an autistic fit based on a single line of code and failing to understand what the code even does.
>You asked how JavaScript was functional and as the original comment pointed out, it's an example of how you implement a maybe monad in JavaScript.

Calm down you sperg. Neither of those were me.
>>
>>56972322
>le "wasnt me" shaggy defence epic meme
>>
>>56972322
>Neither of those were me.
Suuuure
>>
Does /g/ prefer dynamic typing or static typing?
>>
File: op.jpg (191KB, 1484x1738px) Image search: [Google]
op.jpg
191KB, 1484x1738px
op
>>
>>56972305
>You may have simplified your source code in terms of LOC at the added cost of compilation (transpilation) time.
Guess we should all just write assembly in binary, since it has no compilation time.
>>
File: just_let_it_go_autismo.png (460KB, 1382x3344px) Image search: [Google]
just_let_it_go_autismo.png
460KB, 1382x3344px
>>56972340
>>56972362

epic
>>
>>56972370
Both have their advantages and disadvantages.

I think static comes out on top for larger projects.
>>
>>56972436

Remember: Your boss wants results fast.

So you should keep choosing greenfield projects with dynamic languages and leave the maintenance to the Pajeets.
>>
>>56972460
>writing code that needs maintenance
Might as well be a pajeet
>>
>writing code
might as well be a pajeet
>>
>>56971656
There are still people who defend Hungarian notation? What's this, 1996?
>>
>>56970533
The funniest/weirdest part is that all the major complaints about JS apply equally well to Scheme (regardless of whether you trust that the designer and creator of JavaScript, a Scheme programmer, was telling the truth when he said he wanted JS to be a Scheme that was palatable to already-existing programmers), and Scheme would have had them too if it got to JS's level of popularity and use.
>no large standard library leads to proliferation of tiny competing libraries
>too many new frameworks and implementations because there's no standard way of doing things
>problems with package dependency and managers
>ambiguities in how nil, true, false, and empty lists are handled
>very easy to program very badly in
etc. etc. But everyone on /g/ will mindlessly circlejerk Scheme and shit on JS, often for the same things they love in Scheme (having a tiny standard library is minimalist and beautiful in Scheme, but obnoxious and requires pulling in dozens of left-pad-esque dependencies in JS!). Oh well.

t., a Scheme programmer.
>>
>>56972609
There isn't any rhyme or reason to JavaScript hatred. It's all post facto. It's basically hated because it's associated with everything web-oriented
>>
>>56970533
But... Where are the macros? Where is the inmutability? TCO?

Higher order functions does not a scheme make.
>>
>>56971030
this
>>
>>56971148
You're thinking imperatively when it comes to browser JS. Understanding the JS "cycle" loop is really key.

When it comes to server side node js; ie reading files, it is horrible and introducing promises makes it an un-maintainable mess.
>>
>>56971663
>discussing efficiency in a javascript thread
>>
>>56972709
Node has a perfectly fine synchronous api.
>>
>>56972609
LISP sucks for at least some the same reasons JavaScript does, though its type coercion rules aren't nearly as bad. ML family languages are superior functional languages in any case.

>>56972636
> It's all post facto.

I guess the "factum" referred here is actually using it. People hate it because outside of not-quite-there-yet technologies like compile to js and source-mapped languages we're forced to cope with this garbage, and anyone with experience in other languages apart from toy 90s scripting languages can see how terrible it is by comparison. The "you're just memeing and you just don't get it" defense is better saved for PHP or Java.
>>
>>56972709

Try RxJS.
>>
File: conrad_barskis_final_form1.jpg (5KB, 256x150px) Image search: [Google]
conrad_barskis_final_form1.jpg
5KB, 256x150px
>>56972460
>Your boss wants results fast.
Not every job is the same, Anon.
>the Franz Inc sales staff and their engineers have related to me in the past, and I'm sure I'm not misrepresenting them now, that they see extremely little business value in catering to people who mainly execute really tiny programs like the null program or "hello, world" programs. rather, they have told me, and I have reason to believe them, that their main customers use Common Lisp in large-scale applications. their pricing model, licensing terms, and their Value Added Reseller programs all work very well together to indicate to me that they regard themselves somewhat like Oracle, which also provides a huge environment that people mainly use to deploy Really Important Applications, not somewhat like Larry Wall and the Perl team, who provide a large fuzzy toy environment that people mainly use to deploy Really Unimportant Applications.
>catering to the RUA people is antithetical to doing business well with the RIA people. everybody in the computer business _knows_ this, except the RUA people, but they don't _actually_ count, even though they think they do. for some bizarre reason, RUA people think their RUAs grow into RIAs when in fact they don't. vast networks of half-cooperating RUAs are actually reimplemented by RIA people into a much smaller and leaner RIA than the RUA people could ever hope to realize when push comes to shove.
>RUA people can graduate into RIA people if they first learn to dispense with the notion that RUAs _matter_. they don't. really. nobody is interested in how many RUAs you have written when they are looking for people to write RIAs. and I _mean_ nobody. RIA people need to show their ability to deal with complexity by reducing problems by solving the really big problems.
>>
Does scheme have asynchronous file IO and a standard HTTP client with an asynchronous API?

If so, sign me up.
>>
>>56972636
This. JavaScript is actually pretty damn good considering the constraints it was up against. What other language has had to compete with a bunch of different companies trying to bastardise it in different directions, yet somehow remained consistent?
>>
>>56972999

C++
>>
>>56972738
>anyone with experience in other languages apart from toy 90s scripting languages can see how terrible it is by comparison
I've been writing C# professionally for almost 10 years and I prefer JavaScript.
>>
>>56972999
Common Lisp
>>
>>56973005
>C++
>Consistent
pick one
>>
>>56973025

That's a sign of laziness.
>>
>>56972609
Oh yeah, don't want to forget dynamic typing, interpreted vs. compiled, and other complaints.
>>
>>56973092
Scheme has compilers.
>>
>>56973129
Did you read the post I was responding to? I'm not saying it doesn't, I'm saying it primarily being interpreter/REPL-focused (especially for development) is seen as a plus for scheme and a detriment for JavaScript.
>>
>>56973052
Explain. I just think it's a nicer language. So what if it has less features?
>>
>>56973029
As a Lisp programmer, I don't think Common Lisp suffered Design-by-Committee very well at all. There's a shit ton of extraneous parts and bad-naming that leads to weird conceptual conflicts but was necessary in order to satisfy lowest-common-denominator needs among competing implementations and companies that just don't exist anymore. e.g., setq, set, setf; ldiff & tailp, every way to access a container is completely differently named despite all of them doing conceptually the same thing and being implemented similarly, etc. Common Lisp is a good language, and I have no doubt it's a better language than JavaScript, but saying it did a better job at remaining consistent in the face of competing interests, directions, and companies is definitely inaccurate.
>>
>>56973251
considering the variety of competing LISP implementations I think it's impressive the language survived standardization-by-comittee as well as it did, but you're right, it shows.
>>
>>56973251
>>56973309
The self hating lisper is a meme at this point. Common Lisp is fine.
>>
>>56971274
>tfw being paid by a very famous and well-paying company to write Haskell on my day job

Feels good to be one of the chosen ones.
>>
>>56973837
I get paid more than you do to write Javascript.
>>
>>56973926
Checking my paycheck, I'm pretty pretty sure you don't.
>>
>>56973951
Checking my paycheck, I'm pretty sure that I do.
>>
>>56973837
Nice. I'd love to work in Haskell some day. You are living the dream
>>
>>56973987
No matter how much money I claim to make you're going to say you make more because this is the Internet, however I'll let you know I make more than $150k/yr + stocks (which is much much more). :) Feel free to claim you make more if that makes you sleep better at night.

>>56973995
It's not all rosey though, Haskell has a lot of issues still. We just spent a massive chunk of the current year debugging and tracing our code to find out all memory leaks and inefficiencies because it turns out it didn't scale as much as we thought it would. Lots of pains from the laziness of the language, unfortunately.
>>
>>56974013
I made more than that when I was a part time Wendy's chef during my high school years.
>>
>>56974023
Figured :)
>>
>>56973832
I don't know why you think I'm a self-hating lisper. I like programming in lisp. I just disagreed with him and showed some arguments why.
Thread posts: 144
Thread images: 8


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.