Live data from Hacker News

Carp – A statically typed Lisp, without a GC, for real-time applications

github.com

51–60 of 139 posts

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#51
post #18

What's the difference between it and Common Lisp? Isn't Common Lisp also AOT compiled?

AOT doesn't necessarily mean GC-less, right?

Maybe they actually mean VM-less, which would probably imply GC-less because if you have a GC, you pretty much have a VM doing the GC (unless it's simple ref-count). For embedded, you need VM-less, I think, as VMs tend to be too heavy.

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#52
post #3

Anyone who had used or tried Carp and Janet (that was on frontpage the other day)? What are some strong points on Carp vs. Janet?

Janet is dynamic with a garbage collector. Carp is a GC-less static Lisp with deterministic memory allocation via a Rust-like borrow checker. I only wish Carp had stayed nearer Clojure's syntax. A more familiar syntax would make it more accessible.

I've been reading through the examples and it's readable enough. What is it that you find odd?

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#53
post #3

Anyone who had used or tried Carp and Janet (that was on frontpage the other day)? What are some strong points on Carp vs. Janet?

Janet is dynamic with a garbage collector. Carp is a GC-less static Lisp with deterministic memory allocation via a Rust-like borrow checker. I only wish Carp had stayed nearer Clojure's syntax. A more familiar syntax would make it more accessible.

As someone who doesn’t know any lisp well, it’s odd to hear you highlighting significant differences in syntax between them. I thought the character of a lisp is that it doesn’t have much syntax. I’d be interested in an example.

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#54
post #50
post #42

Earlier quoted context omitted.

Millions of CS students build their own language for compiler classes every year. As learning exercise of everything that goes into making a compiler/interpreter is very worthwhile endevour. As means to make the next big thing, maybe not.

> Millions of CS students... Are there millions of CS students in the world?? I would guess a few hundred thousand, at most.

[deleted]

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#55
post #6
post #4

Earlier quoted context omitted.

I have not used carp, and janet only briefly. However, other than both using lisp syntax, there are very little similarities between the two. Janet has a garbage collector, no static types, no ownership tracking - the perf. is similar to lua, so is not be ideal for low-level/realtime systems, which carp is targeting.

> the perf. is similar to lua, so is not be ideal for low-level/realtime systems Lua runs on a bunch of low level systems, and not just for hobbyists (it's at the core of VxWorks, for example). Can you expand on why you think the language doesn't meet your performance criteria?

Not familiar with VxWorks, but I have mostly seen lua being used as a plugin/extension language around a core implemented in native code.

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#56
post #50
post #42

Earlier quoted context omitted.

Millions of CS students build their own language for compiler classes every year. As learning exercise of everything that goes into making a compiler/interpreter is very worthwhile endevour. As means to make the next big thing, maybe not.

> Millions of CS students... Are there millions of CS students in the world?? I would guess a few hundred thousand, at most.

Might be, I don't have the numbers.

> A figure of speech is a deviation from the ordinary use of words in order to increase their effectiveness. Basically, it is a figurative language that may consist of a single word or phrase. It may be a simile, a metaphor or personification to convey the meaning other than the literal meaning.

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

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#57
post #36

Earlier quoted context omitted.

Lisp is not necessarily functional. There's a lot of mutation in Common Lisp even if the community favors a functional style. I think the question is: how does Lisp function without garbage collecting cons cells? For one, I'm not sure they even rely on cons cells like "real" Lisp. Clojure doesn't either. They cite ML as inspiration. Carp language guide states object lifetimes are statically inferred [1] which my gues…

Thanks for the links. There's also this Reddit discussion [0] from 2 years ago (it mentions Carp btw.) and an explanation about how Carp manages memory [1]. [0] https://www.reddit.com/r/haskell/comments/d5d13i/is_it_possi... [1] https://github.com/carp-lang/Carp/blob/master/docs/Memory.md

In particular, the reddit discussion mentions ASAP, which is a set of static analysis algorithms that can work with mutability, generics (polymorphism) and linear types. http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-908.pdf

As far as I'm aware, this really only applies to single threaded systems. However, if you implement threadsafe modules and keep the shared stuff internal (use the ASAP algos here), you can fit the majority of use-cases including hard-realtime constraints.

Composita is the module system I'm referring to. http://www.composita.net/Composita.html It allows concurrency with managed memory and no GC, through static analysis of the module (component) interface queues.

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#58

Can somebody please explain or give me some links how FP is supposed to work without a GC? For example Rust has different types of function pointers (Fn, FnMut, FnOnce), to guarantee the possibility of lifetime analysis (so it is arguable to consider it a functional programming language). On the other hand the most common FP languages (OCaml, Haskell) all come with a GC. Or am I wrong in assuming this is a functional…

From the Carp docs:

Memory management is handled by static analysis, a value is owned by the function where it was created. When a value is returned or passed to another function the initial function will give up ownership of it and any subsequent use will lead to a compiler error. To temporarily lend a value to another function (for example to print it) a reference must be created, using the ref special form (or the & reader macro).

and

achieved through a linear type system where memory is owned by the function or let-scope that allocated it. When the scope is exited the memory is deleted, unless it was returned to its outer scope or handed off to another function (passed as an argument).

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#59
For the history buffs:

    Pre-Scheme: A Scheme Dialect for Systems Programming
    Richard A. Kelsey, 1997
Abstract

Pre-Scheme is a statically typed dialect of Scheme that gives the programmer the eciency and low-level machine access of C while retaining many of the desirable features of Scheme. The PreScheme compiler makes use of type inference, partial evaluation and Scheme and Lisp compiler technology to compile the problematic features of Scheme, such as closures, into C code without signi cant run-time overhead. Use of such features in Pre-Scheme programs is restricted to those cases that can be compiled into ecient code. Type reconstruction is done using a modi ed Hindley/Milner algorithm that allows overloaded user-de ned functions. All top-level forms in Pre-Scheme programs are evaluated at compile time, which gives the user additional control over the compiler's partial evaluation of a program. Pre-Scheme has been implemented and used to write a byte-code interpeter and associated support code for a complete Scheme implementation.

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.3....

Re: Carp – A statically typed Lisp, without a GC, for real-time applications

#60

Can somebody please explain or give me some links how FP is supposed to work without a GC? For example Rust has different types of function pointers (Fn, FnMut, FnOnce), to guarantee the possibility of lifetime analysis (so it is arguable to consider it a functional programming language). On the other hand the most common FP languages (OCaml, Haskell) all come with a GC. Or am I wrong in assuming this is a functional…

From the Carp docs: Memory management is handled by static analysis, a value is owned by the function where it was created. When a value is returned or passed to another function the initial function will give up ownership of it and any subsequent use will lead to a compiler error. To temporarily lend a value to another function (for example to print it) a reference must be created, using the ref special form (or the…

So how is memory fragmentation avoided?
Post reply on HN