Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can run a shell command from a language you like so they're just as flexible. Go and many other languages have Exec (or equivalent).

The major reason shell scripting is nice is because its portable with a copy/paste and HelloWorld.sh doesn't need a compiler or a VM or even any preceding incantation to run.

As much as I hate that this is where my hopes are, I do hope that Powershell gets to a point where you can write single C# files and run them.



D language rdmd wrapper allows to compile-and-execute directly [1].

Together with intuitive function calling facility using Uniform Function Call Syntax or UFCS you can easily has natively compiled scripting environment [2],[3].

[1] Pragmatic D Tutorial:

https://qznc.github.io/d-tut/hello.html

[2] Why I use the D programming language for scripting (2021) (50 comments):

https://news.ycombinator.com/item?id=36928485

[3] Uniform Function Call Syntax:

https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax


You can write executable “scripts” in C by JIT compiling them with the shebang.

Tcc has the `-run` flag for easily doing this with a normal-ish shebang.

With a nasty polyglot preamble of C and bash at the top of your file, you can do it with any compiler.


That's a good thing but due to D syntax it is very intuitive and pythonic due to the default GC, in addition to the UFCS feature that I've mentioned compared to C with its agrarian syntax. That's the main reason we have C shell scripting in the form of csh with more intuitive syntax for example foreach loop that D has already supported [1].

But if you insist, D now supports and can compile C language that you can perform using rdmd [2].

[1] C shell:

https://en.wikipedia.org/wiki/C_shell

[2] Adding ANSI C11 C compiler to D so it can import and compile C files directly (105 comments):

https://news.ycombinator.com/item?id=27102584




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: