JavaScript is non static-typed and you'll spend time fixing bugs that can be prevented by static typing. Also, GJS is not well documented, as far as I remember.
> JavaScript is non static-typed and you'll spend time fixing bugs that can be prevented by static typing.
Use TypeScript if types are so important for you. Others find their own way of handling those issues without getting tripped up on it. Hardly a reason to completely switch between two languages in my mind, but of course it's alright if it's reason enough for you. Luckily there are acceptable workarounds for both groups of people :)
> Also, GJS is not well documented, as far as I remember.
What exactly is missing here? There are guides for the basics, API reference exists and there is a ton of apps you can look into for inspiration and/or figure out specific implementations.
Is that really worse than what exists for writing Gnome apps with Swift? Seems like a really weak argument for using Swift instead of GJS.
Swift is compiled, static-typed language and without tons of legacy like JS (for example, it has real objects, not dictionaries). Doesn't require an interpreter. It seems to be better than JS in every aspect.
One mans gold is another mans trash :) Static typing seems to be a neat addition for lots of people, that's great! Doesn't mean it's a silver bullet that improves development for everyone, and that's OK.
I still don't see how a language (GJS) with an already existing ecosystem of writing Gnome apps, lots of examples, API references and more is worse for writing Gnome apps than Swift, that seems to have been launched just some days ago?
Edit: I realize now that the "Adwaita for Swift" this blogpost is about isn't even an official Swift project, is the output of a student interested in Swift and Gnome.
I think you are vastly overestimating how good and current the GJS documentation and examples are.
Without touching the fact that it is NOT a stable API and breaking changes are very common.
Even the gold standard of GTK coding in C is still very undocumented outside of the happy path and confusing due to the Gtk 3->4 migration, and the only approach to learning it is by reading what other Gtk apps do.
Honestly I used to think the same way about JS, because not having types allowed for very concise code sometimes.
But the more I used Swift I realized how powerful type inference can be, and the difference in conciseness shrunk to basically nothing.
Heh, yeah, everyone's journey is different :) I started out being a big fan of static typing but eventually found that I'm usually hit by different issues than "this was a int but I expected a string" that were more important to be solved, so I'm mostly using dynamic languages nowadays.
But that's what so great with programming languages, there are so many that work so differently, so there is at least one language for everyone, no matter how different your brain works :)
By the way, if you're a fan of "conciseness" you should give a lisp-type languages a try if you haven't before, will show you a completely different level of conciseness! Clojure is a great introduction to lisps. And if you still need validation of data somehow, clojure.spec et al works great and will introduce you to some cool new things you probably haven't come across before :)
Doesn't TypeScript – as mentioned above – solve all JavaScript type problems? I have, in 6 years, never encountered a single type error originating from a TS file.
Biggest problems with TypeScript IMO are that it’s a layer rather than a language proper and that untyped JS problems can too easily worm their way in if you’re using any libraries at all. Also depending on the group of developers involved, the ease at which one can pull the escape hatch and opt out of TS is a liability and can render much of its benefit moot.
> I still don't see how a language (GJS) with an already existing ecosystem of writing Gnome apps, lots of examples, API references and more is worse for writing Gnome apps than Swift, that seems to have been launched just some days ago?
I mean, you said it yourself:
> One mans gold is another mans trash :) Static typing seems to be a neat addition for lots of people, that's great!
For those people it is definitely better than GJS!
Well, I mean if the difference was only about static typing, I definitively see what you're talking about. But the difference between GJS and Swift for Gnome app development is greater than that, so personally just that one "feature" wouldn't push me towards Swift.
But yeah, probably for some it's worth it, so that's pretty cool :)
In JS you can delete properties, assign anything to them (no typing), cannot add comments to them, cannot restrict access from outside. Also you can access non-existing properties and no error will be thrown.