8 ms·
https://github.com/sbcl/sbcl/tree/master/src/runtime https://github.com/sbcl/sbcl/tree/master/src/runtime
by Sir_Cmpwn 8y ago
https://github.com/sbcl/sbcl/tree/master/src/runtime https://github.com/sbcl/sbcl/tree/master/src/runtime
- phoe-krk 8y agoCLOC tells me there's 28391 lines of C and 426525 lines of Lisp in there. Also remember that Lisp has, on average, higher code density than C thanks to advanced macro usage. Pointing to C code in that repository and saying SBCL is implemented in C is like pointing to https://github.com/sbcl/sbcl/blob/master/binary-distribution.sh https://github.com/sbcl/sbcl/blob/master/binary-distribution... and saying that SBCL is implemented in Bash.
- Sir_Cmpwn 8y agoThe runtime is written in C. That's the important bit. Just because the compiler, standard library, etc, isn't - doesn't mean it's not based on C. You cannot use SBCL without a C compiler.
- phoe-krk 8y agoThe installation scripts are written in bash. That's the important bit. Just because the compiler, standard library, etc, isn't - doesn't mean it's not based on bash. You cannot use SBCL without a bash shell. /s Of course you can use SBCL without a C compiler - you simply use a precompiled version. You can't build SBCL without a C compiler.
- Sir_Cmpwn 8y agoShell scripts just slap commands together. You could just be a human interpreter reading the source and get the job done. C is a much more fundamental requirement of SBCL. Much more so than in the way SCBL depends on Python, for example (e.g. it doesn't). Listen, I get that in the ivory tower of lisp you don't like looking at the little C bricks at the bottom, but the fact is that they exist and C is a hugely important language upon which the entire modern world of computing is built.
- phoe-krk 8y agoSure, all of us execute stuff on kernels that are written in either C or C++ or C# or Objective-C, utilizing runtimes that are written in the same languages and calling APIs that are defined by the C application binary interface. That family of languages isn't going anywhere and choosing C instead of raw assembly is often chosen out of practical reasons, such as code maintainability. Still, I find it hard to put an equality sign between "X has a runtime written in C" and "X is written in C".
- Sir_Cmpwn 8y agoI said "implemented" in C. I'd argue that the runtime == the implementation.
- phoe-krk 8y agoThis doesn't really sound sane to me. In this particular case, it would mean that if you throw away SBCL's compiler, SBCL's standard library, SBCL's extensions, and replace them with something completely different, you still get the same Lisp implementation because all of the aforementioned elements aren't a part of what you call the implementation.
- aidenn0 8y agoThe runtime for sbcl is just the garbage collector and parts of the OS interface. It's not like the JVM (or e.g. GNU clisp) where the runtime is interpreting code. The OS interface for any program that is targeted at *nix is likely to be written at least partly in C, because POSIX is very hostile to non-C languages, which leaves us with the garbage collector. If the GC's implementation language is the most important thing for an implementation then every language implemented mostly in C++, but using bdwgc for garbage collection is actually implemented in C and assembly.
- pjmlp 8y agoFunny you say that, because Windows libc is actually implemented in C++ with extern "C" {} for the ISO C entry points.
- lispm 8y agoOther implementations have parts of the runtime written in Assembler, Lisp, Java, ... A bunch of languages can be used to write a Lisp runtime.
- Sir_Cmpwn 8y agoThe ones based on Java run on the JVM, which is always written in C :) The ones written in Lisp, well, at the bottom it's C again. I haven't seen a popular lisp yet with a meaningful amount of assembly in lieu of C.
- lispm 8y ago> The ones written in Lisp I have some of these exotic Lisp Machines from the 80s which run no C code by default and where the C compiler is optional and written in Lisp. ;-) Obviously exotic and outdated. An alternate world. > I haven't seen a popular lisp yet with a meaningful amount of assembly in lieu of C. https://github.com/Clozure/ccl/tree/master/level-0/ARM https://github.com/Clozure/ccl/tree/master/level-0/ARM And, yes, the assembler is written in Lisp, too.
- gpderetta 8y agoIsn't oracle vm written in C++?
- Sir_Cmpwn 8y agoAh, fair point.
- pjmlp 8y agoI bet your C compiler is actually written in C++, unless you happen to use tcc.
- aidenn0 8y agoDon't forget that much more of the code is #if'd for different architectures compared to lisp.