4 ms·
Greenspun's tenth rule strikes again! https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
by duetosymmetry 2y ago
Greenspun's tenth rule strikes again! https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
- klrtaj 2y agoA great example of the rule is that C++ rediscovers car/cdr at a glacial pace in the template language. In C++26 one can finally get the car of a typename parameter pack with Args...[0]. I've no idea why they don't introduce car/cdr functions and nil for empty parameter packs and allow to store parameter packs instead of the current syntax insanity.
- gpderetta 2y agoC++ metaprogramming was done with cons cells already back in '98. The new syntax provides random access instead, which is completely different from linked lists.
- otabdeveloper4 2y agoStore where? C++ templates are a lambda calculus, there's no notion of memory cells or state.
- jasfas 2y agoIn a struct! Pseudo code for extracting the types from subclasses and calling a multimethod on them: template <typename Result, typename Head, typename ...Tail> struct Foo : Visitor { Result res; UntypedList lst; // This does not exist! Tail... tail; // This is not possible! Foo(UntypedList l; Head hd, Tail... tl) : lst(l), tail(tl) { hd->accept(*this); } void visit(float *f) { res = Foo<Result, Tail...>(append(lst, f), tail)::res; } } }; // Base case that calls the multimethod omitted. There are two issues here: You can't store the parameter pack in Foo() which is later required by the continuation in visit(). And you would have to use tuples and tuple_cat() instead of UntypedList. Why can the compiler not infer the types in such an UntypedList? Why is there no car/cdr for tuples?
- gpderetta 2y agoNot sure what Untyped list is or supposed to do in the above. In fact I'm not sure what the code above is trying to do at all. If you want a cons-based tuple, boost::tuple will work just fine (or you can implement your own, it is not hard). std::tuple is not (visibly) cons based.
- dgfitz 2y agoWhat defines "sufficiently complicated" I wonder? Seems like a shit definition.
- StableAlkyne 2y agoIt's just a funny observation he made, it's not meant to be a rigorous academic definition :)
- eyelidlessness 2y agoThe rule defines it tautologically. Which is sufficiently unambiguous for its purpose!
- throw-the-towel 2y agoGreenspun's tenth rule, corollary: Any sufficiently precise definition of "complex system" contains an ad hoc, informal, bug-ridden, slow specification of half of Common Lisp.
- munificent 2y agoI like that the "sufficiently complicated" part bothered you, but not the "ad hoc", "informally-specified", "bug-ridden", or "slow" parts.
- krick 2y agoNo, I think it's pretty fair. One could argue about these, but except for "slow" these are more quality qualifiers, rather than quantity. So you either agree it's "bug-ridden" or not (i.e. the number and seriousness of bugs in it is negligible by whatever standards). And I think even "slow" can be discussed in the same manner, the actual speed is quantitative, of course, but in the end one either argues that this speed is "slow" or isn't. So, given some rhetoric skills of your opponent it's at least possible for that statement to be proven false, if he convinces you the implementation actually isn't slow nor bug-ridden, or at least if there's no Lisp-implementation indeed. But what is "sufficiently" complicated? Now it's a silly statement that just doesn't pass Popper criterion: even if nobody dares to deny your program is complicated, one can always say it isn't sufficiently complicated, hence the fact it doesn't contain Lisp-interpreter disproves nothing. A man of culture wouldn't use such definitions.
- ForOldHack 2y agoHA! "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp." HA HA!
- bigdict 2y agonah, this is about codebases that are not themselves primarily lisp implementations
- rfl890 2y agoI think that's the joke
- kazinator 2y agoThis is correct. Greenspun's Tenth Rule is not meant to be interpreted as applying to projects that are consciously creating a Lisp implementation. It's about programs which are not meant to be language implementations at all reinventing ad hoc infrastructure that is designed in Lisps according to established patterns. For instance, badly reinventing something that functions as symbols.
- Nevermark 2y agoI conjecture the line is not so easy to draw. If you are creating Lisp because you want to create Lisp, like creating Lisp, want to show off creating Lisp, that obviously is not what the Law is about. Furthermore, if you create Lisp because you know the Law, know it is inevitable, and want to avoid the caveats and missed bars by doing so explicitly, well then that also is not what the Law is about. But if you are going about your business, focused on your independent goal, realize you need Lisp like lists, and then 250 lines of code later realize you have created a solid Lisp unintentionally? Well, congrats on falling into the trap but not getting hurt! — Personally, I have created both Lisp and Forth multiple times for suitable projects where I wanted some flexible runtime scripting. I am not familiar with the standard version libraries of either and don’t need them. Minimal foundation implementations are extremely easy to create, and eliminate any dependencies or sources of mystery. Anyone know of any other well designed mininal languages?
- pjmlp 2y agoExcept it is been like 60 years that any proper Lisp implementation has more than plain cons lists.