this post was submitted on 29 Jul 2024
115 points (97.5% liked)

Programming

17506 readers
32 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 3 months ago (3 children)

Also, the whole web ecosystem is ass. The hoops one has to jump through nowadays to do web development are absolutely batshit crazy.

I don't recall the experience being even equally pleasant in other languages, let alone better.

[–] [email protected] 12 points 3 months ago* (last edited 3 months ago) (2 children)

It definitely isn't in some circumstances.
Frankly I'd put C/C++ in a similar category when it comes to compilation.
Dealing with Make, CMake, linkage and all that can be a nightmare.
The ecosystem is a little bit better though in my opinion. If nothing else you get a proper standard library and don't have to rely on thousands of dependencies to get anything done... or you often roll your own if you are in C... which is meh.

I find Rust, C#, Go and anything slightly more modern to be a great or at least good experience.
Python as well if you use venv and your runtime and package versions align.

My point is, there is no perfect platform and ecosystem, but the web is generally regarded as one of the poorest.
I'm not saying someone can't enjoy working on web stuff, they most certainly can. But it is objectively overcomplicated.

[–] [email protected] 6 points 3 months ago (2 children)

I won't argue that the web is complicated, but a lot of that complexity comes from the necessity of supporting so many different environments that you can't control.

I'd also like to ask when the last time you used JS was-- we use one UI framework (Angular) but no lodash, jquery, etc. to provide library functionality. Everything's just built into JS now.

[–] [email protected] 4 points 3 months ago* (last edited 3 months ago) (1 children)

I can understand accounting for different environments. That's unfortunately unavoidable. But I found web framework developers in particular have a weird tendency of piling up ungodly amounts of abstractions just for the sake of it.

It's kind of a cultural problem in modern software development in general imo. It's not limited to web dev by any means, but it's particularly bad there because JS lends itself to it quite well.

[–] [email protected] 2 points 3 months ago (1 children)

I ❤️ abstraction. I'm an abstractionpilled layercel. I'm in my abstracting era.

[–] [email protected] 6 points 3 months ago (1 children)

Ah that's fine. There's nothing wrong with abstraction, until it becomes too much.

[–] [email protected] 4 points 3 months ago (1 children)

Day 43. My tech stack has breached the clouds. I can no longer see the ground. I fear that I will not be able to return to the surface.

[–] sukhmel 3 points 3 months ago (1 children)

You will not, indeed, it's going to be abstractions all the way down from now on

[–] [email protected] 3 points 3 months ago (1 children)

WittyResponseFactoryBuilder.setTone('lighthearted').build().createResponse().send()

[–] [email protected] 2 points 3 months ago (1 children)

There's a distinct lack of FactoryFactoryFactoryBuilders in this code snippet.
Clearly you have yet to reach true abstraction nirvana.

[–] [email protected] 1 points 3 months ago

Alas, I am but an instance, not yet a class

[–] [email protected] 2 points 3 months ago* (last edited 3 months ago) (1 children)

I had to go back to working with React just recently. I'm technically using TS, but the standard library is the same anyways. It hardly has everything imo.
It does have what it needs to interface with the browser, and quite a few -sometimes poorly thought out- facilities, but not much more.

Don't get me wrong, for a web scripting language it's plenty, but if one wants to use JS for stuff that isn't just putting a simple page on a screen, that's not enough.

Maybe you mean Node instead of JS?

[–] [email protected] 6 points 3 months ago (1 children)

What kind of standard library features are you looking for that don't exist?

[–] [email protected] -1 points 3 months ago (1 children)

Anything that isn't plain web browser stuff.

You can't write files without Node specific APIs.
You can't even do proper bitwise operations because everything's a float.
Binary serialization is a pain and proper deserialization in general is not enforced, even in TypeScript, because types are an illusion.
Up until recently there were no synchronization primitives, though now the idea of having them in JS seems terrifying.
There are no other data structures than arrays and maps, which are often not enough.

It's just not a language I'd use for anything more than... well... Scripting. But even though other, better solutions exist for cross platform development, people insist on using JS, so here we are.

[–] [email protected] 7 points 3 months ago (1 children)

You can’t write files without Node specific APIs.

You seem to be confused about what JS is. It's a high-level interpreted language. It's not C. Of course it can't open files. Can you imagine if any webpage could open files on your PC? This is like asking why Rust doesn't have a certain Blender shader node or Scratch block. The language fundamentally doesn't include those concepts directly. As an interpreted language, of course JS is going to access OS APIs through its host program. If the concern is that the APIs aren't standardized-- well, yeah, that's true. Although the basic stuff (file I/O) is included in runtimes directly.

You can’t even do proper bitwise operations because everything’s a float.

Is there something I'm missing here? Why would you expect to be able to do bitwise operations on floats and get a sensible value? And if you want to do integer bitwise operations... you still can? Just use integer values and the bitwise operators? If you're complaining that you can't be sure if a number is an integer, that's 1. a separate issue, bitwise operations still work fine, and 2. easily solved.

Binary serialization is a pain and proper deserialization in general is not enforced, even in TypeScript, because types are an illusion.

Have you looked at the bit arrays JS has now?

Up until recently there were no synchronization primitives, though now the idea of having them in JS seems terrifying.

Do you require multithreading for a language to be considered "good enough"? Why complain now that JS does have these abilities?

There are no other data structures than arrays and maps, which are often not enough.

This is patently false. JS has sets, maps (actual ones, not objects like you were referring to), etc. We're soon getting records and tuples. If you want to build a linked list in JS, you do it the exact same way as you would in any other language. Not that it would be very useful.

[–] [email protected] 1 points 3 months ago* (last edited 3 months ago) (1 children)

Is there something I'm missing here? Why would you expect to be able to do bitwise operations on floats and get a sensible value? And if you want to do integer bitwise operations... you still can? Just use integer values and the bitwise operators?

No that's my point. You can't, because there's no such thing as an integer value. It's all floats, always. They get casted to integers, the binary operation is done, then they get converted back to floats. That's a lossy process, so some binary operations with certain values are simply not possible and you get weird results. The max width of an integer you can store is 53 bits, the maximum addressable width is 32 bits for binary operations. That's wonky.

This is patently false. JS has sets, maps, etc...

Ah yes I forgot sets. But I don't think there's anything else? Last time I checked there were no binary trees, no proper (ring buffer) queues, no ordered sets, but I may be wrong on that. It's not enough imo for a proper standard library.

For everything else:

My point is that JS is an okay scripting language for the web. As I said, for that it's perfectly fine, though the frameworks are often lacking imo. But there is this tendency to use it to create backends, desktop applications and tooling. That's where the language falls apart, because it's not made for that. It needs to be more robust, well defined and fully featured to be used in those contexts, both in terms of JS itself, and its standard library. Same with TS.

You seem to be confused about what JS is. It's a high-level interpreted language. It's not C.

I know and that's the point. It's underspecified for things outside the web, so it's terrible for those use-cases. You can make it work for Node, but not for Bun or any other runtime. And even then, the experience is acceptable at best.

I personally would never use it for such use-cases, but people keep touting it and TS as these amazing general purpose languages you can do anything in. You can, but you really shouldn't.

[–] [email protected] 4 points 3 months ago

You can’t, because there’s no such thing as an integer value. It’s all floats, always.

But you can. Any number that precisely represents a 32-bit integer can be used with binary operations as if it was one, and there will be no loss of information or unexpected results. Is it weird that JS has no integer type, or that its max safe integer representation caps out at 2^53? Yes, but that's not the complaint you made. Binary operations work literally perfectly as expected for any inputs that have the appropriate type. Actual float values are truncated, which fits the language design.

Ah yes I forgot sets. But I don’t think there’s anything else? Last time I checked there were no binary trees, no proper queues, no ordered sets, but I may be wrong on that. It’s not enough imo for a proper standard library.

I'm sure you're aware of push, pop, shift, and unshift, which together can make a FIFO or FILO structure, or a more complicated one, from an array. If you're using TS you could create a semantic type that only allows a subset of these operations. I will concede that we have no tree type, although I'm not sure if that's standard in other languages? I haven't needed to use one myself.

Anyways, I won't fight you on JS being overused. I will say that it's flexible enough that it can be used in any way, even if it's not the greatest idea. Something like embedded programming or safety-related things shouldn't use JS. And as you keep mentioning, it wasn't made for low-level stuff, although it can do it. I don't think that's a requirement for a stdlib though.

[–] [email protected] 5 points 3 months ago

C# with the M$ echosystem sucks ass though. It's like at first wow nice language, now how do you do this or that basic stuff and it's just crap.

I want a Map. map map; ? Oh no ; Map map=new(); ???

Where are the destructors?

Etc.

I get the feeling it's too steered by the corporate and not enough open source.

[–] [email protected] 4 points 3 months ago

For all the hate PHP gets (or used to get) it's ecosystem is amazing. And so is the language and standard library itself for the most part. It still inherits some of the original issues, but a lot of work has been done to minimize them.

[–] [email protected] 3 points 3 months ago (1 children)

I think it probably could be, in Lisp. Like the one they used in early MIT computer labs (Scheme).

Many of the best ever known programmers came out of MIT computer labs, and for good reason.

[–] [email protected] 2 points 3 months ago (1 children)

Lisp on the web is a fascinating alt history scenario

[–] [email protected] 3 points 3 months ago

Yes. And I want academics online like Matt Parker to discuss it with me.