Earlier quoted context omitted.
Could you pretty, pretty please allow for an option to have automatic parentheses insertion, similar to how javascript will insert semicolons, making them optional? This is almost exactly the language that I've been planning for the last six months, and if you would be so kind as to implement that one feature, it would save me a lot of reinventing the wheel. I was originally envisioning having the compiler being able…
If you don't want the parenthesis then why not use reverse polish notation?
Carp: a statically typed lisp, without a GC, for high performance applications
41–50 of 71 posts
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#42Earlier quoted context omitted.
Very simple. The compiler, written in lisp (with a GC) just generates C code, which is compiled and executed. Without any GC, it tracks the vars.
No, not simple. Analyzing an arbitrary lisp program to determine the lifetimes of all allocated structures reduces to the halting problem, so it's undecidable. You must either restrict the input program or tolerate some leaks.
Well, Carp is a dialect of Lisp so it's free to impose whatever semantics it wants. It's not a dynamically-typed language (where it would indeed be impossible to statically manage memory).
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#43Earlier quoted context omitted.
No, not simple. Analyzing an arbitrary lisp program to determine the lifetimes of all allocated structures reduces to the halting problem, so it's undecidable. You must either restrict the input program or tolerate some leaks.
>arbitrary lisp program Well, Carp is a dialect of Lisp so it's free to impose whatever semantics it wants. It's not a dynamically-typed language (where it would indeed be impossible to statically manage memory).
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#44Earlier quoted context omitted.
> In contrast, the compiler generates GC-free code. Yes, but the question was how it does that. Does it reject code where it cannot reliably detect lifetimes? Or does it generate code that just does not deallocate (i.e., that leaks) objects whose lifetime the compiler can't determine? Both of these are "GC-free"...
The compiler does lifetime analysis, and there is a "reference borrowing" concept like in Rust.
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#45To the author: please, please, please port (or reuse) LuaJIT's C-header parser for FFI; it's the best FFI interface specification method if seen among JNI, Python, V8 and even C# (because you can just use the C header, with support for typedefs, unions and packing). It really looks like a great language!
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#46Earlier quoted context omitted.
1. Yes, and yes! 2. No plans for inheritance at the moment, probably some kind of interfaces but that's not a top priority right now. Custom types are limited to structs, I will add union types soon 3. This has not been decided yet, I want to do more research before settling on any particular solution. It will be a high priority though, since I want to use it for the games I write Thanks, Erik
Thanks! Re 1: are there any examples of this in the codebase? I haven't seen anything in the "examples/" subdir, did I overlook, or should I dive somewhere into the compiler/runtime codebase? Also, some more questions still, if you wouldn't mind: • Could you possibly answer junke's question? https://news.ycombinator.com/item?id=12041555 I didn't repeat it, as I hoped you'd see it too; • Do you have tail-recursion? Al…
I'm being very conservative with adding different type constructs but sure, Rust & Go certainly gets a lot of things right in that department and I'll consider their solutions for the future development of Carp.
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#47Earlier quoted context omitted.
The compiler does lifetime analysis, and there is a "reference borrowing" concept like in Rust.
So it rejects code for which it can't prove lifetimes. Why not just say so? There's an uncomfortable degree of beating around the bush in this thread.
Also: will be/is the lifetime-checking done in the same way in the interpreter, even though it uses GC? Otherwise, those are in effect two, I think significantly different dialects of the language.
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#48This is fantastic. AFAIK there are no Lisps our there that are designed with games in mind which is a huge shame because I often think how perfect it'd be for game dev (Arcadia and Nightmod spring to mind but imo they're shoehorns. Good ones, but still).
https://en.wikipedia.org/wiki/PreScheme
I imagine some techniques behind Chicken Scheme in area of optimization might help it too.
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#49Earlier quoted context omitted.
Thanks! Re 1: are there any examples of this in the codebase? I haven't seen anything in the "examples/" subdir, did I overlook, or should I dive somewhere into the compiler/runtime codebase? Also, some more questions still, if you wouldn't mind: • Could you possibly answer junke's question? https://news.ycombinator.com/item?id=12041555 I didn't repeat it, as I hoped you'd see it too; • Do you have tail-recursion? Al…
No tail recursion at the moment but it's something I'd be interested in adding later. I'm being very conservative with adding different type constructs but sure, Rust & Go certainly gets a lot of things right in that department and I'll consider their solutions for the future development of Carp.
https://en.wikipedia.org/wiki/PreScheme
I still don't see a clear answer to junkie's question despite a huge thread. Let's be specific: "Where no GC is used, how exactly do you handle the issue of memory safety? Is it no safety like C, a specific analysis like Rust, or something different entirely?"
Far as concurrency, you probably know about Rust's scheme. The ones that came before it that you might want to consider were Ada Ravenscar and Eiffel's SCOOP.
https://en.wikipedia.org/wiki/Ravenscar_profile
http://www.sigada.org/ada_letters/jun2004/ravenscar_article....
https://en.wikipedia.org/wiki/SCOOP_(software)
http://cme.ethz.ch/publications/
SCOOP might be the more interesting of the two for you. It was deployed in real-world apps in Eiffel first. Then, a team ported it to Java. It had a performance penalty. One of the many works in publications... don't remember which... did something ("slices?") that knocked out almost all that overhead. Another model-checked it to eliminate a few errors in SCOOP model. I see one on message-passing. So much badass work and results on SCOOP model I've been annoyed that it was ignored by mainstream for so long.
So, hope those help in your thinking on tackling concurrency. Personally glad I looked it up for you as I found this very, interesting project for safe use of GPU's:
http://se.inf.ethz.ch/people/poskitt/publications/Kolesniche...
Re: Carp: a statically typed lisp, without a GC, for high performance applications
#50Earlier quoted context omitted.
The compiler does lifetime analysis, and there is a "reference borrowing" concept like in Rust.
So it rejects code for which it can't prove lifetimes. Why not just say so? There's an uncomfortable degree of beating around the bush in this thread.
That is, it's not just "rewrite your program until the prover succeeds".