Billions of libraries, works on even obscure hardware, simple syntax, no compiling(it’s behinde the scene and just like always works) or linking etc. etc. etc.
Edit: this implies that C/C++ is the best language ever of course. Let the flame wars begin!
Hi there! Looks like you linked to a Lemmy community using an URL instead of its name, which doesn’t work well for people on different instances. Try fixing it like this: !programming@lemmy.world/u/theherk) [@programming](https://programming.dev
And yet I wouldn’t touch C nowadays if I can avoid it anyhow. Zig (simple low level) and Rust (where e.g. C++ would be used, and for large higher level projects, as it really composes nicely) are IMHO the way modern systems programming is done
That’s fine, but there are still plenty of use cases where you’d have to use C instead of anything else. I agree though, Rust is a better language than the monstrosity that is C++.
Starting a new personal project is different from what the industry requires. If you’re working on integrated systems, guess which language you’ll likely have to work with?
It’s kind of like Typescript vs Javascript. There’s zero reason to start a new project with Javascript, but there’s still plenty of projects out there that use it.
Well depending on the “depth” of the stack Rust is probably the first choice by now for new projects in “the” industry (speaking of experience, a lot of companies are evaluating this choice now).
Have you tried Zig instead for low level stuff? It’s a little bit simpler AFAIK and probably a good choice when the project doesn’t get too big (in which case I would prefer Rust because of its safety guarantees). FFI is always an option…
With JSdoc and IDE support I can still understand why one would choose Javascript instead of Typecsript (having worked with both more extensively) and with e.g. https://github.com/tc39/proposal-type-annotations the boundaries will slowly fade. (mainly to avoid a massive stack of bundling and tooling software)
But I would absolutely avoid either honestly if possible Javascript (or the “static” typing Typescript is adding on top) is still not really comparable to a real strict statically typed language (apart from all the weirdness that consists in either). The way I want to program in it (functional, composable, avoiding this) is unfortunately relatively inefficient… I still don’t get why it was “chosen” as the web language…
I don’t use low level languages much anymore, but I’m glad to hear Rust is taking over for new projects (as it should imo)
. C++ is a monstrosity of a language that’s overly complicated.
Maybe it’s because it’s the language I learned computer science in, but I feel (maybe hope is a better) that C will stick around. I firmly believe it’s the best tool for students to learn how a computer intuitively works.
As for JS/TS, I only skimmed the github link you sent, but I don’t understand how that’s too different from TS. Seems to be a slightly different way of accomplishing static typing.
Also I mostly do front-end with TS, but what issues do you run into doing functional programming with TS out of curiosity? Never tried to do that
I firmly believe it’s the best tool for students to learn how a computer intuitively works.
Yeah C is certainly a language students should learn (in contrast to C++ IMHO). It’s a dead simple language (well for what it is capable of at least, also to write a compiler for, which is a good academic task) that was very influential and is still here to stay for quite a while (not necessarily directly the language itself, but rather the ABI I think).
how that’s too different from TS
well it’s really baked into the language, no intermediate transpiler or compiler is necessary, and the ecosystem should be a little bit nicer to use (as less bundling is necessary, which I kind of detest after having gone into that rabit hole a little bit too often and “wasted” quite some time with (configuring) it).
functional programming with TS out of curiosity?
It’s not really issues, but I know that something like this:
is concise and reading like how it should be done, but it’s just less efficient than just looping over the array and doing all the things in place (because every time filter or map or reduce or all the functional niceties is used, a new array is allocated and you want to absolutely avoid allocations if possible).
Javascript is a little bit dumb when it comes to allocations (in design itself, something like V8 can’t really help here at least most of the time).
In Rust the same is often even more efficient than manually looping over, doing it in place it (probably because of aliasing guarantees). I saw a few interesting posts way back on reddit, that found this out, the (performance) equivalent imperative version was ugly to read. So the default way one would approach the problem in Rust is often also the most efficient, which is obviously very nice to have.
Or another thing I would like to use more often in Java/Typescript is factory functions, something like this:
functioncreateMyObject(param1, param2) {
// do something with param1 and param2// a few functions that could be seen as methodsfunctionmyMethod() {
param1 += 1 + param2;
}
returnObject.freeze({
myMethod,
param1
})
}
But also here, everytime createMyObject is run, all of the stuff/methods inside is allocated again (instead of creating/compiling function references), maybe this can/will be optimized at some time (probably with a transpiler/compiler again, yay -.-).
So in general: writing nice (to read) code in Typescript/Javascript often leads to a lot of allocations, and I detest that a language is designed in a way where you want to write nice looking code but you’re punished for it with inefficiency.
Cython is a better equilavent as it does compile to C while enabling Python syntax. No one is arguing C or C++ is the best language. I’d even argue a perfect language does not exist. Simple syntax could be argued on a line to line basis, but forced indents is uncomfortable for some, and Julia could be argued to be better in that area. I’m one to hope Julia can take off.
And lack of forced indentations. Forced indentations gets on my nerves even if I already gotten used to it. These day, all I use Python is small code snip test, and it’s perfect for that as it strips out braces and other things which allows me to focus on a small code. I did used Python for slightly bigger things than that, but only to assist me with other coding languages, and I mainly used it for aiding into G’MIC scripting (Domain-Specific Language that is absolutely wonderful for raster graphics image processing).
Wow I pretty much disagree with everything you said haha. E.g. packaging/venv in python is absolute hell compared to something like cargo/crates in Rust. Try to manage a large project in python and you’ll likely revise your answer (if you actually know all the nice alternatives out there…)
In my experience managing a large project comes down to having a consistent process/standards and enough experienced engineers in that language. Remove that and every single language leads to abominations.
I agree, that having a consistent process and good engineers is definitely most important, but a language itself definitely can guide you in the right direction. I think ironically Rust and C++ are good vice versa examples (unrelated to their target area, which happens to be the same (systems programming)), C++ has zillion ways to program in, finding the right and best way is definitely no easy task and requires massive experience in all kinds of paradigms, while Rust generally promotes you to do things in one/the “right” (IMHO) way, otherwise the borrow-checker annoys you all the time.
Python is basically (IMO) C/C++ made easy.
Billions of libraries, works on even obscure hardware, simple syntax, no compiling(it’s behinde the scene and just like always works) or linking etc. etc. etc.
Edit: this implies that C/C++ is the best language ever of course. Let the flame wars begin!
I very much disagree. In Python almost everything is abstracted away from you and it’s dynamically and weakly typed. It’s also interpreted.
Compare that to C which is literally one step above assembly, strongly and statically typed, as well as compiled.
They’ve got completely different use cases and have almost no overlap imo.
Agree except Python is strongly typed.
In what way? Python has type hinting, but it’s purely for linting and is not enforced at runtime. Python has always had dynamic duck typing.
@theherk @programming
Hi there! Looks like you linked to a Lemmy community using an URL instead of its name, which doesn’t work well for people on different instances. Try fixing it like this: !programming@lemmy.world/u/theherk) [@programming](https://programming.dev
And yet I wouldn’t touch C nowadays if I can avoid it anyhow. Zig (simple low level) and Rust (where e.g. C++ would be used, and for large higher level projects, as it really composes nicely) are IMHO the way modern systems programming is done
That’s fine, but there are still plenty of use cases where you’d have to use C instead of anything else. I agree though, Rust is a better language than the monstrosity that is C++.
Starting a new personal project is different from what the industry requires. If you’re working on integrated systems, guess which language you’ll likely have to work with?
It’s kind of like Typescript vs Javascript. There’s zero reason to start a new project with Javascript, but there’s still plenty of projects out there that use it.
Well depending on the “depth” of the stack Rust is probably the first choice by now for new projects in “the” industry (speaking of experience, a lot of companies are evaluating this choice now).
Have you tried Zig instead for low level stuff? It’s a little bit simpler AFAIK and probably a good choice when the project doesn’t get too big (in which case I would prefer Rust because of its safety guarantees). FFI is always an option…
With JSdoc and IDE support I can still understand why one would choose Javascript instead of Typecsript (having worked with both more extensively) and with e.g. https://github.com/tc39/proposal-type-annotations the boundaries will slowly fade. (mainly to avoid a massive stack of bundling and tooling software)
But I would absolutely avoid either honestly if possible Javascript (or the “static” typing Typescript is adding on top) is still not really comparable to a real strict statically typed language (apart from all the weirdness that consists in either). The way I want to program in it (functional, composable, avoiding
this
) is unfortunately relatively inefficient… I still don’t get why it was “chosen” as the web language…I don’t use low level languages much anymore, but I’m glad to hear Rust is taking over for new projects (as it should imo) . C++ is a monstrosity of a language that’s overly complicated.
Maybe it’s because it’s the language I learned computer science in, but I feel (maybe hope is a better) that C will stick around. I firmly believe it’s the best tool for students to learn how a computer intuitively works.
As for JS/TS, I only skimmed the github link you sent, but I don’t understand how that’s too different from TS. Seems to be a slightly different way of accomplishing static typing.
Also I mostly do front-end with TS, but what issues do you run into doing functional programming with TS out of curiosity? Never tried to do that
Yeah C is certainly a language students should learn (in contrast to C++ IMHO). It’s a dead simple language (well for what it is capable of at least, also to write a compiler for, which is a good academic task) that was very influential and is still here to stay for quite a while (not necessarily directly the language itself, but rather the ABI I think).
well it’s really baked into the language, no intermediate transpiler or compiler is necessary, and the ecosystem should be a little bit nicer to use (as less bundling is necessary, which I kind of detest after having gone into that rabit hole a little bit too often and “wasted” quite some time with (configuring) it).
It’s not really issues, but I know that something like this:
array.filter(e => <condition>).map(e => <some mapping function>)
is concise and reading like how it should be done, but it’s just less efficient than just looping over the array and doing all the things in place (because every time
filter
ormap
orreduce
or all the functional niceties is used, a new array is allocated and you want to absolutely avoid allocations if possible). Javascript is a little bit dumb when it comes to allocations (in design itself, something like V8 can’t really help here at least most of the time).In Rust the same is often even more efficient than manually looping over, doing it in place it (probably because of aliasing guarantees). I saw a few interesting posts way back on reddit, that found this out, the (performance) equivalent imperative version was ugly to read. So the default way one would approach the problem in Rust is often also the most efficient, which is obviously very nice to have.
Or another thing I would like to use more often in Java/Typescript is factory functions, something like this:
function createMyObject(param1, param2) { // do something with param1 and param2 // a few functions that could be seen as methods function myMethod() { param1 += 1 + param2; } return Object.freeze({ myMethod, param1 }) }
But also here, everytime
createMyObject
is run, all of the stuff/methods inside is allocated again (instead of creating/compiling function references), maybe this can/will be optimized at some time (probably with a transpiler/compiler again, yay -.-).So in general: writing nice (to read) code in Typescript/Javascript often leads to a lot of allocations, and I detest that a language is designed in a way where you want to write nice looking code but you’re punished for it with inefficiency.
I’ve gotta say that was a really good argument and was incredibly well written.
Also very much agree with the compiler comment. Learned a lot from doing that project (twice actually) in college
Cython is a better equilavent as it does compile to C while enabling Python syntax. No one is arguing C or C++ is the best language. I’d even argue a perfect language does not exist. Simple syntax could be argued on a line to line basis, but forced indents is uncomfortable for some, and Julia could be argued to be better in that area. I’m one to hope Julia can take off.
Yeah Julia seems to be just python but better (no GIL if I have understood things correctly).
And lack of forced indentations. Forced indentations gets on my nerves even if I already gotten used to it. These day, all I use Python is small code snip test, and it’s perfect for that as it strips out braces and other things which allows me to focus on a small code. I did used Python for slightly bigger things than that, but only to assist me with other coding languages, and I mainly used it for aiding into G’MIC scripting (Domain-Specific Language that is absolutely wonderful for raster graphics image processing).
Wow I pretty much disagree with everything you said haha. E.g. packaging/venv in python is absolute hell compared to something like cargo/crates in Rust. Try to manage a large project in python and you’ll likely revise your answer (if you actually know all the nice alternatives out there…)
In my experience managing a large project comes down to having a consistent process/standards and enough experienced engineers in that language. Remove that and every single language leads to abominations.
I agree, that having a consistent process and good engineers is definitely most important, but a language itself definitely can guide you in the right direction. I think ironically Rust and C++ are good vice versa examples (unrelated to their target area, which happens to be the same (systems programming)), C++ has zillion ways to program in, finding the right and best way is definitely no easy task and requires massive experience in all kinds of paradigms, while Rust generally promotes you to do things in one/the “right” (IMHO) way, otherwise the borrow-checker annoys you all the time.