4 ms·
> That is all you have to build more complex stuff out of By this logic you can't add type information to anything because you can only use pairs so there is n
by James_K 2y ago
> That is all you have to build more complex stuff out of
By this logic you can't add type information to anything because you can only use pairs so there is nowhere to store the type. It's a silly thing to say because it assumes the compiler for the language has to be written in the language.
> So there is no place to hide any adjunct data without violating the spec
The spec is that you have cons, car, and cdr. You could have a secret third element to some pairs that is only used by the compiler without changing the interface of those functions, and hence without changing the interface of the language as a whole. This is the essence of optimising compilers, making changes to the representation of things without changing how they behave.
> PG's infatuation with McCarthy's original definition of EVAL is badly misguided
I agree wholeheartedly with this. This entire document is basically just an extended brain-fart but because it came out of a rich guy's brain-ass a bunch of people will treat it like it's serious.
- lisper 2y ago> It's a silly thing to say because it assumes the compiler for the language has to be written in the language. It assumes no such thing. All it assumes is that the compiler has to conform to the specification. > The spec is that you have cons, car, and cdr. And XAR and XDR. And threads. And no compound data types other than mutable pairs. > You could have a secret third element to some pairs that is only used by the compiler without changing the interface of those functions, and hence without changing the interface of the language as a whole. That's right. You could. How would that help? > This entire document is basically just an extended brain-fart OK, so we're basically in violent agreement here. We're just quibbling over the justification.
- James_K 2y ago> That's right. You could. How would that help? I literally just described in code how that could help. Wherever the compiler encounters an instance of a list in the source code that looks like a function, you compile it and put the result in a secret third element. Then, when you have to apply a list, you first check if it has a compiled third element before you do the slower work of interpreting it. Have you ever written a compiler or used one? What I described here is literally just the process of JIT compilation.
- lisper 2y agoJIT compilation only works if functions can't change at run-time, which is true for most languages, but not for Bel.
- James_K 2y agoSome fairly simple escape analysis could likely determine that most functions used in practice do not have their bodies assigned.
- lisper 2y agoThat might work if Bel didn't have threads. But it does, so it doesn't. Also, assigning the body is not the only way to undermine compilation. You can change a function into a non-function (by changing its first or second element) and vice versa. You can change a function's environment. You can change its argument list. You can modify the body of a function while it is being evaluated. You can change anything about a function at any time.
- James_K 2y agoYou can still do escape analysis. You wouldn't even need to be very advanced with it since most code won't do anything close to modifying and expression that's in the process of evaluating.
- lisper 2y agoYou clearly don't know what escape analysis is or how it works. Escape analysis applies only to data allocated at run-time. Programs are generally written before they are run (this is the reason that "run-time" is even a thing) and the functions that comprise them in a Bel program are generally globally bound with DEF. Escape analysis doesn't work on globally bound data. It has already escaped before your program even starts to run.
- 2y ago