Truffle ISLISP
arvyy.github.io
arvyy.github.io
Maybe "interop" is too weak a phrase for the incredibly powerful cross-language tooling that is allowed with GraalVM (ISLISP implementated on GraalVM's Truffle framework, ref OP link). For example of what is really possible, see "Ten Things You Can Do with GraalVM (2018)" [0][1]
[0] https://gist.github.com/chrisseaton/535e0e80ea19803d5529c623...
Where did that come from?
In fact, quite the opposite: ISLisp requires all atoms to be considered list terminators. It is documented for the length function that (length '(a b . c)) => 2.
1997 draft: "For eq, the consequences are undefined if either obj1 or obj2 is a number or character."
2007 draft: "For eq, the consequences are implementation defined if both obj1 and obj2 are numbers or both are characters."
They are still neglecting the possibility of cleaning up the language here by not allowing that much implementation latitude. All Lisps should have a range of fixnum integers which are unboxed, and comparable with eq. Characters should also be unboxed and comparable with eq.
It's also buggered in the following way: eq should be required to yield false if the arguments are such that eql would yield false. If the arguments are different numbers, or the same numeric value but of a differnt type, they cannot be the same object; eq should yield false.
Also, what is "implementation defined"? Unfortunately, it is vague: "feature, possibly differing between different ISLISP processors, but completely defined for every processor". How is it defined, if this document doesn't define it?
Every language spec that doesn't completely define everything should have both implementation-defined and unspecified behaviors. It should spell out that in those situations, failure is not an option: the behavior is chosen by the implementor from a set of possibilities. There should be a requirement that the implementation must be accompanied by a document which describes the implementation-defined choices. (For unspecified behavior, how the choice is made need not be documented.)
What eq does with numbers is a great candidate for unspecified behavior. At least, if we accept the idea that two small integers like 1 and 1 could be different objects. If you give implementations that much latitude, just let it be unspecified so they don't have to commit to the details.
Today, I would specify that the implementation must provide a range of integers called fixnums, and that two fixnums of equal value compare true under eq. I would also require that characters be comparable with eq. There is no need to cater to toy implementations which make every object a pointer to a boxed value in the heap. I would specify that fixnums go from at least -8192 to 8191. That allows for 16 bit objects to have 2 bit type tag, for really small systems.
As a matter of orthography, the compound adjective implementation-defined should be hyphenated.
(mapcar function list+) → <list> functionImagine if there was an InlineAsmGrub to compete against that other GRUB. It's just that silly a practice.
However, the fact it's based on truffle is the selling point -- truffle enables interop between languages on the framework. So, for example, you can take truffle JS implementation, import express library or whatever, and then as part of the implementation do
````
let fn = Polyglot.eval('islisp', '(lambda (x) (+ x 1))');
fn(1);
````
(toy example. But this interop can happen in all directions, it's not limited to js but can be used from truffle python, ruby, java, etc; and it also isn't limited to just primitive values, you can pass around functions as well).
If you aren't looking for a specifically a truffle lisp, it would make more sense to use one of the established common lisp implementations.
Do you have a suggested naming convention to follow? There's a rich history of alternative language implementations following the convention you dislike, but I think those involved would be open to an alternative.
The GraalVM is a tool used, among other things, to produce native binaries, and Truffle a programming language for implementing programming languages on Graal.
One could expect pretty good performance, possibly at the price of somewhat slow compilation.
Good joke.
"In ISLisp, language specifications are separated from processor specifications. ISLisp forms after macro expansion and other pre-processing are called "prepared form" and ISLisp does not define preparation procedures."
The text you're quoting implies the language has a macro expander. There are arrays and vectors, so you could implement hashmaps, and I think some of the implementations of the language already does.
It looks to me that this "prepared form" is the same as in other traditional Lisps: that the source code of the program is defined in terms of nested lists, but may undergo a transformation into an undocumented form (for instance ARM machine language) in preparation for execution. E.g. in Steel Bank Common Lisp, everything you type into the REPL is first transformed into machine code and then run. Common Lisp doesn't define the details of such a thing, but does have a lot to say about compilation.
The actual ISLisp says:
An object is prepared for execution; this might include transformation or compilation, including macro expansion. The method of preparation for execution and its result are not defined in this document (with exception of the violations to be detected). After successful preparation for execution the result is ready for execution.
Obviously, the macro expansion parts are defined at least to some extent because it interacts with user macro definitions. (Perhaps even when it comes to macro expansion, ISLisp doesn't nail down the exact semantics, like when exactly is it done. It's possible for a pure Lisp interpreter to work with unexpanded code and continuously re-expand any macro call that it encounters, in the latest dynamic environment. That allows for macros to be fixed on-the-fly.)
ISLISP, a spiritually CommonLisp-lite:
Adhoc polymorphism through generic methods;
Dynamic and lexical scoping;
Procedural macros.