One of the biggest problem with these repl for complied languages is that they panic as soon as you rerun a command. `cling` integrates with Jupyter notebook too but as soon as you rerun a declaration of a variable, everything collapse and you have to reset the kernel. Maybe I didn’t dig deep enough and there is a way around this but if not, this is quite painful to deal with and a deal breaker.
This is really cool, nice work. I especially like the bit about putting a REPL statement in a source file to have it drop into bic. Seems like a quick and dirty way to debug without having to fire up gdb and such. Somewhere in between print statements and full on debugging.
Technically, you should be able to just call exit(1) because of the C's support for "implicit function declarations".
With no prior exit() declaration, the C compiler would assume that "exit" is "int exit()", spit out the code to push whatever arguments are passed to it down the stack and then just call the damn thing. So, magically, it will all just work. Requires an older compiler though, C89 the latest.
Modern GCC and Clang still support implicit functions. They just complain about it by default. (Mostly for reasons that shouldn't be entirely relevant to modern x86.)
> Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application
What does dependency-free mean? I mean, it does depend on 128 crates. Do we typically not count those?
By the way, I did `cargo build` and it failed at `#include "utf8proc.c"`. I have `libutf8proc` installed. Changing `.c` to `.h` solved it. It went past that part, only to get:
- error: couldn't read cli/src/../../lib/binding_web/tree-sitter.js: No such file or directory (os error 2)
- error: couldn't read cli/src/../../lib/binding_web/tree-sitter.wasm: No such file or directory (os error 2)
Interactive C environments were popular for a while. I have collected information on several at the Computer History Museum. I actually have even more stuff that I never got around to uploading.
You unfortunately need to make an account to see the pages. It was heavily attacked at one time and that was the admin's solution.
One cool trick for C REPLs is to grep the man page directory to automate those pesky #include lines, e.g. https://gist.github.com/jart/5d0934d26b52f38cad36 Another trick is to build with STABS and use objdump -g.
One of the biggest problem with these repl for complied languages is that they panic as soon as you rerun a command. `cling` integrates with Jupyter notebook too but as soon as you rerun a declaration of a variable, everything collapse and you have to reset the kernel. Maybe I didn’t dig deep enough and there is a way around this but if not, this is quite painful to deal with and a deal breaker.
27 comments
[ 3.0 ms ] story [ 74.4 ms ] threadThanks for sharing.
I suppose you could always quit abruptly, though...
With no prior exit() declaration, the C compiler would assume that "exit" is "int exit()", spit out the code to push whatever arguments are passed to it down the stack and then just call the damn thing. So, magically, it will all just work. Requires an older compiler though, C89 the latest.
[1] https://github.com/tree-sitter/tree-sitter
I'll take a look at tree-sitter. If I get syntax highlighting for free then I'll take that!
What does dependency-free mean? I mean, it does depend on 128 crates. Do we typically not count those?
By the way, I did `cargo build` and it failed at `#include "utf8proc.c"`. I have `libutf8proc` installed. Changing `.c` to `.h` solved it. It went past that part, only to get:
- error: couldn't read cli/src/../../lib/binding_web/tree-sitter.js: No such file or directory (os error 2)
- error: couldn't read cli/src/../../lib/binding_web/tree-sitter.wasm: No such file or directory (os error 2)
Here's a link to a brief description:
https://books.google.com/books?id=fHghpJa3va4C&lpg=PA167&ots...
And, yes, I paid the $295 for it.
You unfortunately need to make an account to see the pages. It was heavily attacked at one time and that was the admin's solution.
Interactive C Environments http://www.softwarepreservation.org/projects/interactive_c