4 ms·
Dawn (Part 1)
- smaddox 6y agoAuthor here. Ask me anything!
- spindle 6y agoIf I say thank you for working on such a great idea, does that count as a question?
- smaddox 6y ago:-D
- spindle 6y agoI've thought of a real question now: wouldn't it be easier to implement this in Factor than in Haskell? I'm asking out of interest rather than because I think you should re-implement it. BTW, if you happen to use Nix, could you please add this great thing to NixOS?
- smaddox 6y ago> wouldn't it be easier to implement this in Factor than in Haskell? I have no idea. I chose Haskell primarily because of the excellent "Typing Haskell in Haskell" resource: https://web.cecs.pdx.edu/~mpj/thih/ https://web.cecs.pdx.edu/~mpj/thih/ I'm getting close to having enough language features working to implement Dawn in itself, though. As soon as I reach that milestone, I plan to write a Dawn-to-C translator sufficient to compile a simple self-hosted interpreter via C, from which point the language will be fully self hosted.
- spindle 6y agoExcellent!
- odanoburu 6y agohi! very cool article (and language!) something I'd like your input on: from what I understand one of the biggest advantages of concatenative languages is their ease of refactoring ‘since functions can be trivially split and recombined along any syntactic boundary’ (as you wrote). but with the named stacks, we might still need to do some renaming, right? (with some splitting discipline it shouldn't be necessary, I'd say.) or is there something I missed?
- deleted 6y ago[deleted]
- sse 6y ago"performance and control of C" also means that you can make datastructures with arbitrary pointers, right? The simplest example that doesn't work in rust is a linked list. How can you do that when you only have multiple stacks, but no heap?
- smaddox 6y agoA singly-linked list is perfectly possible in safe Rust (https://rust-unofficial.github.io/too-many-lists/third-layout.html https://rust-unofficial.github.io/too-many-lists/third-layou...): pub struct List<T> { head: Link<T>, } type Link<T> = Option<Rc<Node<T>>>; struct Node<T> { elem: T, next: Link<T>, } Or you can replace `Rc` with `Box` if you don't need multiple links to each node. In high-level Dawn, it's basically the same as in Haskell: {data v0 List {cons Nil} {cons v0 (v0 List) Cons}} The first compiler will be quite simple and will produce roughly the equivalent of the above Rust implementation. As for cyclic doubly-linked lists and arbitrary cyclic graphs, I'll describe how those will work in a future post.