There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Nerd02 , in Which side are you? Javascript or Typescript
@Nerd02@lemmy.basedcount.com avatar

I think there’s a positive coming from this competition, though. Apparently this infighting has re-lit the want for type annotations to be embedded in vanilla JS (ECMAScript proposal). I feel like this would be the ideal scenario: things working right out of the box without needing a compile step or additional tooling.

You can get as close as it gets to this experience by using alternative runtimes such as Deno or Bun, which have native TS support (meaning you can just execute a .ts file without having to transpile it), but of course as soon as you have to write code for a browser you are back in the middle ages.

o_d ,
@o_d@lemmygrad.ml avatar

Please this 🙏

TheCee ,
@TheCee@programming.dev avatar

That’s not a positive, though.

Depending on how it pans out, it’s either not useful enough. Who the hell doesn’t use namespaces or enums. Or - as

These constructs are not in the scope of this proposal, but could be added by separate TC39 proposals.

implies - a door opener to outsource TypeScripts problem unto other peoples and not to investing into improving WebAssembly. That’s just MS being lazy and making their problems other peoples problems.

I feel like this would be the ideal scenario: things working right out of the box without needing a compile step or additional tooling.

It’s just annotations. No proposed semantics of a type system which your browser could check on its own.

Phen ,

Who the hell doesn’t use namespaces or enums

Uhhh, typescript devs? Enums were useful once, but typescript evolved everything else around it and these days using direct values is actually far better.

And I don’t think anyone uses Namespaces other than for defining external modules.

TheCee ,
@TheCee@programming.dev avatar

My bad, I’m not deep enough into our frontend stack to realize Hjeilsberg already did what he does best - ruining enums. (I guess he is not to blame for global imports in c#, so i can not add ‘questionable import module/namespace ideas’.)

And it seems like this proposal contains type declarations (in order to compensate for their enums), among other typescript specific things. So, guess it is option B, then.

rockstarpirate ,

Yeah it’s interesting because JS is interpreted, not compiled. The proposal allows for type annotations in the syntax but no actual interpreter consequences. On the one hand that makes sense because otherwise you’re in the territory of runtime type-checking which would be a huge performance hit and would sort of defeat the purpose of static types anyway. But that means you still have to rely on your IDE or a linter for this to be useful.

fidodo ,

I don’t see any practical use case for it as is as anyone wanting to use them would want the full TS feature set anyways, but I could see it being a good step forward for more meaningful features to be added in the future.

TheCee ,
@TheCee@programming.dev avatar

but I could see it being a good step forward for more meaningful features to be added in the future.

I think you are right. And that is unfortunate.

jpeps , in Which side are you? Javascript or Typescript

What Typescript drama is there? It’s fantastic. It’s been an industry standard for years. In my anecdotal experience the only people that hate it are juniors who did pure JS at their bootcamp and seniors that have refused to learn anything for the last 5 years.

fusio ,

or people used to work alone never having to go back to their code (e. g. bad consultancy jobs)

jpeps ,

Even alone I find it indespensible. I find it’s mainly useful for writing code correctly the first time around.

fkn ,

Some people think better with typing information explicitly written out. Some people don’t. In my opinion it is a creativity thing. Some people like to make art that is photo realistic, some people like to make abstract art.

I understand both viewpoints. In my free time I vastly prefer late bound, dynamically types languages with robust reflection engineers built into their interpreters. For work, I heavily prefer late bound, strictly typed with reflection optional or minimal.

Different people think differently.

jpeps ,

I think that’s fine if that’s how you like to work on your own, but I’d challenge anyone to do that and write better documentation while also getting a team or whole business to do the same. A huge strength of TS is that it gives people no choice but to document their work.

fkn ,

I didn’t say JavaScript… and I certainly wouldn’t choose TS for a personal project because I personally feel that its organization is terrible but I would choose TS over vanilla js for work projects because it does produce better group work and is easier to maintain long term because of the structure imposed on it.

jpeps ,

Haha well that’s fair enough then!

fidodo ,

TS is amazingly powerful when it comes to refactoring. I swear it practically writes itself. Half the time by the time I fix all the compiler errors the refactoring is done. I barely need to think about it which means I can spend more time thinking about the best architecture. When people say they don’t see how TS makes you more productive it just makes me think they never refactor their code.

Fluffysquash ,

DHH (guy who founded Ruby on Rails) ripped typescript out of a supporting library and swapped it for JavaScript. He did it in his typical fashion of not allowing discussion and being a dick (PR only open for a couple hours and then merged disregarding all the negative feedback about the change) . So people are mad at him again.

He does stupid shit like this all the time because he’s a fucking knob.

jpeps , (edited )

RoR will always have a special place in my heart, but yeah… DHH sure does have opinions. What possible justification is there for removing it when it’s already there? Guess someone could just shift the types out to DT.

Edit: So I read his blog post about it. He’s dropping it because he just doesn’t like it and he’s allowed to not like it. Okay then 🤷

zebbedi ,

His blog to me sounds like he did it because it was too difficult for him to understand a few errors. Says it all.

jpeps ,

I wasn’t going to say it, but yes, 100% 😂

zebbedi ,

You only have to read the PR comments with people asking how you know if something is optional when there is absolutely zero jsdoc to know it was idiotic.

Pipoca ,

From his blog post:

While you may compile dialects into it, you still have to accept the fact that running code in the browser means running JavaScript. So being able to write that, free of any tooling, and free of any strong typing, is a blessing under the circumstances.

By his logic, JS linters are bad because they’re tooling that restricts your access to all of Javascript. But linters mean you don’t have to read PRs with a fine tooth comb to make sure there’s no footguns like using == instead of ===.

Also, you could use that same logic to advocate for writing JVM bytecode directly instead of Java/Kotlin/Scala/Clojure/etc.

The question is really whether tooling pays its way in terms of lower bug rates, code that’s easier for coworkers to read, and code that’s easier to reason about.

EnderMB ,

As a general rule, if DHH says something, the opposite probably has some true merits.

beeb , (edited )

Svelte decided to ditch it because it became impractical due to the compilation step slowing down development and making debugging their compiler harder. I think for libraries it makes sense to go the jsdoc way as long as consumers can choose typescript.

marcos ,

Am I the only one scratching my head trying to understand why Svelte supported it at the first place?

The TS type system is not a good match for the project.

dragnucs ,

I refuse to use it because it is backed by Microsoft.

jpeps ,

I can understand that. Does it’s open source status not change anything for you?

dragnucs ,

They have a vert high chance of pulling slack.

Knusper ,

If it’s dumped under an open-source license, but still developed exclusively by one corporation, they can swap out that license pretty easily.

jpeps ,

For what? If they took it away, the source code would still be there if someone wanted to fork it. Not to mention removing TypeScript from an application is relatively trivial.

Knusper ,

They’re not that dumb, to just pull it completely. That would obviously result in a successful fork.

Companies usually start with e.g. the BUSL, so source-available but proprietary restrictions.
For TypeScript/Microsoft, I could imagine some variation of their EEE playbook.

But really, the whole point of avoiding Microsoft et al, is that I don’t want to think about, how they could fuck this whole thing up. They’ve proven quite creative in this regard for as long as they’ve existed.

fidodo ,

I feel like there’s no typescript drama, just JavaScript drama. Things are pretty happy in the TS community. I’ve been writing js code since it literally first came out. I’m definitely no js hater. In the early days js code bases quickly turned to spaghetti code, but I genuinely think the js community has done miracles turning what was essentially a super simplistic toy language into a seriously good production quality language. I’ve seen first hand how much work has gone into it, and while most of the js community has been great with embracing change for the better, there’s always been the niche of detractors against any change that adds complexity even when it makes coding safer and more productive.

I’ve always had a love hate relationship with JavaScript, but with typescript it’s really been just straight up love. Pretty much all the trouble I have with typescript has been due to external libraries that use types lazily or incorrectly, and even then there are solutions to add safety to your own codebase. Sometimes I run into some trouble with the type system itself, but it’s pretty much always because I’m doing something really complicated that would be hard in any type system. I’ve been working with typescript for years now and my code bases are some of the most solid ones in my company. Typescript is really safe as long as you’re actually using it and not telling the compiler to ignore types through using any or making unsafe assertions.

It makes no difference to me if other people prefer JavaScript. Any important js library will get ts support anyways through definitely typed, and if a library is so sloppy it can’t be typed well then it’s not a good library to use anyways. Having people proudly announce they only want to use JavaScript is also great for hiring. It easily tips me off on who not to hire.

souperk , in Which side are you? Javascript or Typescript
@souperk@reddthat.com avatar

well, I mostly create SPAs, with big projects a type system is a necessity…

darcy , in Which side are you? Javascript or Typescript
@darcy@sh.itjust.works avatar

typescript is a bandaid on a severed leg

MajorHavoc ,

MyPy for Python hides in the bushes.imgflip.com/7yinbx.jpg

darcy ,
@darcy@sh.itjust.works avatar

image not found :(

Kuresov ,

Mypy is just okay. Haven’t used TS to know the dark corners there, but any type system that’s bolted on to the language is going to have dark corners in the best case.

It’s better than no type system, however. I remember when typed languages were “bad” because it “slowed you down” and “wasn’t necessary if you know what you’re doing”… how naive I was when I repeated those words so many years ago :)

JakenVeina ,

More like a tourniquet and a prosthetic. It doesn’t solve the underlying problem, but it’s the best solution we’ve come up with.

fidodo ,

I view it more like a powered exoskeleton around a blob fish. IMO static typing is way more valuable than strong typing and I’d take static typing only over strong typing any day if I can only choose one.

Deleted , in Which side are you? Javascript or Typescript

I'd rather stay out of the frontend all together but I'd rather chop my balls off than go back to JS.

SpeziSuchtel ,

Plot twist: You are transgender and love working with JS

tram1 , in Which side are you? Javascript or Typescript

I’m kind of a beginner… Can someone explain why you would make/use/have a dynamically and/or weak typed language? Is it just to not write some toInteger / as u64 / try_from()? I mean the drawbacks seem to outweigh the benefits…

Lmaydev ,

If you are writing small and simple apps it will give you more velocity and much less boiler plate.

As apps grow it becomes harder to keep track of things and can quickly grow into a mess. You then start to need external tools to give you the features of a strong static type system.

Also from a web point of view you don’t want the website to crash and burn with every error. JS will power through things like invalid types. Imagine if any error caused the website to just stop.

Johanno ,

Si you say I should use python for websites?

Lmaydev ,

Unsafe rust is your best bet.

Nerd02 ,
@Nerd02@lemmy.basedcount.com avatar

There’s no real alternatives to JS “for websites” (meaning on the frontend, the part of your code that gets executed on your client’s browser). That’s what JS was invented for and what it does best.

I say “no real alternative” because technically we also have WebAssembly, which is a tool that allows you to run code written with any language on the web, but if you indeed are a beginner approaching to web development you should just forget about this for now and stick to JS as you learn.

Of course this doesn’t mean that you can’t use Python on your backend, your server.

rederick29 ,

Why should beginners approaching web development stay away from WASM? I’ve used it a few times to create online demos of software I made in Rust and it was a very simple and painless experience to get it working in a website. I consider myself a beginner and I have not run into any issues with it so far.

CodeBlooded ,
@CodeBlooded@programming.dev avatar

WASM is simply further down the rabbit hole for someone who is new to programming (but not someone who’s already a programmer and just doesn’t focus on web dev today). You are likely far less beginner than you think if you’re making decisions like “I’m going to compile my software written in Rust targeting WASM so I can demo it.”

ironbeard ,

But a statically typed language would catch those errors before it even compiles…

Lmaydev ,

The fact it doesn’t need to be compiled is also a big reason why it’s used on the web.

But I absolutely agree. I’m not a fan of dynamic typing at all.

noli ,

The typical arguments for a dynamic typed language are that it takes less time to write something in it.

The benefits of static typed languages are that your development environment can be a lot smarter (ironically enough leading to faster development speed) and several classes of bugs being unable to happen. In a statically typed language, the IDE can detect if you’re trying to call a function that takes a number but you’re actually providing a string. In this case the IDE will let you know and you can immediately fix silly mistakes like that.

Knusper ,

They used to be more attractive around the 2000s, before type inference became commonplace and when IDEs/editors were still a lot less powerful.

As for making a dynamically typed language, to my knowledge, they are actually easier to create than statically typed languages…

qaz ,

I prefer using JS because I can see the errors, while having to figure out which part generated the problematic JS code with errors when using something else.

KSPAtlas , in Which side are you? Javascript or Typescript
@KSPAtlas@sopuli.xyz avatar

“In own my lane”

Psythik , in Which side are you? Javascript or Typescript

I’m on the side of NoScript.

From a privacy and security standpoint, both are evil and need to die.

QuazarOmega ,

You can minimize the attack surface with certain fingerprinting resistance settings at least.
I personally don’t see why easy interactivity would be inherently a bad thing, plenty of apps that you would have to install directly on your system can instead stay isolated in your browser and never have access to anything else outside of it, particularly useful for proprietary web apps that we’re forced to use, those same apps that go as far as to beg you to install their native counterpart on your PC, which is clearly an attempt at data harvesting and increasing user retention. Also useful for simple stuff you need once in a while and it would never make much sense to have installed

karmiclychee , in Which side are you? Javascript or Typescript

I’ve always felt it doesn’t solve the problem people think it’s solving.

Knusper , in Which side are you? Javascript or Typescript

I’m choosing the third side: WebAssembly

QuazarOmega ,

Blazingly fast 🦀🦀🦀

marcos ,

Incredibly powerful type system λλλ

And the best part, those two interop better than in native code.

QuazarOmega ,

those two interop better than in native code

Really? Why is that?

marcos ,

The wasm ABI allows for a bit more flexibility than the C one.

I’m not sure how much impact it has on practice (probably very little, otherwise somebody would have fixed it), but in native code there’s a lot of potential for mismatching behaviors from the two different runtimes.

QuazarOmega ,

Oh I had no idea, thanks for explaining!

Static_Rocket ,
@Static_Rocket@lemmy.world avatar

Have they finally dumped the required js stub loader?

Knusper ,

No, but GUI frameworks can generate it for you. Same goes for DOM access, for which there’s normally only a JavaScript API.

So, you’ll likely want to read JS, when researching what events or properties you can read/write for certain HTML nodes in the DOM, but with a mature GUI framework, you should not need to write any JS.

redcalcium ,

You can even compile Fortran code to wasm and run it on a web browser. Who need Javascript’s puny 64bit floating point precision when you can have Fortran’s superior 128bit floating point precision?

TootSweet , in Which side are you? Javascript or Typescript

When I write JS:

  • It’s because it has to run in a browser. (Why would I want to write JS that runs outside a browser? Rhetorical question. Don’t answer that.)
  • I use no JS dependencies. Zero. None. No jQuery. No React. No VUE. No Typescript. Nothing like that. (Unless you count as “JS dependencies” a) a minifier (but not one written in JS) or b) browser builtins.)
  • I don’t use any ECMA6 stuff. (Who asked for classes anyway?) Though to be fair, that’s definitely at least partially because I have yet to even really look into what’s available.
  • I love callbacks and closures.
  • I keep my global scope tidy, though I do store some things in the global scope. (Typically one or fewer global variables defined per JS file.)
  • I don’t use prototypes. Just because I’ve never found good uses for them.

I do believe there’s a beautiful language living inside JS. It is quite pleasant to work with. But not the kind of thing I’d want to write “real software” in when there are alternatives like Go or even Python.

Lmaydev ,

We used to use jQuery because there basically wasn’t a decent way to do a lot of things back then. Like selectors for instance.

Many of its best features have been absorbed in JS to the point vanilla is a much more approachable choice now.

The reason react and Vue are so popular is that any decently sized js app quickly becomes very hard to maintain. Or at least becomes time consuming to maintain. This is generally down to its dynamic nature.

TootSweet ,

Yeah, I agree that jQuery used to be pretty necessary for some pretty basic features in JS but is kindof obsolete now-a-days.

I don’t agree that any codebase that doesn’t use framewok X or Y will inevitably devolve into unmaintainability. If it does, it’s probably more because one isn’t following best practices. (Like the Unix Philosophy or SOLID (which functionally are kindof the same thing), DRY, ZOI, etc.) And no amount of frameworks can save you from that fate if you indeed aren’t taking steps to ensure the longer-term maintainability of your codebase.

jpeps ,

You do you, but no ECMA6 stuff? I don’t use a lot of ECMA6 either because JS is at ECMA14 and continues to change. I can’t imagine reinplementing stuff on every project you work on, though perhaps your work is very different to mine. That said, treeshaking has really brought down the cost of imports and there are few occasions where using a custom solution over a reliable third party library is a good option. Curious to hear your thoughts.

TootSweet ,

Treeshaking imports (which, admittedly, I just learned about from some googling) assume that the JS you’re importing comes from another file (that the browser would have to fetch separately), yes? I believe that’s not a restriction of RequireJS (which I have experience with through my work but wouldn’t use on any personal projects.)

I’m just thinking performance-wise you’d get better performance by putting all of your JS in one (or a very few) files to be fetched from the server via one (or very few) requests. I am perhaps more of a stickler for shaving a millisecond here and there. (Which is part of why I wouldn’t use large JS lubraries. I wouldn’t want to make the browser have to load them.)

jpeps ,

It’s very typical to import code from other files, but it’s also typical to have a minification step that essentially performs what you’re saying, compressing the files down into something more optimal. In fact more advanced solutions essentially stream the minium amount to users as needed, and compute as much as possible in the server side.

To be honest, I’d bet a lot than by not utilising larger libraries and their standardised functions, your code has a good chance of running slower. Besides, for the typical computer and network capabilities today, there’s a lot of wiggling room.

That said, for absolute tip top of performance (where experience is a trade off) you can find fun things like this, where groups do have to push for the upmost performance.

Potatos_are_not_friends , in Which side are you? Javascript or Typescript

I learned typescript because so many authors are using it.

I think it’s like jQuery. Learn it because you’ll have to debug someone’s code one day.

Immersive_Matthew , in Which side are you? Javascript or Typescript

Is it even going to matter in the next 3-5 years? AI is going to make its own, kore efficient language and all the ones we use will be for hobby, fun and those who did not adapt.

cloaker ,

Not the case. Ai can write binary. Languages are for humans to be able to use.

Immersive_Matthew ,

I agree with you, but writing human readable code will become a cottage craft and hobby as while it is good to know, AI will just be so much faster and better that coding anything yourself will make little business sense. I am already writing way less code, especially with the 100k token windows over on Poe.com which seems to handle most of my script sizes.

cloaker ,

Certainly not in the next 3-5 years will this be a thing.

Kuresov ,

This might handle scripts as you described, but just wait until it needs the context of random bits of a tens-of-millions-of-lines monorepo plus knowledge of custom infrastructure that isn’t documented anywhere and–oh wait, we can’t actually let this LLM-as-a-service read our code because X and Y compliance/security/legal/etc, even if we ran it on-prem.

The robots aren’t coming for you so soon, don’t worry.

Immersive_Matthew ,

I think you are right if the progress on AI is linear, but if it continues to be exponential, nothing you said, even undocumented is going to be a barrier. That assumes AGI is coming and is as smart as the smartest people. We will see, but my money is on the progress surprising everyone. I am surprised by how much AI has improved over the last 6 months alone.

PeWu , in Which side are you? Javascript or Typescript

I am just a little “programmer” (if I can even call myself like that), and I’m using Typescript. Sure, it has it’s own shortcomings, as everything, but it looks better than plain JS (at least in vscode)

Ddhuud , in Which side are you? Javascript or Typescript

I’m with the guy sitting at the table

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines