libera/#lisp - IRC Chatlog
Search
20:39:48
kiki_lamb
So, someone I'm talking to is making themselves a toy Lisp, and they seem like they're entertaining the idea of having many/most of the 'lists' actually being implemented as some kind of vector/array under the hood. How bad of an idea is this? Are there examples of this being done? It seems like it's going to be at least a bit awkward, with special cases needed for handling shared tails and circular
20:45:10
pjb
kiki_lamb: implementation details don't matter. They just may have an impact on performance or implementation complexity.
20:46:56
kiki_lamb
sure... this language is just a toy, they're basically a student, so I'm trying to offer advice that keeps the implementation simple, it's the first time they've implemented any parser or language.
20:48:14
kiki_lamb
Apparently the language they're implementing in makes true linked lists a bit awkwards, which seems like a shame... actually using linked lists in the implementation seems like it would be a simpler implementation, to me.
20:55:28
jcowan
kiki_lamb: http://www.faqs.org/faqs/lisp-faq/part2/section-9.html describes cdr-coding
21:08:33
kiki_lamb
pjb: heh, could be. I'd been teaching them how to do this in C, but they're also working on a parrallel implementation in Rust (with which I am not familiar). They're pasting me things from their Rust chat where people are saying that, apparently, the object ownership/GC details can be strange for linked lists with loops or shared tails in Rust. *shrugs*
21:09:49
kiki_lamb
Hopefully they will eventually give up on the Rust implementation and return to focussing on the C one... or perhaps even see the light, and take my advice of using C++ instead.
21:14:23
jcowan
So we must add a third category of languages: there is Lisp, and there is Blub, which is any language that is not a Lisp, and there is Super-Blub, which is any language in which you cannot even *implement* a Lisp.
21:19:01
kiki_lamb
Also the dependent type SuperBlurb<Person>, with SuperBlurb<me> describing those languages in which I personally could not write a Lisp.
21:30:42
iisi
Only thing I remember from looking at Cobol excerpts is the possibility of lots of consecutive periods, which must have exactly the right count.
22:45:03
jcowan
Just think of the dot as a right paren/brace. I have actually seen it written at the same indentation level as the verb.
22:49:05
mrcom
Normal, safe-mode Rust code has a very strict ownership graph; no object can be owned by two parents. And, you can't depend upon something (e.g., include it or point at it) without owning it.
22:51:16
mrcom
However, code marked "unsafe" can do it; the programmer just has to guarentee safety via algorithm. In other words, it degrades to C/C++-style coding.
22:54:51
jcowan
Allocating pairs out of a big array works for this (degrading to assembly language, basically)
22:56:12
jcowan
There's a Java native-code sandbox implemented as a MIPS emulator running out of just such an array. You compile your native code for MIPS and then convert it to a big initializer for an array representing memory.