4 ms·
I 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 manu
by kazinator 4y ago
I 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> loop would support application-defined clauses. lisp loop is a macro, can be modified to support above request. > * in the area of pathnames, I would have the language specify precisely how POSIX and Windows paths correspond to pathname objects. Elang/elixir approach where (pathname <file stats parameter>) provides a standard way to access file/path without having to know what the underlying file system is (unless check atrributes) > * structs and CLOS would be integrated together; conditions would be CLOS instances. strucs are just segmented arrays or multi-values in (). (condit ()) is a 'clos instance'. The way python sets up it's class/object system is similar to lisps, just not using lisp (). > ... we don't know whether the f binding is resolved before or after the arguments. ... whats order in a tree/heap, other than way tree/heap traversed. why not make use of setq/quote if binding order is important? > * redefine "binding" as being an association between a symbol and a location. first item in () s-expression is the symbol/location association. Doesn't # provide a way to get at what the symbol/location association is? > ... I'd fix that as being tear-down-as-you-go. ... Traditional lisp, nothing is garbaged reclaimed until exit REPL.
- kazinator 4y agoA CL implementation's loop macro cannot be modified without modifying the implementation, but your application can carry its own loop macro. Possibly, such a loop macro can generate code written in the standard loop macro, so that (enhanced-loop <standard-clauses...>) just emits (loop <standard-clauses...>) but if it detects nonstandard clauses, it expands them into standard clauses. Lisp being what it is, you are rarely at the mercy of the implementation, when it comes to a language feature, unless the feature has to do with accessing some semantics deep in the implementation, and the problem is with that semantics and not the porcelain. It is still undesirable for programmers to bring their ehanced-loop to the table. Because Bob has bob-loop, and Amy has amy-loop and they would like to combine their code where both bob-loop and amy-loop features are used not just in the same code but in the same loop. That just turns into a PITA. If they are lucky, amy-loop has some awkward syntax for specifying that a given invocation should generate code for some loop other than cl:loop, so they write (amy-loop :target bob-loop ...). Then amy-loop transforms all the amy-loop clauses it sees, leaves alone anything it doesn't understands and spits out bob-loop syntax. (This is not easy; skipping unfamiliar, non-standard loop syntax is going to involve guesswork because the clauses aren't nicely parenthesized!) That would all be simpler if they could just write custom clauses for standard loop. Bob would write his in the bob-lib package; Amy in amy-lib. Everything works together out of the box; if you have bob-lib and amy-lib, you can use loop with bob-loop and amy-loop clauses. I don't substantially understand the rest of your remarks, except to the extent that certain key words in my remarks serve as their prompts. The holidays being over, you should be able to get a medication refill now.