News for hackers. Stuff that matters.
Re:The Norway Problem by eitland on Saturday April 03, 2021 @03:49AM (#26679090)
There exists a couple of mainstream languages that are full of these sorts of interesting behavior, one of them is supposedly cool and productive and the other is supposedly ugly and evil.
Re:The Norway Problem by brohee on Saturday April 03, 2021 @12:58PM (#26682626)
The "Wat?" Talk got quite a few example and is hilarious.

https://www.destroyallsoftware.com/talks/wat

Re:The Norway Problem by lunfard00 on Saturday April 03, 2021 @05:00AM (#26679403)
and yet I don't see anyone complain about bash which is arguably far worse than those 2. When things get hard on bash, you will start to see python scripts on CI and whole thing is complete unreadable mess
Re:The Norway Problem by masklinn on Saturday April 03, 2021 @06:34AM (#26679852)
> I don't see anyone complain about bash

You're not looking really hard then, but really

> When things get hard on bash, you will start to see python scripts

That's kinda the thing innit? Unless the system specifically only allows shell scripts (something I don't think I've ever encountered though I'm sure it exists) it's quite easy to just use something else when bash sucks, so while people will absolutely complain about it they also have an escape: don't use bash.

When a piece of software uses YAML for its configuration though, you don't really have such an option.

Furthermore, bash being a relatively old technology people know to avoid it, or what the most common pitfalls are. Though they'll still fall into these pitfalls regularly.

Re:The Norway Problem by lunfard00 on Saturday April 03, 2021 @08:55AM (#26680673)
There is a lot of elitism around bash, like the "Arch btw" thing but far worse because a lot of important things depends on it.

Powershell has been working on linux for quite a while now and doesnt seem get any attention even when it has a nice IDE support and copy the good things about bash.

Re:The Norway Problem by lokedhs on Saturday April 03, 2021 @11:07AM (#26681626)
It doesn't copy all the good things about the Unix shell though.

The reason people are comfortable with the POSIX shell is because you use the same syntax for typing commands manually as you do for scripts. But, you're going to have a hard time finding people who prefers writing:

    Remove-Item some/directory -recursive
Rather than

    rm -fr some/directory
People who write shellscripts are often not seeing themselves writing a "program". They are just automating things they would do manually. Going to an IDE in this case is not something you'd consider.

I happen to be very aware of all the pitfalls in POSIX shell, and it's rare that I see a shellscript where I cannot immediately point out multiple potential problems, and I definitely agree that most scripts should probably be written in a language that doesn't contain so many guns aimed at the user's feet. I'm just pointing out a likely reason why people are not adopting powershell in the huge numbers that Microsoft may have hoped for.

Re:The Norway Problem by majkinetor on Saturday April 03, 2021 @12:06PM (#26682125)
Nonsence. This is the same in powershell:

    rm -r -f some/directory
Re:The Norway Problem by disgruntledphd2 on Saturday April 03, 2021 @05:49AM (#26679630)
Bash is a total disaster, I complain about it all the time. Unfortunately, rather like JS, it's unavoidable.
Re:The Norway Problem by eitland on Saturday April 03, 2021 @07:09AM (#26680036)
I'd not consider bash a

1. mainstream

2. programming language

(of course technically it is a programming language, but it is also more precisely a scripting language)

Re:The Norway Problem by drno123 on Saturday April 03, 2021 @04:00AM (#26679141)
Python vs JavaScript?
Re:The Norway Problem by speedgoose on Saturday April 03, 2021 @04:29AM (#26679256)
Python vs PHP also.
Re:The Norway Problem by pansa2 on Saturday April 03, 2021 @04:36AM (#26679293)
> full of these sorts of interesting behavior

I don’t think that applies to Python - it’s quite strongly (although not statically) typed. I agree that it does apply to JavaScript and PHP.

Re:The Norway Problem by exyi on Saturday April 03, 2021 @09:08AM (#26680758)
I think this applies to Python pretty well. Although certainly not as bad as PHP, most JS traps also exist in Python (falsy values, optional glitchy semicolons, function scoped variables, mutable closure). There is many JS specific traps like this and also other Python specific ones (like static fields are also instance fields, Python versions and library dependency hell). However I find it easier to avoid them in JS than in Python with TypeScript, avoiding classes, ...
Re:The Norway Problem by eitland on Saturday April 03, 2021 @06:53AM (#26679940)
Javascript and PHP is correct.