[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]

I wish javascript had pointers

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: 31
Thread images: 2

File: js-logo.png (27KB, 512x512px) Image search: [Google]
js-logo.png
27KB, 512x512px
I wish javascript had pointers
>>
>>55088419
While I dont see the point and think you just want to use js as if it was c, I suppose more features can only be a good thing
>>
I wish js would've never existed or at least people stop abusing js for some stupid shit it wasnt made for
>>
asm.js is terrible and you should feel bad about your post
>>
>>55088419
>JS with pointers
>XSS will fuck your shit up like nothing else can
>>
I wish JavaScript wasn't a clusterfuck of terrible design decisions made in a hurry, which dominated the web thanks to nothing more but that hurry, and which after long years of being universally despised as a language is suddenly undergoing a revival among fucking hipster "artisans" as if it was the best invention ever.
>>
I wish javascript a quick death
>>
>>55088535
Please tell me what is wrong with JS as a language other than dynamic typing, which is a matter of preference.
>>
I wish Dart was still being developed towards the goal of replacing Javascript.

Now it's just something you write to convert to Javascript.
>>
>>55088553
Not him, but
>cancerous ecosystem
>prototyping
>poor performance
>>
>>55088553
- no block scoping
- global variables visible in every scope
- typeof null === 'object'
- typeof NaN === 'number'
- no real arrays
- 16-bit Unicode
- fucking semicolon insertion:
return
{
foo: 'bar'
};

is not the same as
return {
foo: 'bar'
};

The former returns undefined because JS "corrects" you by inserting ; after return without warning.

These are just a few from the top of my head, there's shitloads more.
>>
I wish js didn't exist for huge security reasons
>>
File: 1456131391075.jpg (15KB, 244x243px) Image search: [Google]
1456131391075.jpg
15KB, 244x243px
>>55088419
>tfw running chrome on windows that's on virtual machine runing in JavaScript of my firefox
>>
>>55088778
>no block scoping
added in ES6
>global variables visible in every scope
no shit, this is why they are globals. Use proper naming schemes and declare variables in their proper scopes.

Otherwise yeah it's pretty shitty and honestly a bitch to deal with. The scope of web apps is growing making it harder to maintain this shit. Now with Node all the server code runs in JS too. So finding and fixing errors is a nightmare.
>>
>>55088419
wat? even saying that shows a basic lack of understanding between machine compiled and scripted languages
>>
>Look ma, I know what pointers are!
>>
>>55089785
Difference is nil. Javascript _is_ compiled to machine code in some implementations, and adding the ability to use pointers to memory is a clear possibility in both interpreted and compiled environment. Adding the ability to work with pointers is as easy as taking a js interpreter and adding few hundred lines of code to it.
>>
Just use typescript you babies.
>>
>>55088419

I wish C had callback functions.


Oh wait, no I don't
>>
Can someone answer me this?:

People say that JavaScript is single-threaded, which is why callback hell is used so much. But if JS is single-threaded, how the hell can it be running code in two different places at once if you're using callbacks?
>>
>>55091701

DELETE THIS
>>
>>55093039
Nice bump, OP.
>>
>>55091701
Because there's an event loop. You never write a main method in JS, do you?
That's because the browser provides it for you.

What actually happens when you click on a button that has an event listener added? The click events gets pushed on an event queue. It's not processed directly. And the main javascript loop basically goes are there any events? If yes, handle the event. Otherwise, wait a little and check again later. I think CSS runs in the same thread, so things like hover effects won't work either while your JavaScript code is still busy.
That's why when you have long running tasks, it's best to split them up into chunks and then use something like setImmediate to continue later, so your UI keeps responding to user input.

While the JavaScript environment processes the callback from your event handler, it can not handle anything else in the background. No code but the code in your handler is executed. Events will still get pushed on the queue and they will be handled when your callback finally returns.

There are web workers now that actually do run in a separate thread, but they have limited communication with your main thread and no access to the window object (and thus no access the DOM).
Scrolling is now running in its own thread and in good browsers, CSS and Web-Animations (not primitive JS rAF style change ones) run in their own thread, too and can thus run even while the JS blocks.
>>
>>55088419
Fuck you you filthy bytefucker
>>
>>55093197
Great post Anon. Didn't expect to actually get a useful reply in this thread.

... I think, after reading that, I'm going to be okay with writing off JS as insanity, and staying far away from it.
>>
>>55093249
Why? This is a rather reasonable system. What part of it did you find confusing?
>>
>>55088419
Uhh pass by reference is a pointer for retards.
>>
I wish I could inline asm in javascript.
>>
>>55088778
>no real arrays
What?
>>
>>55088419
I use C++ over JS sometimes because I reach a point where I wish I had pointers in JS.
>>
>>55088778
alright
how is this a problem if you're not retarded?
so what?
so what?
what?
alright
works on my machineā„¢


go back to c/c++ you nerds
Thread posts: 31
Thread images: 2


[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.