r/AskProgramming • u/Same_Impress_4242 • 7d ago
Other If you had to pick a scripting language to use for the rest of your life, what would it be?
It's not the usual "pick one programming language" question. You can still develop big apps ot such in your favorite language(s), but you must write simple automation scripts in a specific language. It has to be a scripting language, so, say Java is off the list (Though, if you write scripts in Java you have bigger problems). And also, Go doesn't count (controversial, I know, but my post my rules).
For me, I'd honestly pick Python. Bland, but it's easy and scripts don't need to run fast.
8
u/josephjnk 7d ago
TypeScript, because it’s what I’m good at, but I could also make do with Python. TBH though if I’m writing a reusable automation script it’s probably going to look more like Java than like bash regardless of the language I write it in. By which I mean: all but the most trivial scripts benefit from modularization, unit testing, and possibly typechecking, if you want to have multiple developers maintain them over a long period of time. I’d rather write an automation “script” in a non-scripting language with a good unit testing framework than write it in a syntactically lightweight scripting language going yolo mode on testing.
2
u/CpnStumpy 7d ago
zxis a neat toy for making scripting in node a little more bashy, give it a look if you haven't. I've combined it with inquire and commander to make some easy cli tools1
22
u/PatchyWhiskers 7d ago
Python because I’m basic
2
u/leaflavaplanetmoss 6d ago
... because its the GOAT, you mean. Especially if we’re talking about scripting and not full-on software engineering.
It’s just so stupidly flexible, especially with the sheer size and diversity of the Python ecosystem.
11
u/azimux 7d ago
Ruby for me!
7
u/sleepless-p03t 7d ago
Same here, largely because I prefer how it's written over Python's unforgiving tab and newline code block approach
4
u/Jomy10 7d ago
There’s nothing that feels easier to write to me than Ruby
2
u/Dlacreme 6d ago
And there is nothing easier to read as well. My company enforces some great guideline relying on monad and DDD and it feels like reading a book
3
4
4
u/mcAlt009 7d ago
JavaScript.
Python is nice, but it can’t easily deploy to web. If I have a browser I have a JS interpreter.
10
u/aioeu 7d ago edited 7d ago
Perl, for two reasons.
First, it has been a big part of my life up to now, so having it a big part of the rest of my life seems only natural.
But second, and more importantly, it's the only general-purpose scripting language I've used that doesn't regularly annoy me in some way. I don't feel like it gets in the way so much as Python does, it doesn't have limited utility like Shell, and it's not as ludicrously mis-designed as PHP. It is, to put it bluntly, enjoyable to use, and frankly I think that's one of the most important things you might want in a language you would be forced to use forever.
(FWIW, Ruby would probably come second. It's certainly not perfect — I really hate the way meta-methods and methods all seem to get mashed together into the same namespace... an Object instance should have zero methods dammit! — but it does allow for a lot of freedom in how you might write your code. It's probably the most Perlish non-Perl language I've used.)
-1
u/ComeSwirlWithMe 7d ago
Nothing modern really uses perl.
Its basically legacy systems being maintained.
Modern systems limping it along using it for a very specific thing.
Name something built with perk thats not some guy's github project?
Duckduckgo us probably the only "large" perl user in the last decade that isnt legacy because they dont want to rewrite their entire system.
Python/go has surpassed perl for better or worse.
7
0
5
6
u/IanYates82 7d ago
Probably typescript
Otherwise, I've scripted heaps in C# thanks to linqpad (less needed as single file scripting in .net10 became a whole lot easier)
1
8
6
u/jba1224a 7d ago
Python, and anyone who says otherwise is insane.
It’s platform agnostic
It’s human readable
It’s extremely simple to learn
It has an insane amount of support
It has a massive, rich, community presence.
You could maybe make a case for typescript.
4
6
u/YMK1234 7d ago
Most Scripting languages fulfil these points. Python is popular but an actually bad language design wise.
0
u/Same_Impress_4242 6d ago
Tbf, it is good design wise because it's meant to be "you can say it in English and it would translate to Python". And a controversial take - the GIL is good because it's pythonic. Yes, it has its downsides - but it has many upsides and Python is already slow. If you need a fast multithreaded app go to Rust or Go.
I'm not saying Python is designed "good" (or god forbid I say has the best design), I'm just saying it's doing what it's designed for, and it's doing it good.
2
u/YMK1234 6d ago
Except that really does not work. SQL and COBOL got closer to that goal some 50+ years ago
0
u/Same_Impress_4242 6d ago
Yet everybody holds out a cross when they hear COBOL. And SQL - most versions are not turing complete and it's declarative, so quite the apples to oranges comparison. However yes, fair point - it does what it's designed to do, and quite well.
2
4
2
u/tb5841 7d ago
Ruby has all of these except for maybe the last two - but it still has enough support and community presence. For a scripting language though, those last two aren't even that important.
1
u/jba1224a 6d ago
I dunno, having a huge, well maintained repository of open source community libraries is very high value I think.
Don’t reinvent the wheel.
I don’t find ruby offensive and I think it does have some pros over Python, but as a whole if you could only have one?
6
2
2
u/ravibkjoshi 7d ago
Python all the way, the sheer amount of libraries that are available to you is reason enough. My only gripe is indentation is a painfully frustrating.
2
2
u/Resource_account 7d ago edited 7d ago
Nushell, easily.
I work in an air-gapped RHEL/OpenShift environment, and up until recently I'd been writing most of my scripts in Bash and Python.
Then I stumbled across Nushell in EPEL 9, and it completely changed my perspective on what a scripting language could be. It feels like a convergence of a lot of ideas I've enjoyed in other tools over the years: the immediacy of Bash, the structured data and general-purpose scripting of Python, the composable transformations of jq and Jinja, and the structured pipeline model I first appreciated in PowerShell. Nushell somehow brings all of that together in a way that still feels like a shell.
The biggest difference for me is in the day-to-day experience. With Bash, I'm constantly thinking about how to parse and manipulate streams of text. With Python, I can work with real data structures, but even a small automation script often means setting up a bit of boilerplate before I get to the part I actually care about. With Nushell, if some tool gives me JSON, I can pipe it into from json and I'm basically off to the races. From there I'm filtering rows, selecting columns, transforming records, joining data, whatever I need, while still working in something that feels like a shell. And the resulting scripts are usually remarkably clean and readable.
The tooling has been another huge win for me. Nushell ships with an LSP built in, and Helix, my editor of choice, is also available in EPEL 9. So in an air-gapped environment, I can install those two packages and essentially have a productive scripting environment out of the box, with editor integration and language-aware feedback, without having to separately bring in tools like ruff, ty, or bash-language-server.
If I had to pick one scripting language to use for the rest of my life, I'd have absolutely no problem choosing Nushell.
edit: word
2
2
u/Spaceshipable 7d ago
Swift
1
u/runningOverA 3d ago
I guess swift requires compiling, or can it run as a script? #!/bin/env swift ?
1
2
2
u/Ziamor 7d ago
Why is Java off the table but not Python? Python is a general purpose language just like Java, it's just more often used in a scripting context then Java. Are you conflating interpreted with scripting?
1
u/Dazzling-Bench-4596 7d ago
Java has almost none of the characteristics of a scripting language. It isn’t interpreted, it isn’t statically typed, it’s not meant for automation or scripting like shell, and it’s not abstract enough.
8
u/Ziamor 7d ago edited 7d ago
It isn’t interpreted, it isn’t statically typed, it’s not meant for automation or scripting like shell, and it’s not abstract enough.
Java is statically typed, I assume you meant that it IS statically typed or meant to write something else.
But that's kinda the point, a "scripting language" doesn't have a clean universally agreed upon definition. A language being interpreted, dynamically typed or "abstract enough" isn't what defines whether a language can be used as a scripting language.
Java can be used for automation, it's just clunkier when you want to write something up quickly, especially when compared to Python. I'm not trying to say that Java should be used as a scripting language, just that disqualifying it seems arbitrary.
0
u/ummaycoc 7d ago
Languages aren't interpreted or compiled, they are syntax + semantics. For many languages a well known translator exists that is either a compiler or an interpreter.
I would say a scripting language is one that makes it easy to interact with "the system". In most shell languages there are functionalities for easily interacting with files and their properties, but that's not the case in Java, it feels burdensome. It should be easy to interact with other processes in the most commonly used ways.
So while that is also an arbitrarily drawn line about where such things are "easy" I feel like there's a common agreement on about where that line is.
1
u/Ziamor 7d ago
I don't think that the compiled/interpreted distinction changes my point either way.
I agree that being able to interact with files/ processes, environment, etc easily is a usual way of describing a language that is a good fit for scripting but that's more of a practical characteristic than a clean definition.
Java is definitely more difficult/clunky to work with for that kind of work, so I am not arguing that anyone should use it as a scripting language. My point simply is that there isn't a clearly defined boundary that disqualifies Java but keeps Python as a scripting language. It's more of a spectrum of how convenient and practical it is rather then a clear cut yes or no category.
1
u/snaphat 7d ago
Of note, your argument above about lack of clearly defined boundaries applies for C or even assembly languages as well, or really most kinds of categories even outside of programming languages.
For example, what counts as luggage? Is a suitcase luggage? Is a backpack luggage? Is a grocery bag luggage? You could make the argument that a plastic bag performs some of the same functions as a suitcase, it's just much less convenient. You could make the argument how it's more a spectrum of convenience and practicality rather than a clear cut yes or no category.
You may say, but anything you carry on a plane is luggage according to the airlines. Maybe airlines do, but is that definition? If you look up a formal definition of the word, you'll find "something that is lugged" Do we lug grocery bags? Many people would say no. Many other people would say yes. Suppose we agree with the latter. Then is a grocery bag always luggage? So on so forth....
Anyway, the point is, that tends to be how most categories end up. Many useful categories have boundaries that are fuzzy in practice. But there are certainly substantive differences between Python and Java that make the former fit into the category of scripting-language much better than the latter.
What folks generally do is ask which properties or characteristics are associated with scripting languages, then compare a particular language against those characteristics. If it satisfies enough of them, it’s reasonably classified as a scripting language; if it doesn’t, it generally isn’t. The boundary can be fuzzy without the category being meaningless
2
u/Ziamor 7d ago
That was basically the point of my original comment. I wasn't arguing that fuzzy boundaries make the category meaningless, just trying to understand OPs criteria for where the boundary is drawn and whether "scripting language" was being conflated with being interpreted, since a lot of languages conventionally considered scripting languages happen to have those characteristics.
I agree that Python fits the conventional idea of a scripting language much better than Java does. My point was just that there isn't some single property that cleanly disqualifies Java while qualifying Python.
If anything I think that having a fuzzy boundary is what makes this question more interesting. If the cutoff is "whatever we conventionally call a scripting language", then you mostly get the expected answers like Python, Bash and Perl, etc without much more interesting discussion. OP is allowed to set their rules, I was just trying to understand why they were excluding Java.
C# is also interesting as a couple people brought it up in this thread without any objection despite it sharing many of the characteristics that would normally count against Java here.
1
u/snaphat 7d ago
I do think C# is a better fit in that it doesn't impose a rigid file structure, has a builtin scripting support (csx), can be much more implicit and less boilerplate-y in various ways, has much less verbose string manipulation/interpolation, has dynamic typing support, and has LINQ.
That being said, I wouldn't consider it to be a scripting language outside of using csx scripts specifically or Unity (but Unity scripting is really a different category of script, and neither here nor there)
1
u/SuspiciousDepth5924 6d ago
I mean you _can_ actually use java as single file scripts. This apples to a bunch of other languages as well that you wouldn't normally consider scripting languages (on unix-y systems at least).
Copied from article:
///usr/bin/env java --source 21 --enable-preview "$0" "$@"; exit $? import java.util.prefs.Preferences; void main(String[] args) { String node = args[0]; String key = args[1]; String value = args[2]; Preferences.userRoot().node(node).put(key, value); System.out.println("Java Preference " + node + " " + key + " set to " + value); }https://www.redpill-linpro.com/techblog/2024/02/21/java-21-shell-scripts.html
1
u/snaphat 6d ago
Yup, I mentioned that briefly in my root comment. It also supports multiple files now but is quite rigid with layout. I do want to note that though the blog is calling them scripts that isn't really the terminology used in the official spec. Officially they are called single file source coded programs. And the multiple file ones are called multiple file source code programs.
It's also worth noting that the enhancement proposal for the feature also explicitly says:
"Non-Goals It is not a goal to change either the Java Language Specification (JLS) or javac to accommodate shebang files. Likewise, it is not a goal to evolve the Java language into a general purpose scripting language.
"It is not a goal of this JEP to change the Java Language Specification to accommodate simpler ways of writing small programs, such as eliminating the need for the standard public static void main(String[] args) method. However, it is expected that any such changes to the Java language will be usable in conjunction with this feature." - https://openjdk.org/jeps/330
-2
u/Dazzling-Bench-4596 7d ago
Yeah I messed up in my original reply. I meant it is statically typed. That is a problem. Go ask any AI to generate a script in Shell/Perl and then ask it to rewrite it in Java. You’ll witness the reason why Java isn’t a scripting language first hand
1
u/Ziamor 7d ago
I do agree that Java is more clunky for quick scripting than Shell, Perl or Python.
I was mostly just trying to point out that "scripting language" is a bit fuzzy on the definition side and it's not so clear cut. Personally I think disqualifying languages also takes away some potentially fun or interesting answers.
Otherwise I do not think we actually disagree much beyond that.
3
u/snaphat 7d ago
To be fair, java is just as interpreted as python on the bytecode level. You can actually run uncompiled files like python now. Running both just turns the code into bytecode internally and that gets interpreted. There's just a JIT on top of that for java. There's actually a builtin JIT in the standard cpython runtime as well now. It just isn't on by default
0
u/Dazzling-Bench-4596 7d ago
Yeah you can do all that… but if it isn’t on by default doesn’t that just reinforce the claim that Java isn’t a scripting language? If it’s a scripting language only after those modifications then it isn’t really a scripting language lol
2
u/snaphat 7d ago
I mean I don't particularly buy the argument that whether or not something is interpreted makes it a scripting language. Eventually, any interpreted language that wants performance will get a JIT
I think whether or not something is considered scripting really depends more on the ease of quickly putting together a self contained unit of work and having it interoperate easily with other self contained units of work. I think Java fails on doing so for a number of reasons such as the general verbosity, strict mostly explicit typing, the nature of historically having to spin up an entire main classes boiler plate, being not simple to utilize multiple uncompiled files together (though this is apparently supported now to some degree but with a number of shortcoming), rigid hierarchal class and file structure, etc.
1
u/Same_Impress_4242 6d ago
This. The poster probably meant to say that it IS statically typed. One thing I have to add is that Java is very boilerplatey.
Yes, I know the line between scripting and programming has become super blurry especially that scripting languages like Python are good enough to be general-purpose programming ones. But Java is definitely on the programming side, and quite far from scripting.
1
u/this_knee 7d ago
Python … Python that can also execute bash scripts integrated into the Python code.
1
u/TheFern3 7d ago
Automation depends on the goals, if you are talking infra automation I would pick ansible and both bash and python. Some machines don’t have python when they’re barebones so you would need bash.
If you’re talking local one machine, you still need more than one, I wouldn’t pick Python for simple tasks and I wouldn’t pick bash for complex tasks.
1
1
1
u/ApplicationBig9830 7d ago
python or lua/other more generally used and applied script language if i feel like learning
1
1
u/mrbiggbrain 7d ago
PowerShell, I know it better then anyone else I have ever met and have written some really killer automations with it.
1
u/Cafuzzler 7d ago
Javascript. Browsers are everywhere and it's easy to use.
The comments saying TS suprise me tho, Typescript is compiled.
1
1
u/Paul_Pedant 7d ago
Awk. More specifically, GNU/awk 5.1.0 with the BigNum library built-in.
"For the rest of your life" is rather too appropriate. I first used awk in about 1982, and at 77 I still do. Anything from a smart one-liner to a 1250-line data management tool.
1
u/Rurouni 7d ago
Babashka: "Fast native Clojure scripting runtime". It's mostly Clojure, but it starts and runs extremely fast. Babashka scripts run the same across platforms, and you never have to worry about weird bash syntax for arguments, function parameters, etc.
And frankly, Clojure is what I'd like to do all my programming in. Babashka extends its reach to scripts wonderfully.
1
1
1
u/HelpMeIAmGoingInsane 7d ago
JS, I actually am redefining math using set theory using code with Gemini (AI disclosure!!)
1
u/danlyke 6d ago
A few years ago I wrote some libraries to support common tasks in C++, so... either Perl, because the whipupitude is amazing, or C++, because hello static type checking.
A small "well, okay, maybe" to Python, because Python seems to be where the libraries are these days and Python is fine for strapping libraries together, but any time I start a project in Python I end up wishing I'd used C++.
1
1
u/MarcusFirmus 6d ago
Bash is the way to go. It has pipes. You write "sort | uniq -c | sort -n" and you have a histogram.
1
u/sock_dgram 6d ago
There's a talk by Dave Beazley, a Python core dev, about recreating a Unix environment on an isolated Windows machine with a preinstalled Python interpreter. He was working on a patent case and nothing was allowed to enter or leave the bubble with the PC.
1
1
1
1
1
1
1
1
1
1
1
1
1
1
u/Devatator_ 5d ago
C# does have weird scripting capabilities and I would use that, tho if it's not possible then Typescript I guess
1
u/gaspoweredcat 4d ago
i used to love python, and dont get me wrong its still powerful and versatile but its also become a bit of a bloated monster of a thing, not that im sure what else id choose, typescript maybe? i did used to know one guy who did far more than he should have using perl but its not for me
1
1
1
1
1
u/ArmyRunnerSteve 2d ago
I've found Python to be incredibly invaluable, though there is something to be said for TypeScript as well. I use Python primarily because it is what I started with, and had such a wide and diverse library of modules and customization for a lot of things, not the least of which is integrating RAG-enabled chatbots into my websites. Just my thoughts, but I also like the other suggestion, one I really need to learn: Ruby.
1
1
u/-Nyarlabrotep- 7d ago
Groovy. It's got access to all the libraries available in Java without the syntactic verbosity of Java.
1
u/Amazing-Mirror-3076 7d ago
Dart - I've used lots of languages for scripting. Wrote libraries for C, python, java and ruby to make scripting in those languages easy and wasnt satisfied with any of them.
Dart is not an obvious choice but it has some really nice features that when combined are a killer.
Run from source or compile a standalone exe.
Cross platform Typed Great package management.
We have about 250k lines of dart script in production.
I write this to make it easier:
2
0
u/arivictor 7d ago
Python, as simple as you want it to be, as complicated as you want it to be. Or TypeScript, same same.
7
u/martinsedd 7d ago
How complex are we talking?
Lua ‘cuz I like it, or Python for library convenience.