<younder>
There is specs and there is programs. Programming is how you learn they system, by interacting. So it is a pain when you need to deal with different implementations. There is no cure, you actually need to run it and test it on all of them. It is the only way to be sure.
<mrcom>
gilberth: Did you want (meall:macroexpand-all *), with the "*"? Don't think it's actually expanding; note that the gensym IDs are the same.
<mrcom>
When I run it as (macroexpand-all '(defun blah blah)), then the gensyms change and the "'(xxx " outputs change to "(QUOTE xxx"; otherwise, though, the results are identical.
<younder>
ugh
<gilberth>
mrcom: It shouldn't matter much, as cl:macroexpand just applies macro-function, which macroexpand-all does too.
<mrcom>
I think with the "*" it was just trying to re-expand the result from the previous, and punted and left it as-is.
<gilberth>
But yes, I was lazy.
amb007 has quit [Remote host closed the connection]
amb007 has joined #commonlisp
<mrcom>
(BTW--did you get body & mind fed :)
<gilberth>
The funny thing with ABCL here is that DEFUN itself macroexpands the body.
<mrcom>
I think that's *part* of what it expands into. The side-effects are missing from both outputs. Let me paste...
<younder>
That is normal gilbert, I mean all defun's are just a lambda function. Lisp in Small pieces and all of that.
<mrcom>
Most of it's just compiling ops, which is OK.
<mrcom>
But there's that (setf (fdefinition name) #'dummy) (setf (fdefinition name) #'dummy) side-effects I mentioned earlier.
<gilberth>
mrcom: Wait a second. So DEFUN to the file compiler is a special form? That is a form that gets special treatment?
<mrcom>
Plus a block with a ';; FIXME Need to support SETF functions too!' I don't understand.
<mrcom>
Yep. ALL the DEFxxx stuff is special forms.
<mrcom>
s/treated as special forms/
<gilberth>
younder: That's not normal. A macro is not supposed to fully macro expand its body. It's fucked up rather.
<gilberth>
mrcom: Terrific. Just terrific.
<mrcom>
I don't know how much of this is a case of Chesterton's Fence, seeing as how it's doing JVM stuff dynamically, and how supported that was 15 years ago...
<mrcom>
but it sure seems it would be fairly easy to replace the side-effects w/ %DOWHATEVER & eval-when them in. Like everybody else.
<gilberth>
Depends on what you want to do. Another option would be treat DEFUN as a special form, which it is to ABCL.
<mrcom>
Most of the first 600 lines of compile-file.lisp is "process-toplevel-defun" and "process-toplevel-export" and .... blah blah.
<mrcom>
I meant for ABCL devs to bring it into conformance.
<gilberth>
What I don't get is why this aren't just macros.
<mrcom>
Exactly.
<gilberth>
I mean they could have had things like (declaim (known-function foo ....)) or whatever to communicate to the file compiler.
<gilberth>
And then there is EVAL-WHEN as well.
<younder>
People 'cheat' to get better performance. That would be my bet
<gilberth>
In telling that a top level form is DEFUN? You won't notice.
<younder>
right
<gilberth>
My bet would be they read too few other implementations for inspiration.
<mrcom>
My bet would be on unfamiliarity with finer points of requirments.
<gilberth>
And thus didn't know better.
<mrcom>
Yeah. How far back does ABCL go? At least 15 years.
<gilberth>
Something like that.
<younder>
Well the ANSI spec is not light reading. I suspect all implementations missed a few spots
<gilberth>
Maybe it started as "Hmm, can we have some Lisp on he JVM" and grew up to become a Common Lisp? idk
<gilberth>
You must notice the moment you begin special casing for a DEFUN top level form that you are doing something wrong. Unless you're not that familiar with how Lisp works.
<gilberth>
Anyhow, I don't criticize ABCL here. It still is impressive. I just offering explanations about how this design might have happened.
<younder>
I learn something new every day, even after a couple of decades of it
hexa6 has quit [Ping timeout: 256 seconds]
josrr has quit [Remote host closed the connection]
<mrcom>
Yeah. Looks like took ANSI tests seriously from the start.
<mrcom>
I can't imagine something like this being testable, hence not caught.
<mrcom>
(testable in a standard test suite)
<gilberth>
Then it's not doing homework.
<gilberth>
I mean, when you set yourself the goal to implement ANSI CL from scratch it is a good idea to look at existing implementations instead of reinventing the wheel. Especially as all the code out there has seen decades of use.
<mrcom>
Well.. you can always find something that shouldn't have been missed. Beach made a comment the other day about just realizing standard macros aren't supposed to promote subforms to top-level.
<mrcom>
(Or at least couldn't remember worrying about it.)
* younder
notes that modern software is bloated in memory slower and contains more bugs. F**k modern methodology
<gilberth>
Yes, be are not talking about some corner case or somethin. But about the very fundamental nature of how forms are processed.
<gilberth>
* we are not
<mrcom>
Yeah, it's a bit more egregious.
<gilberth>
mrcom: Anyhow, is there anything that I should fix or look into with meall.lisp?
<mrcom>
As regard this? Don't think so. You'd have to pick through all the process-toplevel-xx bits and duplicate the side-effects.
<mrcom>
As for more general, I don't have a reason to use it right now, and this is the kind of thing you need to use in anger to realize ramifications.
yitzi has joined #commonlisp
<mrcom>
It's in the future-tools bookmarks, though.
<gilberth>
mrcom: My use case of meall.lisp is not being at top-level anyway. And the reason why I wrote this once I had the idea of those "templates" that I ask the Lisp implementation to process. No other lib can work from a buried form from within a macro.
<mrcom>
I'm not sure this is one of it's use cases, but it would be interesting to get better expansion/backtraces.
<mrcom>
It kind of dawned on me that SBCL, and probably most implementations, never see the full expand themselfs.
<gilberth>
In the end of day I want to be able to optimize code.
<mrcom>
It's as-needed, down to a leaf, compile, then up and down another branch.
<gilberth>
For interactive use while developing, I'd like to provide templates for standard macros, like OR, MULTIPLE-VALUE-BIND etc. You usually don't want to debug those.
yitzi has quit [Remote host closed the connection]
<mrcom>
You mean sort of combine a standard template w/ special sauce needed for a particular impl?
<gilberth>
And I would need that for the "I want to reason about code and optimize it" use as well. CCL's compiler e.g. is too stupid to compile the expansion of OR to the same code as the original OR.
<gilberth>
mrcom: Yes. So that when you say macroexpand-all in e.g. SLIME or on the REPL, you see an OR as an OR and not as a (LET ((#:G14 ...)) (IF #:G14 #:G14 ...))
<random-nick>
gilberth: afaik abcl started as an extension language for an editor that then grew into a CL implementation
<gilberth>
Or MULTIPLE-VALUE-BIND expanded to MULTIPLE-VALUE-CALL.
<gilberth>
random-nick: That would explain it.
<mrcom>
I've wondered about a standard sexpr code-walker front end. As you say, there's lots of pretty-much-defacto macro expansions.
<gilberth>
The question rather is: What are applications of a code walker?
<gilberth>
For what I want to do I would need the whole bunch of classic data flow analysis to finally infer types and extent (lifetime).
<gilberth>
So I would need to have a CFG at some point.
<gilberth>
Source location information is another topic. For CCL I have infrastructure to borrow source location from one form and stick it to another. Or to blame a particular form. CLEX uses that. A scanner definition looks like a large CASE on regular expressions either in s-expression notation or POSIX notation. CLEX can make you Emacs point to some specific RE it has problems with.
<gilberth>
noffi also taps into CCL's source location information and makes C subexpressions have a known source location. And while "compiling" which is a macro it can transport those to the appropriate subforms in the expansion.
chomwitt has quit [Ping timeout: 260 seconds]
<bike>
source locations are another thing i'd really like to establish some kind of language extension or at least portable protocol for
<bike>
the closest thing we have is the guts of slime
awlygj has quit [Quit: leaving]
<gilberth>
I think that will be difficult. SBCL doesn't have precise source locations. It just has a path from the root. That doesn't work with alternative syntax. And perhaps one of the reasons the error messages are so verbose.
<gilberth>
While CCL keeps file positions and also can keep the original text.
<bike>
yeah, i'm aware. slime's treatment of sbcl source locations is rather involved.
<gilberth>
Anyhow, for my purposes the two primitives "borrow source location information from this (sub)form that I got to that form that I made, please." and "please signal an error on behalf of this (sub) form." are about sufficient as a macro author.
seanw has joined #commonlisp
<bike>
is the latter different from with-current-source-form or no?
<bike>
hrm, not quite teh same. w-c-s-f basically says "within this dynamic context, any signal with a source location attached should use this form's source location". so you let the compiler signal, or just do your own error/warning
<bike>
i have a bunch of machinery in cleavir so that if a macroexpander signals, the compiler automatically attaches whatever source location, taking w-c-s-f into account
<bike>
but the macroexpander just does an ignorant (error ...) with no source location
random-nick has quit [Ping timeout: 264 seconds]
<gilberth>
My idea was to pass the form that I want to point at. The compiler-descend is kind of like a backup only.
<gilberth>
And to be able to indicate some problem without aborting further processing.
dawids has quit [Remote host closed the connection]
decweb has joined #commonlisp
cmack` is now known as cmack
Gleefre has quit [Remote host closed the connection]
Inline has joined #commonlisp
Inline has quit [Quit: Leaving]
Inline has joined #commonlisp
cage has joined #commonlisp
yitzi has joined #commonlisp
skeemer has quit [Ping timeout: 252 seconds]
shka has joined #commonlisp
reb` has joined #commonlisp
puke has quit [Remote host closed the connection]
puke has joined #commonlisp
simendsjo has quit [Ping timeout: 252 seconds]
yitzi has quit [Remote host closed the connection]
waleee has joined #commonlisp
yitzi has joined #commonlisp
Gleefre has joined #commonlisp
emaczen has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
shka has joined #commonlisp
rakka has quit [Remote host closed the connection]
rakka has joined #commonlisp
cinerion has quit [Ping timeout: 264 seconds]
NotThatRPG has joined #commonlisp
skeemer has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.3]
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akoana has joined #commonlisp
mgl_ has joined #commonlisp
josrr has joined #commonlisp
X-Scale has joined #commonlisp
reb` has quit [Ping timeout: 272 seconds]
akoana has quit [Ping timeout: 240 seconds]
attila_lendvai has quit [Quit: Leaving]
edgar-rft_ has joined #commonlisp
X-Scale has quit [Quit: Client closed]
attila_lendvai has joined #commonlisp
X-Scale has joined #commonlisp
NotThatRPG has joined #commonlisp
edgar-rft has quit [Ping timeout: 264 seconds]
ym has quit [Ping timeout: 256 seconds]
akoana has joined #commonlisp
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
mgl_ has quit [Ping timeout: 255 seconds]
synchromesh has quit [Ping timeout: 246 seconds]
edgar-rft_ is now known as edgar-rft
reb` has joined #commonlisp
zxcvz has joined #commonlisp
shawnw has joined #commonlisp
ym has joined #commonlisp
chomwitt has quit [Ping timeout: 264 seconds]
simendsjo has joined #commonlisp
chomwitt has joined #commonlisp
hexa6` has joined #commonlisp
hexa6`` has joined #commonlisp
mgl_ has joined #commonlisp
Inline has quit [Quit: Leaving]
hexa6 has quit [Ping timeout: 264 seconds]
hexa6`` is now known as hexa6
hexa6` has quit [Ping timeout: 260 seconds]
cage has joined #commonlisp
Inline has joined #commonlisp
X-Scale has quit [Ping timeout: 250 seconds]
X-Scale has joined #commonlisp
Inline has quit [Quit: Leaving]
Inline has joined #commonlisp
tfeb has joined #commonlisp
tfeb has quit [Client Quit]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 264 seconds]
Lord_of_Life_ is now known as Lord_of_Life
jonatack has quit [Ping timeout: 255 seconds]
chomwitt has quit [Ping timeout: 268 seconds]
varjagg has joined #commonlisp
prokhor has quit [Remote host closed the connection]
prokhor has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
Inline has quit [Quit: Leaving]
borodust has quit [Remote host closed the connection]
Inline has joined #commonlisp
kevingal has joined #commonlisp
NotThatRPG has quit [Ping timeout: 260 seconds]
kevingal_ has joined #commonlisp
NotThatRPG has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
simendsjo has quit [Ping timeout: 272 seconds]
borodust has joined #commonlisp
Inline has quit [Quit: Leaving]
Gleefre has quit [Ping timeout: 250 seconds]
Inline has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
pieguy128 has quit [Ping timeout: 264 seconds]
pieguy128 has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NotThatRPG has joined #commonlisp
NotThatRPG has quit [Client Quit]
ns12 has quit [Quit: bye]
ns12 has joined #commonlisp
mwnaylor has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.3]
mgl_ has quit [Ping timeout: 268 seconds]
ym has quit [Ping timeout: 268 seconds]
yitzi has quit [Remote host closed the connection]
varjag has quit [Ping timeout: 255 seconds]
borodust has quit [Ping timeout: 246 seconds]
istewart has joined #commonlisp
jonatack has joined #commonlisp
Inline has quit [Quit: Leaving]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
mgl_ has joined #commonlisp
attila_lendvai has quit [Ping timeout: 264 seconds]
calamarium has joined #commonlisp
amb007 has quit [Ping timeout: 255 seconds]
mgl_ has quit [Ping timeout: 256 seconds]
Gleefre has joined #commonlisp
chomwitt has joined #commonlisp
varjagg has quit [Ping timeout: 255 seconds]
NotThatRPG has joined #commonlisp
<masinter>
I'm not sure who wrote it, but there's a code-walker and templates for various macros and special forms for both Common Lisp and Interlisp source code in Medley.
<masinter>
that to gilbert & bike
dino_tutter has quit [Ping timeout: 268 seconds]
zberkowitz has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
amb007 has joined #commonlisp
donleo has quit [Ping timeout: 264 seconds]
synchromesh has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]