9 ms·
Ask HN: If you were designing Common Lisp today, what would you change?
- anlsh 4y agoSome sort of governing entity. The ANSI standard has left the language totally dead in the water, and is the single biggest thing holding back this really quite beautiful language Package local nicknames. The situation that libraries like Alexandria are in is really sad. Nested namespacing/packages. The ability to alias imports, like in Python. In the same vein, most symbols in the spec should be moved into a standard library. A general equality predicate which can be specialized by the user. Just replace multiple-value-returns with structs, they don't add anything useful. Standardize some variant of arrow macros. Every form which introduces a binding should be able to take a (optional) type specifier. It'd be great if compilers could use this option to remove generic dispatch in certain compilation modes.
- septic_balls 4y agowhy the hate on ansi
- sargstuff 4y ago?? lack of knowledge about ansi escape sequences ??
- vindarel 4y ago> Just replace multiple-value-returns with structs, they don't add anything useful. Oh yes they do! They allow to add a return value without modifying all the calling sites. Extremely useful.
- sargstuff 4y agoAlgol based languages -> 1st order logic (implicit 'single' return) algol languages array/stack with 'struct' abstract ('struc' abstract converted by compiler to ether parallel array(s) and/or array byte grouping per array ordinal index offset) Lisp languages -> 2nd order logic (implicit nil/1 or many returns) lisp is a tree / heap language where tree node is the 'implied' struct. tree/heap much more flexible than fixed size array of strucs.
- dreamcompiler 4y agoThey also don't cons. Structs do.
- sargstuff 4y agolisp -> 1-n; s-expression 1st element ins () is the "memory index" structs -> n * M; "m-expression" 1st element outside of () is the "memory index". cons struc vs. cons lisp () is apples/oranages comparison. if convert both the 'cons struc' and the cons lisp () to same byte vector/stack or equivalent byte tree/heap, then yes, both 'cons' functions are equivalent. higher order equivalent of mealy state machine vs. moore state machine. [1] side note: ( 1 - n ) vs (n * m) is context reference to ploting base 2 log(x). (1 - n ) can never exceed 1. N * M, relative to (1 - n) is unbounded. ===== [1] : https://www.geeksforgeeks.org/difference-between-mealy-machine-and-moore-machine/ https://www.geeksforgeeks.org/difference-between-mealy-machi...
- sargstuff 4y agoWrapping the multivalue return using decorators / generators would provide the 'struct' equivalent without rewriting to 'single' struct. lisp approach to dectorators / generators disucssion. https://stackoverflow.com/questions/32956033/is-there-a-straightforward-lisp-equivalent-of-pythons-generators https://stackoverflow.com/questions/32956033/is-there-a-stra...
- kazinator 4y agoAnother take is that a bunch of clever people not only got the job done, but recognized that their role is done and went their separate ways. A similar thing happened in hardware with the HDMI spec. The worst thing in programming languages is these insipid language committees that refuse to disband. If you look at C and C++, it's obvious the main thing they care about above all is their self-preservation: the ability to continue meeting and tinkering with languages that everyone else critically depends on being stable. The goal of no technical committee should be its own self-preservation.
- jacquesm 4y agoThis is so true. Once it's done: stop working on it. All this instability serves nobody in the longer term. At the same time: lots of stuff is released half baked or worse and as a result you get a decade of goal post moving and backwards incompatibility for free.
- pfdietz 4y agoLeave less undefined in the specification. In particular, there should be more defined cases for errors in safe code. Complex type upgrading is just broken. The spec is inconsistent. sort should have been called nsort, to be consistent with the names of other potentially side-effecting operations. SORT would not alter its argument. If defpackage has no :use clause, it would be equivalent to (:use), not implementation-defined. Also: make package local nicknames part of the standard. Many built ins functions should be generic and allow user defined methods if at least one argument is not of a standard-defined class. This should not have an efficiency penalty. Many built-in classes should be user extensible, or at least have internal generic functions that can be extended. The exemplar here is user defined sequences in SBCL. This would also be useful for hash tables and streams. Pathnames tried to be general and failed. They need a revamp. Add support for multiple threads, concurrency, unicode. Although it saddens me to say it, get rid of the punning of NIL and false, and make CAR/CDR not work on NIL. Although it's not part of the standard, have a more robust social mechanism for curating and maintaining a semi-standard library, just outside the standard. Packages should allow weakness, so that if a weak symbol is not used anywhere it can be GCed from the package. This could help with tree shaking.
- deleted 4y ago[deleted]
- sargstuff 4y ago> Add support for multiple threads, concurrency, .. technically, already have that via lisp's take on decorators/generators. [1] What lisp doesn't have, per pre-dating just about everything in CS, is way to associate the lisp take on threads/concurrency with underlying os/hardware (without modifying/recompliling language). what would be nice is an alternate REPL namespace that can be 'reloaded to garbage collect, independent of standard REPL' where things that are split between OS/REPL/card reader operator can be placed. aka device drivers, thread/cpu/gpu specs. aka erlang/elixir extention ---- [1] : https://stackoverflow.com/questions/32956033/is-there-a-straightforward-lisp-equivalent-of-pythons-generators https://stackoverflow.com/questions/32956033/is-there-a-stra...
- daly 4y agoNIL punning should remain. Otherwise there needs to be some NIL-equivalent value or some exception nonsense.
- sargstuff 4y agoRemoval of NIL punning would make lisp a non-conforming 2nd order logic language.
- qualudeheart 4y agoSystems programming language in the style of Chez.
- Decabytes 4y agoInteresting can you elaborate?
- sargstuff 4y agonamespaces tied to an abstraction level. multi-threads, concurrency would be a process namespace & standard command / data name spaces could be mapped by programmer to how wanted to use in process name space. error(s) would be done in a 'error' namespace.
- sargstuff 4y agoUsing "box of punch cards" as REPL, "punch card machine" as 'solo cpu' and "device operator" as handler for everything else. Lisp just does the punch card box. Scheme does "the box" with access to the "punch card machine" and emacs covers the whole REPL, 'solo cpu', 'device operator' stuff So, common lisp needs a 'device operator' namespace.
- kazinator 4y agoI developed a language called TXR Lisp, which has ties with Common Lisp in many areas. If you look at the reference manual, which is conveniently one giant manual page available in HTML form, there are numerous dialect notes that mention ANSI Common Lisp; a chunk of that would likely be things I might change in Common Lisp. Some things I would fix without changing Common Lisp: * redefine "binding" as being an association between a symbol and a location. * I'd make (setq x y) have a predictable, documented effect when x is not a defined variable. It would cause x to be bound to its value cell, and place the value of y into that cell, and that would be the same as (setf (symbol-value 'x) y). * pick up some outstanding issues and resolve them, like this one: during a dynamic control transfer, an exit point is identified for that control transfer and then unwinding takes place. It is not specified in CL whether the intermediate exit points (the ones not selected for the transfer which are being skipped) are torn down before the control transfer takes place, or torn down as-you-go during unwinding. I'd fix that as being tear-down-as-you-go. This affects situations when an unwind-protect intercepts a control transfer and then tries to initiate a new one to a different exit point. * I'd fix the order of evaluation of a function binding relative to the arguments. We know that in (f x y z), the x y z are evaluated in left to right order, if f is a function. However, we don't know whether the f binding is resolved before or after the arguments. I'd pick one order and require it; probably before the arguments, though that requires the longest possible temporary storage. Obviously there are situations in which the binding isn't evaluated each time the function is called, like when it has been inlined. * loop would support application-defined clauses. * structs and CLOS would be integrated together; conditions would be CLOS instances. * in the area of pathnames, I would have the language specify precisely how POSIX and Windows paths correspond to pathname objects. Every implementation would have to follow that. For instance, it couldn't be that one implementation sees "foo.c" has having a type "c", and another one doesn't. Everything would be specified down to what happens with double slashes, and trailing slashes. * string literals would support escape sequences for special characters. Also, Unicode would be required. Implementations would have to support UTF-8 code. * string literals would support a way of splitting across multiple lines, such that the reader eats the leading indentation. Thus, the format function wouldn't need a hack for this. * FFI would be in the language.
- sargstuff 4y ago
- deleted 4y ago[deleted]
- sargstuff 4y agoRename Lisp to Heap-p, Polyp, Matrixp, or Affinep