top | item 14079573

Dale – A Lisp-flavoured C

192 points| macco | 9 years ago |github.com | reply

65 comments

order
[+] hermitdev|9 years ago|reply
I would love to see announcements of new languages include a rationale. Why was this created? What problem was the author trying to solve that they thought the solution was a new language? What short comings did existing languages have that this new language overcomes?

This is not a critique; I'm just curious.

[+] inputcoffee|9 years ago|reply
A lot of the responses to hermitdev point out that a language can just be for fun, and need not "solve" anything.

This is true, but hermitdev's point still stands: why was this particular idea pleasurable? Why c and lisp? Is it because they want a fast compiling lisp? Did they like the syntax of c but find it easier to implement in lisp's tree-like structure?

What's the character motivation in this scene?

[+] nonsince|9 years ago|reply
I think that this developer, just like I, have drunk the homoiconic kool-aid. Homoiconic syntax is _fucking serious_ as far as productivity and enjoyment goes, it's like a whole separate world.
[+] nickpsecurity|9 years ago|reply
I created one a long time ago for reasons that seem to show up in others. Those included: Lisp-style macros are raw productivity/power; incremental, per-function compilation plus REPL = blazing, iteration speed; if using LCD of features, I can synthesize to more than one language/VM target; I can automate safety checks for C pitfalls without looking at cluttered code; way cleaner way to handle errors with similar benefit.

Sadly, I lost that tool in a triple, HD crash along with most work. Loved it, though. I never even fully learned LISP or C but the subsets let me crank out tons functionality really fast then run it through optimizing C compilers.

[+] nine_k|9 years ago|reply
A regular, non-convoluted[1] syntax for C? Hygienic macros instead of defines? These two are sufficient reasons to consider it.

But they also seem to offer namespaces, type inference (even through macros), sum types, anonymous functions, overloaded functions, a form of runtime introspection, and a bunch of goodies like containers in the stdlib.

Quite an offering, I'd say.

[1]: http://c-faq.com/decl/spiral.anderson.html

[+] omaranto|9 years ago|reply
I would think that the rationale for any language with the syntax of Lisp but semantics similar to X is obvious: you want a language like X (that can be used for the things that X is used for) but with the meta-programming capabilities provided by Lisp-style macros.

I can definitely see a Lisper thinking this rationale is so obvious that it does not require mentioning.

[+] zengid|9 years ago|reply
From forum discussion:

" Its development was prompted by the Common Lisp and Scheme tutorials that contrast syntactic macros with C preprocessor macros, and wanting to see whether syntactic macros could work in a lower-level language. " -Tom Harrison [1]

[1] https://groups.google.com/forum/#!msg/dale-lang/h73oNq5U6MQ/...

[+] conistonwater|9 years ago|reply
> What problem was the author trying to solve that they thought the solution was a new language?

It could well be a cultural thing: for some people, "creating a new language" is a serious undertaking, but for others (especially those exposed to Lisp and Scheme), creating a new language is something you might do if you're curious about something. At the end of the day, creating a language just isn't all that hard to give it so much thought.

[+] ppereira|9 years ago|reply
Why don't you just read the readme? The additional features are at the top, and examples in the body.
[+] nonsince|9 years ago|reply
Oh hey, I posted this on /r/lisp just earlier today. I discovered it because of a Google rabbit hole triggered by a rediscovery of this article[0] on Naughty Dog's GOAL (Game-Oriented Assembly Lisp). It looks really interesting, although I can't imagine doing serious programming in it (as much as I'd love to).

[0]: http://www.codersnotes.com/notes/disassembling-jak/

[+] eatonphil|9 years ago|reply
Very neat! Looks like this is an even older language than the one I'm familiar with: bone-lisp. Bone-lisp is interpreted but ops for "explicit regions instead of garbage collection". There is also an awesome list of similar projects on the bone-lisp README (on which I now see Dale included) which I'll quote from:

> Somewhat related Free Software projects:

> * Pre-Scheme is a GC-free (LIFO) subset of Scheme

> * Carp is "a statically typed lisp, without a GC"

> * newLISP uses "One Reference Only" memory management

> * MLKit uses region inference (and a GC)

> * Linear Lisp produces no garbage

> * Dale is basically C in S-Exprs (but with macros)

> * ThinLisp is a subset of Common Lisp that can be used without GC

[1] https://github.com/wolfgangj/bone-lisp

[+] pcwalton|9 years ago|reply
At a glance, the compiler looks solid, with full LLVM integration instead of compiling to C. That'll pay dividends down the road. Really great job :)
[+] piokuc|9 years ago|reply
This looks really nice. A low level Lisp as a system programming language - a C replacement - is an interesting idea. First thought after going through the readme: does it try to provide stable ABI? This is an important feature for a C replacement; for example, C++ has not managed to get it right, although the idea was to provide a better, object oriented C... What worries me in particular is that Dale has overloaded functions, that makes things harder as far as stable API is concerned, but maybe I'm wrong. Nice stuff, anyway. I can see a little PLT trend of new high level languages that want to be good in doing low level stuff and don't use GC. I like that!
[+] eschaton|9 years ago|reply
A systems programming language need not eschew GC. Zetalisp and Common Lisp are perfectly fine for Lisp Machine operating system implementation, without falling back to a language other than assembly for isolated bits of the very lowest-level code. Mezzano reaffirms this on x86-64 too.
[+] jaccarmac|9 years ago|reply
[+] taeric|9 years ago|reply
It saddens me that one of the main comment threads there is complaining about parentheses. :(

Some of the shouts out to thinlisp and other systems that did similar to this before are interesting. Very interesting.

[+] monkpit|9 years ago|reply
Programmed by Mr Worldwide himself?!
[+] appleflaxen|9 years ago|reply
isn't this a C-flavored lisp?

I mean, it's not C. And it is a lisp.

So doesn't it make sense to call it "lisp with a flavor of C" rather than the other way around?

Cool project!

[+] yellowapple|9 years ago|reply
It might've been named in the same vein as Lisp-Flavoured Erlang, which is indeed (last I checked) a Lisp and very much not Erlang (at least language-wise; it still uses the Erlang VM and OTP).

On another note, the lack of garbage collection at the very least would make Dale very abnormal in terms of being a Lisp v. some other language that happens to embrace s-expressions for its syntax.

[+] coldtea|9 years ago|reply
Can we have a C-flavored C with the extra features of Dale?
[+] nickpsecurity|9 years ago|reply
I used one that almost did what you ask. I refused to work with C++ codebases. Better to start with a language actually designed for metaprogramming, etc that thrn synthesizes C. If it has IDE & ecosystem, you get its language-level benefits then C's on tooling side. Win, win.
[+] lngnmn|9 years ago|reply
Any high-order functions, TCO? Is there an implementation of Everything Is An Expression and Everything Is A First-class Value principles? Type-tagging, which implements Values Has A Type, Not Variables principle, which gives The Numerical Tower and other nice things for free? Proper lexical scoping based on Environments which makes every lambda a closure? I am not asking about homogeneity and the possibility of the First-class Macros it provides.

No? So what then makes it Lisp-flavored? CONS CAR CDR and parentheses?

[+] catnaroek|9 years ago|reply
C's syntax is horrible, but we can live with it. Where are the attempts to fix C's semantics, dammit? This project is as if a mechanic were given a broken car, and the first thing he did were repainting it.
[+] iLemming|9 years ago|reply
How does this compare with Chicken Scheme?
[+] muyuu|9 years ago|reply
How do you pronounce it? Like Pitbull in "dale!"?
[+] tromp|9 years ago|reply
Wonder how hard it is to write a quine in Dale...
[+] lispm|9 years ago|reply
Why isn't it written in Lisp? It would be so much easier...

See for example C-MERA:

https://github.com/kiselgra/c-mera

[+] brandonbloom|9 years ago|reply
C-MERA's default code generator is textual C. This project uses LLVM's API, which is sadly difficult to utilize outside of C++.