Live data from Hacker News

Ask HN: If you were designing Common Lisp today, what would you change?

news.ycombinator.com

11–20 of 32 posts

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#11
post #9
post #7

Some 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 standar…

> 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.

Algol 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.

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#12
post #7

Some 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 standar…

why the hate on ansi

?? lack of knowledge about ansi escape sequences ??

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#14
post #9
post #7

Some 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 standar…

> 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.

They also don't cons. Structs do.

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#15
post #9

Earlier quoted context omitted.

> 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.

They also don't cons. Structs do.

lisp -> 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-machi...

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#16
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.

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#17
post #9

Earlier quoted context omitted.

> 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.

They also don't cons. Structs do.

Wrapping 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-stra...

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#18

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 associa…

> 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 ) 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.

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#19
post #2

Leave 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…

[deleted]

Re: Ask HN: If you were designing Common Lisp today, what would you change?

#20
post #2

Leave 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…

> 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-stra...

Post reply on HN