• 1 Post
  • 22 Comments
Joined 1 year ago
cake
Cake day: August 8th, 2023

help-circle











  • Yeah, JS always seemed like the red-headed stepchild of modern languages. I’d be curious to know if other ECMAScript languages like JScript are as, eh, “quirky”, suggesting that the ECMA spec is the source of the quirkiness, or if JavaScript itself is the one making silly decisions. Technically, I mostly work with Google’s AppScript when I use ECMAScript stuff, but I’m fairly certain AppsScript is based off of JavaScript instead of directly based on the ECMA spec, so I don’t think it’s separate enough for me to draw a conclusion there.


  • It doesn’t have to be the default to be built in, tho. It could be an overloaded function, having the “default” be the typical convert-to-string sorting, and an overloaded function that allows to specify a type.

    It’s just such a common thing, wanting to sort a list by different types, that I’m surprised there hasn’t been an official implementation added like this. I get that it a simple “fix” to make, but I just think that if it’s that simple yet kind of obscure (enough that people are still constantly asking about it) there should be an official implementation, rather than something you have build yourself.


  • Right, but you have to make that comparator yourself, it’s not a built-in part of the language. The only built-in comparator converts values to strings and compares them in code units orders.

    Also, that technically isnt type-safe, is it? If you threw a string or a NaN at that it would fail. As far as I knew, type safe means that a function can handle type errors itself, rather than throwing an exception. So in this case the function would automatically convert types if it was type-safe to prevent an unhandled exception.


  • I think the main shortcoming here is that there isnt a way to specify the type to sort as, instead you have to write the function to compare them as numbers yourself. If it’s such a simple implementation, why isn’t it officially implemented? Why isn’t there a sortAs() that takes two args, the input list, and a Type value? Check every element matches the type and then sort, otherwise return a Type Error.



  • What are 5 of the 1000 bad things Valve has specifically done for Linux gamers? 5 things that are on par with the (apparently) “one” good thing Valve did for Linux gamers, which is (I guess) create a gaming distro and distro-independent open-source compatibility layer that enables phenomenal performance, sometimes even better than running linux native code? A compatible layer co-developed by CodeWeavers, known for being one of, if not THE biggest contributor to Wine and the primary maintainer of the Wine project?


  • Usage % is kind of a misnomer, as it is specifying the amount of processor cycles are being used, rather than how much of the silicone in the hardware is being used. You can have a really inefficient and heavy operation that uses a tiny part of the hardware, but eats up every processor cycle, and have 100% usage with barely any thermal output or power draw. For example, writing a small script that reorganizes an extremely long list of items can use every processor cycle and bring the system to 100% usage, but it is only operating a small portion of algorithms on the processor and not actually using a lot of the hardware. So that 100% usage is likely accurate.

    This basically means that the game is rather unoptimized, or at least using heavy technologies that don’t use all the hardware but take a lot of time/effort to do.