freenode/#lisp - IRC Chatlog
Search
14:00:40
xificurC
I have malformed json, there's a \- sequence which falls through an ECASE in both cl-json and yason. The json output isn't mine and cannot change it. What would be the best aproach to combat this? There's no reasonable restarts provided since they are just an ECASE. Maybe I can wrap the stream in a stream that corrects this sequence?
14:16:22
dlowe
xificurC: the usual thing is to use regexes to fix your crummy data to fit into the parser
14:23:23
Shinmera
hacking in a restart to skip a char and continue seems easier and more robust to me
14:57:16
xificurC
skipping that I still get an error (using yason now) later on parsing an object. This seems to be getting a bit weird, e.g. jq parses all lines fine and yason chokes on the first ones. I'm reading a stream with (loop for line = (read-line stream nil nil) ...), that shouldn't alter anything right? Running cmd |& while IFS= read -r line; do jq . <<<"
15:39:27
makomo
pfdietz: right that is clear -- and now that the body has been fully expanded and the results have been computed, how does the outer macro fetch the results? does this transfer happen via global state or in some other way? you mentioned the inner macros "stashing" the results away, how?
15:42:22
pfdietz
It has to walk over the expanded form and somehow retrieve it from there. The inner macro will have placed it there in some form the outer macro's function can recognize.
15:43:46
makomo
pfdietz: i see, but i can't think of any way how it might do that, without affecting the code in the body.
15:46:19
pfdietz
Or into something that has useless but valid code. (progn (hey-look-at-this (quote ...)) <actual form>)
15:48:41
makomo
pfdietz: so when passing information top-down, it's possible to do it portably. when passing information bottom-up, i need MACROEXPAND-ALL to fully expand the body?
15:52:47
pfdietz
In practice, it's de facto portable. https://github.com/cbaggers/trivial-macroexpand-all
15:53:42
makomo
pfdietz: ok, i'll try to apply the technique to my case. thanks for taking the time to explain
15:55:31
makomo
MichaelRaskin: hello. this one should be fine since it's not a "user-level" implementation
15:56:26
makomo
MichaelRaskin: does the caveat concern the representation of environments? you mentioned it a few days ago but i didn't completely understand
15:57:52
makomo
MichaelRaskin: also, i wanted to give agnostic-lizard a go but i didn't find any comprehensive explanation of the whole thing. where should i start?
16:03:02
MichaelRaskin
The same page (bottom) contains the proceedings link, there is a write-up there
16:03:52
MichaelRaskin
I do follow the most popular way of writing a code walker, just with a few heuristics to approximate a solution to the impossible problem.
16:09:30
MichaelRaskin
Hm, quite a lot of implementations where trivial-macroexpand-all just ignores the env parameter
17:04:24
pfdietz
Is there a way in ASDF to say "if systems FOO and BAR are both loaded, then also load system BAZ"?
17:05:20
scymtym
there is a system called asdf-system-connections but it caused many problems when i tried it
17:05:29
pfdietz
The use case for this is when FOO has some special case handling in case BAR is loaded (for example, defines some methods on classes defined in BAR), but doesn't otherwise require BAR to work.
17:05:54
pfdietz
The specific use case was trying to use COVER and finding it didn't work on macros from ITERATE.
17:08:00
pfdietz
I'd want it to work if I loaded FOO before BAR, and also if I loaded BAR before FOO. When the second of the two loaded, BAZ would also be loaded.
17:10:40
Bike
"We do NOT recommend you use this feature. If you are tempted to write a system foo that weakly-depends-on a system bar, we recommend that you should instead write system foo in a parametric way, and offer some special variable and/or some hook to specialize its behaviour; then you should write a system foo+bar that does the hooking of things together."
17:14:32
whartung
but that sounds to me, pfdietz, that you’re trying to make some kind of “smart”, “universal” project. Why should the “project” figure out what your code needs. YOU know what it needs, and you know what you want it to do. So, do it. If you want BAZ loaded with FOO and BAR, then do that. Why have logic hanging around for BAZ if you’re not using BAR in the first place?
17:18:56
pfdietz
I want to be able to load COVER and have it work, without me (as the user) having to manually specify those dependencies.
17:19:32
pfdietz
And I don't want loading COVER to then cause all those other packages it has interactions with to also get loaded.
17:55:11
stylewarning
I wonder if the ASDF folks would be open to having a :LICENSE-FILE option for system definitions
17:55:45
stylewarning
That would be monumentally more orderly and convenient---at least for commercial folks---than the paltry license description in the :LICENSE argument.
18:16:04
_death
the asdf manual gives an example with :license but it's not actually specified in the grammar.. so I guess you could have :license (:file "LICENSE" :executive-summary :MIT)
18:28:26
oni-on-ion
i do a similar thing to use .cl extension, (defclass cl-file (cl-source-file) ((type :initform "cl")))
18:31:18
oni-on-ion
idk. this works for me, i was not sure of the expanded and fully resolved name. although naming the subclass cl-file does not clarify matters
18:33:27
oni-on-ion
ohhh i see what you are saying. it is already built in to asdf for .cl , sorry i did not see what you mean.
18:35:02
oni-on-ion
i've developed a particular interest in ".?l" extensions as of late -- prolog .pl, elisp .el, julia .jl, ocaml .ml - and i did not want CL to be left out. also it is semantically more practical to me when extensions are acronyms rather than full words
18:35:28
oni-on-ion
yes. i remember DOS Abuse game, my first exposure to lisp i think. unless i used emacs before this i cant recally
18:35:34
aeth
Don't use .LSP on Unix or NT-based Windows because three character file names have a ton of collisions
18:41:24
oni-on-ion
.pl is the same as perl, already github thinks some of my projects are not in prolog hehe.
18:44:24
aeth
It doesn't just go by extension. I've seen some 'Newlisp' and even some *Python* in CL projects as a false identification
20:05:35
Shinmera
pfdietz: I added my own system to handle that ASDF case. Essetially it defers evaluation and compilation of specific forms until a specified system is loaded.
20:07:38
Shinmera
In radiance all systems that can make use of this deferral must be a subclass of a special system, for which theres an asdf:perform :after method that triggers evaluation
20:09:03
Shinmera
you could add a method on the standard asdf:system, but who knows how long that would work for (since upstream could add a method of its own)
20:12:01
Shinmera
Typically in radiance you use this optional mechanism to provide extra functionality if an implementation of a certain interface is loaded. Since the interface's symbols are always available even without an implementation, symbol resolution in the optional code is also no problem
20:12:55
Shinmera
example: https://github.com/Shirakumo/radiance-contribs/blob/master/r-simple-auth/auth.lisp#L225-L241
20:15:47
Shinmera
The lack of a proper optional dependency spec in ASDF has always bothered me though. Would make this problem much easier
20:18:36
Xach
Well, this does help me in the quicklisp world, because I can statically set the dependencies.
20:19:34
Shinmera
Since then you could do something like: throw the optional code into an optional.lisp, then add (when (find "thing" (asdf:already-loaded-systems) :test #'string=) (load (merge-pathnames "optional.lisp" #.*compile-file-pathname*)))
20:22:54
Xach
Shinmera: the Old ways of doing it made it hard to discover optional dependencies. a new, explicit way would be ok though.
20:23:15
Xach
Like, you might not ever find out that system X required system Y because you never loaded X while Z was also loaded.
20:23:47
Shinmera
Well, in any case, I have a looong list of things I want from my own, future build system :)
21:28:46
jasom
fwiw quicklisp still has to dynamically resolve dependencies in many cases (one-package-per-file systems come to mind).
21:57:34
Lycurgus
slyrus1, in hunchentoot-cgi, how would I go about accessing those server variables that are being processed in lines 79-102 of hunchentoot-cgi.lisp?
22:16:02
makomo
MichaelRaskin: i have a question regarding your 2017 ELS paper. i'm on section 5 which demonstrates the impossibility of a general solution
22:16:49
makomo
MichaelRaskin: hm actually, i'll get back to you. let me read the section to the end before asking anything
22:33:55
makomo
MichaelRaskin: ok. i don't understand this part "We need the lexical environment to depend on the run-time input of the macroexpand-all function, so we need to use eval."
22:34:38
makomo
MichaelRaskin: it's not clear to me what it means for the lexical environment to depend on the run-time input of the macroexpand-all function
22:36:36
makomo
MichaelRaskin: when the compiler tries to expand EXPAND-VIA-FUNCTION, it passes it the current environment. this environment contains the 2 gensym-named MACROLETs set up with SET-X1 and SET-X2. then EXPAND-VIA-FUNCTION calls MACROEXPAND-ALL and passes it this environment (so it can clearly see the two MACROLETs)
22:37:43
makomo
MichaelRaskin: when MACROEXPAND-ALL goes on to expand the given form, why can't it just augment the environment it got with the new MACROLET setup by the 2nd SET-X2 and pass *that* to READ-X1-X2?
22:38:17
makomo
for anyone interested, p. 101, https://european-lisp-symposium.org/static/proceedings/2017.pdf
22:43:15
Colleen
Bike: drmeister said 1 hour, 55 minutes ago: The cst compiler behaves differently than the ast compiler. This is what I get in the Activity Monitor. https://usercontent.irccloud-cdn.com/file/1R6CRBUG/image.png
22:43:15
Colleen
Bike: drmeister said 1 hour, 51 minutes ago: - It seems to be spending a lot of time in sigtramp https://usercontent.irccloud-cdn.com/file/wQjK39GH/image.png
22:43:45
makomo
Bike: while walking the form to expand, it starts from the given environment and augments it with any local stuff found within the form
22:44:58
makomo
if we assume the implementation uses no non-standard special operators and such, what's the remaining problem
22:45:11
pjb
makomo: notice how macroexpand and macros have environment parameters! They're needed and useful!
22:45:44
makomo
Bike: wrong choice of words, i meant just using. i.e. our MACROEXPAND-ALL uses MACROEXPAND and MACROEXPAND-1 internally somehow
22:47:45
makomo
Bike: so if only one had the ability to augment the environment, would it be possible?
22:50:28
Bike
like if you have (macrolet ((a ...)) (macrolet ((b ... (a ...))) ...)) the a has to expand correctly
22:53:49
makomo
and if A's body uses something from the outer lexical scope (which is not part of the form that was passed to MACROEXPAND-ALL)
22:54:13
makomo
even if you had the environment, you wouldn't be able to EVAL the macrolet's body inside of it
22:55:10
Bike
i should mention that, as it happens, the old cltl2 had environment operators that could do this.
22:55:22
makomo
so it's a combination of (1) not being able to augment the environment and (2) not being able to eval something within an environment
22:55:48
Bike
to get the macro function, you'd parse-macro to get the lambda expression, then enclose to get the function.
22:56:51
makomo
pjb: well sure, but macroexpansion aside, it's still useful for other kinds of run-time evaluation
22:57:49
Bike
an implementation kind of has to have things like augment-environment, parse-macro, and enclose anyway, so it's a little weird
23:02:11
makomo
wasn't it the case that non-standard special operators can only be introduced as a replacement for standard macros, but that the macro's definition has to be kept as well
23:02:51
Bike
there's a rule that if an implementation implements a macro as a special operator it still has to provide a macro definition. I don't think there's anything ruling out other special operators.
23:04:13
makomo
non-std special ops aside, what about that common FUNCTION extension with NAMED-LAMBDA?
23:05:28
Bike
oh, hey "An implementation can have extensions, provided they do not alter the behavior of conforming code and provided they are not explicitly prohibited by this standard. "
23:06:09
Bike
i guess it doesn't matter much since the question is whether a code walker is conforming
23:16:23
makomo
MichaelRaskin: i think i understand now. if you will by any chance read the above discussion, feel free to let me know of any details i might have missed.