Programming thread

Respectfully disagree, but I still love you. Having a well-defined idea of what you're building can help you stay focused and not get bogged down by experimental or unessential features. And as a freelancer, I insist on having a well-defined spec of what a client wants me to build before I start any work both to avoid feature creep from the client (or, more typically, so when feature creep inevitably happens, I can explain why I'm spending more time than I estimated) or even the case where I spend dozens of hours building something for a client and they say "this isn't what I had in mind at all" and refuse to pay for it, as happened a couple times early on in my freelance career.

In your case, though, it sounds like you're just fooling around and seeing what you can do, the programming equivalent of doodling loops in a sketchpad, so I can understand that you wouldn't have any well-defined long-term goals for it yet.
It's one thing to have a well defined spec. It's another matter to speak publicly about it. I think the latter is what he's trying to avoid, which I get.
 
D4AC325E-A52F-469D-A06F-70CBEBCA428D.png

Surprised to have read that Perl was at one point considered to be one of the worst programming languages for developers

I think next to Ruby, Perl might be the best to study.
 
I'm not sure if you're posting this as someone for or against Perl, but that sample is a little unfair. It's basically a bunch of regular expressions, which are going to be the same in every language and if you need to analyze some text but you don't know how to use them already, you're going to have a bad time no matter what language you're using.

I think the worst part of that code is chomp $ligne;. What does it do? Is it a function call? $origin_LANG also comes out of nowhere so I presume it has JavaScript/PHP-style variable scope (though just because you can do that sort of wild scoping doesn't mean you should and "modern" PHP isn't written this way).
 

most of these are regexes and I would rather use a real XML parser such as one builtin to python than using regex


I got a kick outta this meme

1627693701347.png
 
I'm not sure if you're posting this as someone for or against Perl, but that sample is a little unfair. It's basically a bunch of regular expressions, which are going to be the same in every language and if you need to analyze some text but you don't know how to use them already, you're going to have a bad time no matter what language you're using.

I think the worst part of that code is chomp $ligne;. What does it do? Is it a function call? $origin_LANG also comes out of nowhere so I presume it has JavaScript/PHP-style variable scope (though just because you can do that sort of wild scoping doesn't mean you should and "modern" PHP isn't written this way).
Oh, I’m for Perl. The sample in question was the same one that used for the article. It probably wasn’t the best choice of text to use for them, in my opinion. The syntax for Perl is pretty interesting to study.
 
Oh, I’m for Perl. The sample in question was the same one that used for the article. It probably wasn’t the best choice of text to use for them, in my opinion. The syntax for Perl is pretty interesting to study.
this reminds me: I always see sed and awk used in bash scripts and I've always used python for simple string tasks because that's what I'm profecient at but someday i'll sit down and actually learn the basics of either
 
this reminds me: I always see sed and awk used in bash scripts and I've always used python for simple string tasks because that's what I'm profecient at but someday i'll sit down and actually learn the basics of either
I find shell script to be quite lovely to work in on linux, so I would not be afraid of that. Batch script on windows is pure eldritch horror.
 
Perl is a terrible language. It's what happens when a linguist decides to write a "natural feeling" language. It feels great to the monk using it at the time. that's it. Executable line noise.
Perl's syntax is just ALGOL syntax with sugar on top - different types have different diacritics telling you how they're read - $ for scalar, % for hashmaps, @ for vectors iirc. That's it, you know Perl.
this reminds me: I always see sed and awk used in bash scripts and I've always used python for simple string tasks because that's what I'm profecient at but someday i'll sit down and actually learn the basics of either
Enjoy
 
I'm not sure if you're posting this as someone for or against Perl, but that sample is a little unfair. It's basically a bunch of regular expressions, which are going to be the same in every language and if you need to analyze some text but you don't know how to use them already, you're going to have a bad time no matter what language you're using.

I think the worst part of that code is chomp $ligne;. What does it do? Is it a function call? $origin_LANG also comes out of nowhere so I presume it has JavaScript/PHP-style variable scope (though just because you can do that sort of wild scoping doesn't mean you should and "modern" PHP isn't written this way).
The sample code is straightforward if you're already versed with Perl, and admittedly if you're coming from PHP or JavaScript there's going to be shorthand in the language itself that's not immediately obvious. chomp is a language construct that safely lops off newlines from a string; parentheses optional here.

Aside from appearing to use regular expressions to parse HTML, the biggest affront to me is that it appears to not use strict and use warnings, or those undeclared variables would be flagged by the interpreter. It's not what you would call "modern" Perl.
 
this reminds me: I always see sed and awk used in bash scripts and I've always used python for simple string tasks because that's what I'm profecient at but someday i'll sit down and actually learn the basics of either
Why not do both and create some franken code.

Python:
import subprocess
first = ['echo', 'I am gay']
second = ['awk', '{print $3}']
p1 = subprocess.Popen(first, stdout=subprocess.PIPE)
p2 = subprocess.Popen(second, stdin=p1.stdout, stdout=subprocess.PIPE)
p1.stdout.close()
output = p2.communicate()[0]
print('What am i?\n' + str(output))
 
I use Python for any remotely serious scripting task; shell scripts are so hilariously easy to fuck up it's amazing anyone writes anything longer than 10 lines in them. Just look at how such a simple task as splitting a string into an array in Bash has so many wrong answers.

I don't care that Python runs slow; correctness beats speed. The reliance of nerds on POSIX shell and its derivatives is a form of Stockholm Syndrome, and it will take centuries for humanity to recover.

(Note, this isn't the same as saying grep and awk and the other utilities are bad, I'm specifically talking about the shell language. You can invoke those tools in any language you want.)
 
Last edited:
I use Python for any remotely serious scripting task; shell scripts are so hilariously easy to fuck up it's amazing anyone writes anything longer than 10 lines in them. Just look at how such a simple task as splitting a string into an array in Bash has so many wrong answers.

I don't care that Python runs slow; correctness beats speed. The reliance of nerds on POSIX shell and its derivatives is a form of Stockholm Syndrome, and it will take centuries for humanity to recover.

(Note, this isn't the same as saying grep and awk and the other utilities are bad, I'm specifically talking about the shell language. You can invoke those tools in any language you want.)
Your arguments are correct, it's just that I wouldn't use Python, (or Perl) that's all.
 
I forgot if I said this already but I have been learning and reading about modern javascript, which is actually much better and nicer than it used to be with the introduction of ES6 and future stuff. The use of Promises, while they can be finnicky, is a powerful and correct way to do async code. They introduced classes as we know them instead of the previous prototype inheritance. The use of `let` has more reasonable scoping than previously used `var`. There are some nice basic functional tools like map (I don't use much else). For my projects I have not dabbled in Node and I use javascript the way it was intended: to make pretty graphs and menu bars and so on, with a little bit of math for the graphs.
 
  • Like
Reactions: HolocaustDenier
I try to stay far away from JS because I don't like it as a language. for that reason when i have to do web dev, I usually use Django, flask or Blazor for the bigger projects. What I really like about Blazor, is that you can write basically in C# you can but don't really need to write html for a lot of functions.
 
  • Informative
Reactions: Lucario
I really really wish the Javascript devs went with ES4 back in the 2000's as it would have been a lot of what JS is today but even nicer but oh well :(
 
I try to stay far away from JS because I don't like it as a language. for that reason when i have to do web dev, I usually use Django, flask or Blazor for the bigger projects. What I really like about Blazor, is that you can write basically in C# you can but don't really need to write html for a lot of functions.
when i do web dev, i usually write in C++ and use FastCGI because it's based and no bloated server-side frameworks
 
Back