Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » js or python
- AmazingMech2418
- Scratcher
1000+ posts
js or python
I think NPM is a good package manager… And anyways, Java applets didn't turn out well, languages compiled to JS still ultimately use JS, and WASM is now thought of as a potentially huge security risk and an inconvenience with having to compile everything as well..NPM is just a package manager, and not even a very good one. Remember when a bunch of JavaScript apps broke because LeftPad was pulled from NPM? How about NPM, flexibility through type coercions, and JS being the only language for primary client-side web programming? JS isn't hyper-efficient or super fast, but I think it is extremely versatile. JS can be found pretty much everywhere, like look at Cordova, PhoneGap, or React Native for mobile, there's client-side for web, Node.js for console and back-end, Electron for desktop apps, etc. Also, you don't have TypeScript or CoffeeScript without JS and anything that compiles to JS needs JS as well…
People have been finding alternatives to JS for a long time. First through Java applets, then via languages that the compiler converts to JS, and now with WASM.
JavaScript being everywhere isn't a strength that is unique to JavaScript.C compiles to assembly, yet most programmers would rather program in C than in assembly. Same idea here. There is no alternative other than entirely rewriting the browser engines. Literally, all “alternatives” just compile to JS…There are many other problems as well, like the lack of type checking and the inexpressive syntax. And JS is a great language! So many people don't like the type coercions and stuff, but I think it makes the language more flexible if you know what you're doing…C used to be much more widespread. Now, however, it has been replaced in many of its former use cases. Where programmers would once use C, they now often turn to C++ or Java. Those programming languages, of course, are gradually being phased out too… How about C (1972), Fortran (1957), Lisp (1958), Prolog (1972), GAS Assembly (1986-1987), Ada (1987), and others that are old languages that are still used today? (I would say COBOL, but that's probably not going to be used much longer…)
Prolog and Ada are relatively rare these days. Lisp lives on mainly through its successors.
True, but you can't say Assembly will be obsolete with that…
I personally like the lack of type checking, honestly! XD And I don't see how it's inexpressive…
And well, C is #1 on the TIOBE index, battling for that spot only with Java… C++ is by contrast 4th there…
Also, while Prolog and Ada aren't as used (25th and 30th on the Tiobe index respectively), they still have a many applications, including that Ada is pretty much required for military applications…
Also, I'd just like to say, Fortran is 20th on the TIOBE index, beating out languages like Scala, Rust, and Dart…
I'm a programmer, ethical hacker, and space nerd!
Last edited by Neil Armstrong (July 20, 1969 20:17:00)
sam
- AmazingMech2418
- Scratcher
1000+ posts
js or python
EXE files are not universal machine code though… Only Windows and need something like mono to run on Linux… And DLLs are Windows-only too… Windows will probably become obsolete before JS with the rate Windows 10 is going with how buggy it is, even by your standards of JS supposedly becoming obsolete. LOL!This is another reason JS will go obsolete. C# has NuGet, and also compiles directly into machine code. It also supports practically any DLL or library compatible with .NET.NPM is just a package manager, and not even a very good one. Remember when a bunch of JavaScript apps broke because LeftPad was pulled from NPM? How about NPM, flexibility through type coercions, and JS being the only language for primary client-side web programming? JS isn't hyper-efficient or super fast, but I think it is extremely versatile. JS can be found pretty much everywhere, like look at Cordova, PhoneGap, or React Native for mobile, there's client-side for web, Node.js for console and back-end, Electron for desktop apps, etc. Also, you don't have TypeScript or CoffeeScript without JS and anything that compiles to JS needs JS as well…
People have been finding alternatives to JS for a long time. First through Java applets, then via languages that the compiler converts to JS, and now with WASM.
JavaScript being everywhere isn't a strength that is unique to JavaScript.
I'm a programmer, ethical hacker, and space nerd!
Last edited by Neil Armstrong (July 20, 1969 20:17:00)
sam
- gdpr5b78aa4361827f5c2a08d700
- Scratcher
1000+ posts
js or python
It'll compile into what you want, look at IL2CPP and similar.EXE files are not universal machine code though… Only Windows and need something like mono to run on Linux… And DLLs are Windows-only too… Windows will probably become obsolete before JS with the rate Windows 10 is going with how buggy it is, even by your standards of JS supposedly becoming obsolete. LOL!This is another reason JS will go obsolete. C# has NuGet, and also compiles directly into machine code. It also supports practically any DLL or library compatible with .NET.NPM is just a package manager, and not even a very good one. Remember when a bunch of JavaScript apps broke because LeftPad was pulled from NPM? How about NPM, flexibility through type coercions, and JS being the only language for primary client-side web programming? JS isn't hyper-efficient or super fast, but I think it is extremely versatile. JS can be found pretty much everywhere, like look at Cordova, PhoneGap, or React Native for mobile, there's client-side for web, Node.js for console and back-end, Electron for desktop apps, etc. Also, you don't have TypeScript or CoffeeScript without JS and anything that compiles to JS needs JS as well…
People have been finding alternatives to JS for a long time. First through Java applets, then via languages that the compiler converts to JS, and now with WASM.
JavaScript being everywhere isn't a strength that is unique to JavaScript.
Assembly isn't a language like others are. It won't go obsolete because its an important part of computing in general. Assembly is different for different architectures. ARM assembly will look very different to, say, x86 assembly, or RISC-V assembly.I think NPM is a good package manager… And anyways, Java applets didn't turn out well, languages compiled to JS still ultimately use JS, and WASM is now thought of as a potentially huge security risk and an inconvenience with having to compile everything as well..NPM is just a package manager, and not even a very good one. Remember when a bunch of JavaScript apps broke because LeftPad was pulled from NPM? How about NPM, flexibility through type coercions, and JS being the only language for primary client-side web programming? JS isn't hyper-efficient or super fast, but I think it is extremely versatile. JS can be found pretty much everywhere, like look at Cordova, PhoneGap, or React Native for mobile, there's client-side for web, Node.js for console and back-end, Electron for desktop apps, etc. Also, you don't have TypeScript or CoffeeScript without JS and anything that compiles to JS needs JS as well…
People have been finding alternatives to JS for a long time. First through Java applets, then via languages that the compiler converts to JS, and now with WASM.
JavaScript being everywhere isn't a strength that is unique to JavaScript.C compiles to assembly, yet most programmers would rather program in C than in assembly. Same idea here. There is no alternative other than entirely rewriting the browser engines. Literally, all “alternatives” just compile to JS…There are many other problems as well, like the lack of type checking and the inexpressive syntax. And JS is a great language! So many people don't like the type coercions and stuff, but I think it makes the language more flexible if you know what you're doing…C used to be much more widespread. Now, however, it has been replaced in many of its former use cases. Where programmers would once use C, they now often turn to C++ or Java. Those programming languages, of course, are gradually being phased out too… How about C (1972), Fortran (1957), Lisp (1958), Prolog (1972), GAS Assembly (1986-1987), Ada (1987), and others that are old languages that are still used today? (I would say COBOL, but that's probably not going to be used much longer…)
Prolog and Ada are relatively rare these days. Lisp lives on mainly through its successors.
True, but you can't say Assembly will be obsolete with that…
I personally like the lack of type checking, honestly! XD And I don't see how it's inexpressive…
And well, C is #1 on the TIOBE index, battling for that spot only with Java… C++ is by contrast 4th there…
Also, while Prolog and Ada aren't as used (25th and 30th on the Tiobe index respectively), they still have a many applications, including that Ada is pretty much required for military applications…
Also, I'd just like to say, Fortran is 20th on the TIOBE index, beating out languages like Scala, Rust, and Dart…
- Raihan142857
- Scratcher
1000+ posts
js or python
Assembly isn't a language like others are. It won't go obsolete because its an important part of computing in general. Assembly is different for different architectures. ARM assembly will look very different to, say, x86 assembly, or RISC-V assembly. -snip-
He was talking about WASM, not assembly in general
I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?
- Raihan142857
- Scratcher
1000+ posts
js or python
yes please, python's lambda makes me want to swallow my brother's socks Can we just appreciate Javascript's lambda at least
I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?
- gosoccerboy5
- Scratcher
1000+ posts
js or python
yeah ikryes please, python's lambda makes me want to swallow my brother's socks Can we just appreciate Javascript's lambda at least
- Sheep_maker
- Scratcher
1000+ posts
js or python
If any language were to take JavaScript's place, don't expect it to be any better.
Many quirks of JavaScript only exist because JavaScript is the language for the web. If a browser changes how it interprets JS in a way that breaks old websites, who would want to use that browser? For this reason, browsers can't risk fixing quirks if any websites rely on it. A language that takes JavaScript's place in the future will inevitably accumulate quirks over time
Also, JavaScript being a typed language would have stagnated the progress of the web because it prevents it from being forward compatible as well as backwards compatible. For example, if JavaScript were strictly typed, the type annotation of addEventListener might look something like
Later on, the third argument was changed to become an options object, but had JavaScript been strictly typed, that wouldn't be used because using an options object would cause a type error in older browsers
A typed language is supposed to catch mistakes, but on the web, some of those mistakes may become features in the future. The more lenient the type system, the more mistakes will be allowed to pass, but the more strict the type system, the less able the web would be able to grow.
Also, given how Python is about as free form as JS, if not more, I feel like Python has no reason to break backwards compatibility, but it did
Many quirks of JavaScript only exist because JavaScript is the language for the web. If a browser changes how it interprets JS in a way that breaks old websites, who would want to use that browser? For this reason, browsers can't risk fixing quirks if any websites rely on it. A language that takes JavaScript's place in the future will inevitably accumulate quirks over time
Also, JavaScript being a typed language would have stagnated the progress of the web because it prevents it from being forward compatible as well as backwards compatible. For example, if JavaScript were strictly typed, the type annotation of addEventListener might look something like
public void addEventListener(string string, function handler, boolean useCapture);
A typed language is supposed to catch mistakes, but on the web, some of those mistakes may become features in the future. The more lenient the type system, the more mistakes will be allowed to pass, but the more strict the type system, the less able the web would be able to grow.
Also, given how Python is about as free form as JS, if not more, I feel like Python has no reason to break backwards compatibility, but it did
Last edited by Sheep_maker (April 9, 2021 02:30:40)
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- Maximouse
- Scratcher
1000+ posts
js or python
It had two very good reasons (new style classes and Unicode). Also, given how Python is about as free form as JS, if not more, I feel like Python has no reason to break backwards compatibility, but it did
The TIOBE index is not a good measure of popularity. Most other sources say that JavaScript, Python and Java are the most popular programming languages, which makes much more sense. And well, C is #1 on the TIOBE index, battling for that spot only with Java… C++ is by contrast 4th there…
Also, while Prolog and Ada aren't as used (25th and 30th on the Tiobe index respectively), they still have a many applications, including that Ada is pretty much required for military applications…
Also, I'd just like to say, Fortran is 20th on the TIOBE index, beating out languages like Scala, Rust, and Dart…
- Greg8128
- Scratcher
500+ posts
js or python
The problem with NPM is that packages can change or even disappear without warning, breaking apps that depended on them. LeftPad was a famous example of this. I think NPM is a good package manager… And anyways, Java applets didn't turn out well, languages compiled to JS still ultimately use JS, and WASM is now thought of as a potentially huge security risk and an inconvenience with having to compile everything as well..
True, but you can't say Assembly will be obsolete with that…
I personally like the lack of type checking, honestly! XD And I don't see how it's inexpressive…
And well, C is #1 on the TIOBE index, battling for that spot only with Java… C++ is by contrast 4th there…
Also, while Prolog and Ada aren't as used (25th and 30th on the Tiobe index respectively), they still have a many applications, including that Ada is pretty much required for military applications…
Also, I'd just like to say, Fortran is 20th on the TIOBE index, beating out languages like Scala, Rust, and Dart…
Assembly is not one language, but rather a blanket term for VERY low-level languages. Different families of processors have different instruction sets, and therefore different assembly languages. So for example, x86 assembly will become obsolete when x86 processors become obsolete. (This will take much longer: designing a modern processor is much harder than designing a modern programming language!)
The lack of type checking (and other compile-time checks) is nice until it takes a long time to track down a mistake.
An example of JavaScript's inexpressiveness comes through its use of switch statements instead of cooler match statements (which are much more flexible and can return a value)
JavaScript:
function fizzbuzz(n){
switch (n % 15){
case 15:
return "Fizzbuzz"
case 3:
case 6:
case 9:
case 12:
return "Fizz"
case 5:
case 10:
return "Buzz"
default:
return n
}
}
Scala:
def fizzbuzz (n: int): String = {
n%15 match {
case 15 => "Fizzbuzz"
case 3 | 6 | 9 | 12 => "Fizz"
case 5 | 10 => "Buzz"
case _ => n.toString()
}
}
Other features that JS lacks include tuples and sum types.
The TIOBE index is just one metric of programming languages. If you want to see where languages are headed, consider the 2020 StackOverflow developer survey. Newer languages (TypeScript and Dart, Scala and Kotlin, Rust) are more loved and less hated than their older equivalents (JavaScript, Java, C/C++). This means that developers using those languages are more likely to want to continue to use them. Interestingly enough, Python is by far the most wanted programming language (meaning that developers who don't know it are more likely to want to learn it). I assume that this is because Python is heavily promoted as a good programming language for beginners.
Ada may be a very safe language, but so is Rust. We may soon find that even the slow and change-resistant U.S. government has phased out Ada for a newer programming language with a greater pool of experienced programmers.
- gdpr5b78aa4361827f5c2a08d700
- Scratcher
1000+ posts
js or python
[offtopic]im just wondering how much time it takes to write every single one of your replies because they are really big[/offtopic]
- Sheep_maker
- Scratcher
1000+ posts
js or python
Presumably after that incident, NPM has stricter criteria for unpublishing packages:The problem with NPM is that packages can change or even disappear without warning, breaking apps that depended on them. LeftPad was a famous example of this. …
- no other packages can be dependent on it
- after 72 hours, it can't have more than 300 downloads per week, and you have to be the sole owner
I agree that match and sum types would be quite useful, though sum types don't really fit languages that don't have type annotations IMO An example of JavaScript's inexpressiveness comes through its use of switch statements instead of cooler match statements (which are much more flexible and can return a value)
JavaScript:Note that if the value was not returned, but stored in a variable for some other use, then ‘break’ statements would also be required.// ...
Scala:Much easier to read! And this isn't even the full power of the ‘match’ statement!// ...
Other features that JS lacks include tuples and sum types.
I believe Python 3.10 has a match statement (not expression, unfortunately) and there's a stage 2 proposal for tuples in JS.
Currently, in TypeScript, arrays are used as tuples:
const tuple: [number, string] = [3, 'hello']
type Colour = | { type: 'rgb', r: number, g: number, b: number } | { type: 'hsv', h: number, s: number, v: number } | { type: 'hex', hex: string }
function colourToCss (colour: Colour): string { switch (colour.type) { case 'rgb': return `rgb(${colour.r}, ${colour.g}, ${colour.b})` case 'hsv': return `hsv(${colour.h}, ${colour.s}%, ${colour.v}%)` case 'hex': return `#${colour.hex}` } }
I'm not familiar with Python's type system, so I would like to know whether something like this can be done with Python typing
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- gosoccerboy5
- Scratcher
1000+ posts
js or python
I personally find it slightly more aesthetically pleasing, although maybe a bit harder to read. The JavaScript syntax isn't bad, but I think C-style syntax in general is relatively ugly compared to Python because it uses so many different symbols.
- Raihan142857
- Scratcher
1000+ posts
js or python
Yeah, python's indents & lack of semicolons make the code look kind of… rounded and weird.I personally find it slightly more aesthetically pleasing, although maybe a bit harder to read. The JavaScript syntax isn't bad, but I think C-style syntax in general is relatively ugly compared to Python because it uses so many different symbols.
I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?
- Sheep_maker
- Scratcher
1000+ posts
js or python
Python's syntax is nice, especially when you can omit the parentheses around tuples, and the keywords for logical boolean operators are pleasant.
However, I think Python's indentation-sensitive syntax is kind of limiting because it wouldn't fit inside expressions, which is probably why lambda expressions only allow a single expression with no statements. Perhaps Pythonists may justify this because it promotes more readable code by separating out complex logic into a separate function rather than inlining it all in a lambda. Also, because Python variables are function scoped, it's not as inconvenient to store a value from an if-else or match statement as it is in JS with its block scoped let/const variables
However, I think Python's indentation-sensitive syntax is kind of limiting because it wouldn't fit inside expressions, which is probably why lambda expressions only allow a single expression with no statements. Perhaps Pythonists may justify this because it promotes more readable code by separating out complex logic into a separate function rather than inlining it all in a lambda. Also, because Python variables are function scoped, it's not as inconvenient to store a value from an if-else or match statement as it is in JS with its block scoped let/const variables
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- gosoccerboy5
- Scratcher
1000+ posts
js or python
You can use Also, because Python variables are function scoped, it's not as inconvenient to store a value from an if-else or match statement as it is in JS with its block scoped let/const variablesvar, or create the variable beforehand
Last edited by gosoccerboy5 (April 10, 2021 20:24:55)
- Greg8128
- Scratcher
500+ posts
js or python
I think that's what he means by ‘inconvenient’.You can use Also, because Python variables are function scoped, it's not as inconvenient to store a value from an if-else or match statement as it is in JS with its block scoped let/const variablesvar, or create the variable beforehand
- Bacteria999
- Scratcher
1000+ posts
js or python
Personally, I like Python better, programming in Javascript is weird, it's like turning your browser into an IDE. Also, Javascript looks like “made of plastic”, it doesn't feel like a real language. Also, the creator of Javascript is homophobic, and even though I'm straight, I'm going to boycott Javascript.
- gosoccerboy5
- Scratcher
1000+ posts
js or python
That makes it all the more convenient.. Personally, I like Python better, programming in Javascript is weird, it's like turning your browser into an IDE.
If Javascript is plasticky, then wouldn't C, Java, Dart, Cpp, C# all look like plastic also? lso, Javascript looks like “made of plastic”, it doesn't feel like a real language.
I probably shouldn't argue with that Also, the creator of Javascript is homophobic, and even though I'm straight, I'm going to boycott Javascript., but maybe find a new language instead of sticking with python?
Last edited by gosoccerboy5 (April 11, 2021 13:56:08)