The World Wide Web Sucks - Lunduke

Everything is just bit patterns in the end, doesn't mean that we all should treat em like that. High level programming languages should help programmers detect errors and warn them when they did something wack.

Agreed.

Though things would be interesting if we never used languages besides Assembly.

Interesting for sure, but it would take a lot of time to develop software :slight_smile:

but it wouldn't be horrible software . :wink:

Depends who coded it in the end. Languages are just tools after all.

I think that if you are programming in assembly then you know what you're doing.

Unless you're Craig from North Korea.

ftfy

All languages have their qwerks - JS just has the craziest.

1 Like

Ok how about this awesome one: console.log(true/[12]); ... 0.08333333333333333

console.log(typeof(true)); .... boolean
console.log(typeof(1));....number
console.log([12]); .... object
console.log(typeof(true/[12]);...number

Also, wait a minute ... here's the real show stopper NaN (not a number) ...
...
...
console.log(typeof(NaN)) ... **number** .... WTF!?!?!?!

So... !(number) == number --- someone for the love of gosh please explain that one to me!

Witchcraft I tell ya!

@Dynamic_Gravity is spot on about what it's doing. JS must be "under the sheets" type converting true to the num 1 and then dividing it.

I........................................
LOVE...............................
THIS................................
GUY................................
lol

That's correct tho. NaN is a number. I know, sounds stupid, but since in JS all numbers are floats it uses the IEEE 754 standard:

NaN in this standard is a number which can't be represented because of the limitations of the system.


In C NAN is a float: http://www.cplusplus.com/reference/cmath/NAN/
In C++ std::nan is double: http://en.cppreference.com/w/cpp/numeric/math/nan
In C# Double.NaN is double: https://msdn.microsoft.com/en-us/library/system.double.nan(v=vs.110).aspx
In Rust std::f64::NAN is f64 aka double: https://doc.rust-lang.org/std/f64/constant.NAN.html
In Python it's too is float: https://docs.python.org/2/library/math.html#math.isnan

And so on...

I'm all for shitting on JS, but only where it's due :stuck_out_tongue:

1 Like

Nice! You learn something everyday!

I think a big contribution to the bloat of sites is that they are a commodity now. There are devs who's job is to push out sites for clients. From a business standpoint the faster these sites can be generated, the less they have to pay development costs. Here's where the frameworks come in.

It takes a lot of Jquery(JS) and CSS to make the following Bootstrap one liner
<button type="button" class="btn btn-primary">Primary</button> to become workable code in that framework. And then you have the overhead of more C++ and C in the browser's JS Engine to parse it. However, it sure beats having to have in house devs write bootstrapping code or all the JS and CSS required to make that work.

Furthermore, like @Dynamic_Gravity was saying, more and more of site/application processing is taking place on the client and not on the server. The more processing pushed onto the clients CPU is less clock time on our servers, which keeps cost down and availability up. This leads to even more JS being piled into site code and pressure on the browser devs to improve JS parse time - adding more C and C++ to their code bases. That means local machines need better more memory and better hardware.

And seriously, what he was taking about is like 10% of the code needed to make sites like CNN run - he's not even counting all the CI, automated unit tests, build tools,and automated deployment code that keeps these sites running.

Honestly, it really comes down a paradigm shift from academic to the commoditization and commercialization of the web. Businesses want to keep costs down, they do this by cutting down labor costs in development time (frameworks), automation (devops), and reducing load on local resources by moving more processing to clients. This leads to more code overall, and more of it being pushed onto the client's memory by means of their browser and the pages they load.


Now more JS anomalies:

var a = [];
var b = [];
console.log(a == b);  ... false
console.log(a == !b); ... true

two object instances will never be equal, even if they contain same data at the moment:
This has a reason, since there may be, for example private variables within objects.

@cotton, remember how in C/C++ you do not compare arrays, you compare values stored within arrays. All an array is, is a structure with pointers to the next value in its sequence in memory. Arrays are one solid line of memory.

I feel like to understand what javascript actually does under the hood, one needs to know lower level languages.

And when you tack on a ! in front of anything is just flips the result around, so of course it would equal true :wink:

The first part makes sense:
console.log(a == b); ... false

This didn't:
console.log(a == !b); ... true

I was thinking more along the lines of this console.log(a != b) ... true

However, in the first instance console.log(a == !b) --- the ! evaluates entire right side of the comparison as a bool rather than the datatype the proceeds it.

Therefore, this is actually correct console.log(5 == !4) ... false

if (a == b) is a equal to b, its not so return false.
if (a == !b) we ask if a is equal to not b, which returns true.
different than (a != b).

No this is wrong, because this would mean that 5 = 4.
It evaluates if 5 is not 4, which, with some high mathematic skills, would be true. If it were false it would brake the world.

Hm, I can't think of a scenario right now where the notation would make a difference. Isn't "not equal to .." and "equal to not .." the same result?

Yes it you are comparing just the values, but when you compare objects this gets a little harry. I'm not sure how JS is handling that comparison.

Aaahhh ok yeah... that makes sense. When using a != b it's true when it's 2 completely different objects, with a == !b it could be an object from the same class with different properties or something like that right?

I've used this thing once and it's pretty cool.
...with 0.00 programming/webdev experience and I can still use it fine :smiley:
It creates really really fast webpages in a matter of seconds. I was blown away...

1 Like

I once had an idea to make a blog purely out of markdown files. Ofc one needs to parse them and spew HTML out.

I, ofc, ended up over-engineering it:

Now I migrated from PHP (coz PHP lol) to Django. But I wanna move to totally static pages now.

1 Like

I wean vivaldi takes up all 16GB of ram unless I close it and reopen it. It would be nice to have my 4mb browser back that I made :expressionless: