I've been looking around for a good scripting language to use to make simple tools (such as, say, a snes checksum calculator with a proper quiet mode, damn you ucon64...).
Python is great, but the whole dispute between whether to be using version 2 or 3 syntax isn't very fun. CoffeeScript works beautifully, but has this stupid system of synchronous and asynchronous functions that I'd say aren't worth the trouble. (Seriously, this thing is designed to create makefiles, then doesn't even wait for programs to build before continuing along the path?) And JS suffers from the same mess.
So I ask, are there any better scripting languages out there, should I take a closer look at Python/CS/JS, or should I not bother and use C/C++?
I personally like
Lua for these kinds of things, but your mileage may vary.
There are many options, in any case; depends on what you find to be "better".
nicklausw wrote:
Python is great, but the whole dispute between whether to be using version 2 or 3 syntax isn't very fun.
Targeting Python 3 has been viable since Python 3.3, the version that introduced the
PEP 397 shebang parser. During the development of
Haunted: Halloween '85, I made the transition from Python 2 to Python 3.
Quote:
CoffeeScript works beautifully, but has this stupid system of synchronous and asynchronous functions that I'd say aren't worth the trouble. (Seriously, this thing is designed to create makefiles, then doesn't even wait for programs to build before continuing along the path?)
If two .s files don't depend on each other, then ideally you can run
ca65 processes to build both at the same time, so long as all finish before
ld65.
I don't know if it makes me weird, but I like PHP for these kinds of tasks. I got quite used to it because of work, and the fact that seting it up is super simple (just decompress the files, no need to install or configure anything) is a huge bonus for me.
tepples wrote:
If two .s files don't depend on each other, then ideally you can run ca65 processes to build both at the same time, so long as all finish before ld65.
The problem is that the program ends before the linker can finish. Not sure exactly how callbacks work, but I think what you're saying with multiple assembler processes is viable.
I like python because of how expressive it is. I originally wrote some tools for myself for NES development back in 2009 in C# because that's all I really had much experience in at the time. In 2014 I rewrote those tools in Python, and I recall:
-A C# method which had been 750 lines of code became 30 lines of code in Python doing the same work!
-A utility that had been 1500 lines of code in C# became 300 lines of code in Python doing the same work!
Note: That may have more to do with experience than differences in language, as I've become aware C# has many more dynamic facilities than it used to--I probably could have whittled down the original tools. But I ended up enjoying working with Python much more.
The lack of syntactical frills and nonsense makes Python an absolute joy to work with. Plus if you want to whip up some GUI tools there's an amazing, huge ecosystem of libraries out there such as PyQt.
tokumaru wrote:
I don't know if it makes me weird, but I like PHP for these kinds of tasks. I got quite used to it because of work, and the fact that seting it up is super simple (just decompress the files, no need to install or configure anything) is a huge bonus for me.
Heh, I use it because it pretty much comes preinstalled with Ubuntu and since I already learned PHP for use in servers and it can manipulate strings rather easily I may as well use it for scripts. I just installed the GD library to make image manipulation easier and that's it.
Sik wrote:
I already learned PHP for use in servers and it can manipulate strings rather easily
Exactly, it has functions for all sorts of things, including string manipulation. Many common tasks that require several lines of code in other languages can be done in a much simpler way in PHP. I lost count of how many times I searched online for suggestions on how to solve a particular problem in PHP and it turned out there was a built-in function that did exactly what I wanted!
Quote:
I just installed the GD library to make image manipulation easier and that's it.
Yeah, recently I've been using it for image processing as well. Installing GD was as easy as uncommenting a line in php.ini.
I have used PHP, AWK, SQLite, and shell scripts. Any can be useful for different purposes.
PHP isn't really the best design kind of programming language (I prefer the design of JavaScript, except for implicit semicolons which is stupid), but yes it can do many things using built-in functions, including pictures. Even recently I have used it to make a program so that you can add files to a .ZIP archive from stdin. Many things specified above about how you can easily set up PHP and so on is certainly true, and it can be used both on Windows and on Linux.
AWK is useful for simple text-processing tasks. To copy input to output: 1. To skip first line of input: x++. To process Bird-style literate programs: sub(/^> /,"").
Also note that UNIX shell scripts can even be combined with the others (if you are using a UNIX-based system).
I really didn't want to give up on coffeescript, just because the idea of it seems so cool and I've never even given something js-related a chance, and now I think I'm sticking with this.
I've gone through and added "cakefiles" to all my projects on github (check signature if curious). Note that before this, there was no proper way to make my projects other than manually look through the readme instructions, so this can only really be an improvement.
You may be thinking this is kind of a quick decision, and hey, you may be right, but I'm just happy I figured out how to make a proper-ish cakefile, and don't feel like taking the time to figure out another scripting language. We'll see where this goes.
tokumaru wrote:
I lost count of how many times I searched online for suggestions on how to solve a particular problem in PHP and it turned out there was a built-in function that did exactly what I wanted!
This a million times. More often than not when I need to do something that makes me feel lazy I realize that probably there's a PHP function for it and look it up before even attempting to try it manually. This is also why I hate working with PHP when I'm off-line (I seriously need to download a copy of the documentation).
tokumaru wrote:
Installing GD was as easy as uncommenting a line in php.ini.
Wait, PHP on Windows comes with GD already? (I'm on Ubuntu so I just installed the relevant package)
Sik wrote:
Wait, PHP on Windows comes with GD already? (I'm on Ubuntu so I just installed the relevant package)
Yeah, I downloaded the official archive and it came with everything. Just had to uncomment the line that loaded GD.
Update, uh...I have to say, callbacks have made the end of my year absolute hell. Why must java/coffeescript be like this.
Anyway, fixes occurred (two lines of code ended up changing from my original setup before bugs,) and finally finally FINALLY I can have a build system that's in a weird and somewhat unpopular language. Because I'm quirky. And original. And cool. Mwahaha.
Okay really I'm using a scripting language for my build scripts because it's a scripting language, and I can write other tools with the same language if need be. Sounds like a nice deal to me.
I'm very tired
nicklausw wrote:
finally finally FINALLY I can have a build system that's in a weird and somewhat unpopular language. Because I'm quirky. And original. And cool. Mwahaha.
Okay really I'm using a scripting language for my build scripts because it's a scripting language, and I can write other tools with the same language if need be. Sounds like a nice deal to me.
GNU Make doesn't even let you do arithmetic, so this isn't as bad of an idea as you'd think...
(still cursing the hack I had to do to get that crap working)
freem wrote:
GNU Make doesn't even let you do arithmetic, so this isn't as bad of an idea as you'd think...
(still cursing the hack I had to do to get that crap working)
Wait, why'd you need GNU Make to do arithmetic?
nicklausw wrote:
Wait, why'd you need GNU Make to do arithmetic?
Because I use arithmetic to calculate the build number when naming the package file. There's a shell trick used in the makefile of RHDE and my robotfindskitten port to calculate the number of days since the start of the project.
Take into account, GNU make was meant to be used in *nix environments and that means you could just use bc to do any arithmetic instead. (heck, sometimes I use bc when I have the terminal already open and I'm too lazy to open the calculator)
One of the reasons I like using git is that I can include VERSION = $(shell git describe --tags) in my Makefile, which will give me a result of the form "lasttag"-"numberofrevisions"-g"currentgitUID"
nicklausw wrote:
freem wrote:
GNU Make doesn't even let you do arithmetic, so this isn't as bad of an idea as you'd think...
(still cursing the hack I had to do to get that crap working)
Wait, why'd you need GNU Make to do arithmetic?
Needed to create a split set of *.c# files (with proper numbering) for Neo-Geo development. :s
freem wrote:
Needed to create a split set of *.c# files (with proper numbering) for Neo-Geo development. :s
First
Java on the Genesis, and now C# on Neo Geo?
oh wait, that'd be .cs
freem wrote:
nicklausw wrote:
Wait, why'd you need GNU Make to do arithmetic?
Needed to create a split set of *.c# files (with proper numbering) for Neo-Geo development. :s
Oh, yeah, that's WAY easier with a script, I'd imagine.
I know I probably won't like it (at least not at first) but one of these days I need to try LISP