News for hackers. Stuff that matters.
Re:Pretty.c by nneonneo on Thursday October 24, 2024 @03:40AM (#41933039)
It claims to be a scripting language but you still have to compile the programs. Boo! Add CINT (https://root.cern.ch/root/html534/guides/users-guide/CINT.ht...) and you can have instantaneous execution and even a REPL!
Re:Pretty.c by shakna on Thursday October 24, 2024 @05:29AM (#41933769)
I'd prefer just using tcc [0]. Far lighter weight than that monster. And C, not C++.

[0] https://bellard.org/tcc/tcc-doc.html

Re:Pretty.c by maccard on Thursday October 24, 2024 @06:01AM (#41933972)
Given the idea behind this repo is to cause pain, why not add a shebang to your file [0] to make it executable.

I saw a blog post a long time ago that went into the details of how ./foo worked, and how it executed an elf file. You could register `.c` programs in the same way to be compiled and run?

[0] https://gist.github.com/jdarpinian/1952a58b823222627cc1a8b83...

Re:Pretty.c by nneonneo on Thursday October 24, 2024 @06:36PM (#41940544)
Now I have a very evil idea: what about registering a binfmt handler for the header bytes “#include”? Sure, it doesn’t handle all C/C++ programs (notably any program that dares to start with a comment), but it would not require modifying any source code!

(For even more insanity I guess you could also trigger on // and /*, although there’s some risk of false positives then!)

Re:Pretty.c by aartaka on Thursday October 24, 2024 @06:53AM (#41934238)
Well, who said that scripting language cannot be compiled? And yeah, Clang-REPL is another way to make it REPL-friendly.
Re:Pretty.c by knome on Thursday October 24, 2024 @09:10AM (#41935148)
generally they aren't, as scripting usually implies an interpreter, though no one is stopping you from using a wrapping script that quietly compiles on first run and caches a bunch of executables somewhere. not much different than python producing bytecode files as it goes along.
Re:Pretty.c by randomdata on Thursday October 24, 2024 @10:07AM (#41935634)
Script usually implies some kind of task that runs once and the exits. As opposed to a system that is expected to run indefinitely.

There are good reasons for why scripts are often interpreted and why systems are often compiled, but that's not what defines them. There are definitely scripts that are compiled and systems that are interpreted out in the wild.

Re:Pretty.c by knome on Thursday October 24, 2024 @02:43PM (#41938354)
'scripting' is an ill-defined term with many interpretations, certainly.
Re:Pretty.c by randomdata on Friday October 25, 2024 @04:44AM (#41943430)
If that is the case, pick another interpretation and describe to us what "non-scripting" then might be.
Re:Pretty.c by knome on Friday October 25, 2024 @02:01PM (#41947816)
the original definition is likely tossing shell commands in a file to run later. chaining commands together. since perl and python supplanted this, they get lumped in as 'scripting languages'. both certainly can be used to write long running systems or short one off tasks.

compiled languages are rarely used for one offs because the effort they require is usually greater than the task calls for.

a big part of perl/python use is in tying together libraries written in more difficult lower level compiled languages.

you'll also see scripting used to refer to languages embedded in larger projects. lua scripts to control entities in a game, for instance. do they compile these somehow? I never did in the little project I used lua for.

----

all of that together, I expect that scripting as a concept largely boils down to conceptually simpler languages with less view of the ugly underbelly of how things actually work in a computer, used to chain together abstractions created by lower level code.

scripting is duct-tape. whether you duct-tape together a one-off task or some wad of long running functionality is besides the point.

Re:Pretty.c by randomdata on Friday October 25, 2024 @02:05PM (#41947868)
> you'll also see scripting used to refer to languages embedded in larger projects.

Yes, but this is conceptually exactly the same as the aforementioned shell scenario. This is not something different.

Just as I suspected, there is only one definition, and one that has proven to actually be well defined to boot as you managed to reiterate the only definition I have ever known to perfection.

Re:Pretty.c by bityard on Thursday October 24, 2024 @10:47AM (#41936033)
Sure, there is no "rule" against it. But words/phrases have commonly-accepted meanings and willfully ignoring or appropriating those meanings implies either cultural ignorance or a concealed agenda.

If you want to insist that scripting languages can be either compiled or interpreted, then its better to just drop it altogether and just say "language" because the "scripting" part has utterly lost its identity at that point.

Re:Pretty.c by suzumer on Thursday October 24, 2024 @08:50AM (#41934998)