freenode/#lisp - IRC Chatlog
Search
10:29:24
phoe
but it is also allowed to *silently* create a brand new generic function BAR:QUUX and then define a method on this
10:30:09
iissaacc
right, so my redefinition is actually creating a new generic function in my package
10:30:49
phoe
that's why I wish there was a toggle to cause DEFMETHOD to error if the respective generic function is not found.
10:33:58
phoe
one of the few cases where Lisp is allowed to completely silently do The Wrong Thing™ and the blame is fully on the programmer for not checking their symbols.
10:35:11
iissaacc
what would be cool would be being able to inspect function definitions, but afaik this isnt possible because things get compiled straight away
14:55:32
mseddon
has any lisp implementation used the recursive-p argument for read-char? What is it supposed to do there? It only makes sense for me within read
15:00:39
beach
Yes, it is meant for use when READ calls READ recursively. You can use it when you call READ from one of your reader macros, for instance.
15:00:50
_death
"It is also necessary to distinguish betwene top-level and internal calls to READ-CHAR and READ-LINE and others for the purposes of EOF handling."
15:05:52
beach
mseddon: One example is the handling of #= and ##. When RECURSIVE-P is false, a new dictionary for those is created. But you don't want to create a new dictionary for a recursive call.
15:07:21
mseddon
beach, yes, but since read-char is not reentrant, and just returns a character, eof-error or signals an error, I don't see what read-char needs recursive-p for, since I figure the recursive-p would be handled by the macro character #=
15:08:04
mseddon
ah yeah, that's the odd one. read-char, peek-char and unread-char all take recursive-p who's purpose is a mystery
15:08:30
_death
mseddon: make sure you include the [...] part.. I also put up a gnus friendly version in a single file (cl-su-ai) at https://github.com/death/gnus-friendly-archives
15:12:40
edgar-rft
cltl2 has some lengthy explanations about recursive-p under https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node195.html
15:14:59
edgar-rft
in particular 1) #n= and #n# syntax 2) whitespace presevation and 3) end-of-file handling
15:18:01
flip214
is there a way to make QL fetch a tarball of FASLs instead of source files? I'm thinking about pre-compiling all (or at least most) required libraries for a container setup.
15:18:52
flip214
QL because then the dev and release code would be the same, only the config (which base URL to fetch from) would be different
15:54:02
phoe
random rant: :BEFORE and :AFTER methods should be capable of returning the list of arguments that is then passed into/out of the primary method
15:54:35
phoe
I need to do literally everything in :AROUND if I want to validate arguments while providing valid STORE-VALUE restarts that will mutate the *proper* place
15:56:31
shka_
if only before bothers you, it can be solved by adding separate generic function before-foo which will call the foo in :AFTER
15:57:34
phoe
(defgeneric frob (thing)) (defmethod frob :before (thing) (check-type thing integer)) (defmethod frob (thing) thing) (handler-bind ((type-error (lambda (c) (declare (ignore c)) (invoke-restart 'store-value 42)))) (frob :forty-two))
16:03:00
phoe
I'm just annoyed that :BEFORE is the wrong tool for this job, it would have been much cleaner in my eyes
16:07:19
p_l
among today's internet woes, I'd like to give a honorable and channel-related mention that AS 5 is apparently still alive and took part in the brouhaha (AS 5 = Symbolics :D)
16:07:30
phoe
this is going to fail in case of the effective method being precomputed and then applied
16:08:25
phoe
this is a dangerous idea, still, mutating the arglist is kinda like pulling the rug that my GF is standing on
16:29:08
phoe
Krystof: that's one idea, I'd need to pass types/validation into the method combination though, somehow
16:54:56
hendursaga
Can anyone recommend a good library for manipulating XML? Not just parsing or processing, but manipulating and then outputting back to XML. Preferably with XPath or DOM/CSS selector support.
16:57:51
hendursaga
So far it seems lquery is my best bet, but I'm not sure how to replace XML with something like S-XML which would then be serialized back to XML.
17:23:20
hendursaga
There's just so many different libraries out there, so many Lisps, so little documentation.
17:59:56
VincentVega
Hi guys. I have stumbled upon this weird compilation vs evaluation deal, not sure what I am doing wrong: https://pastebin.com/J0A2sWYB
18:06:41
phoe
DEFCLASS or ENSURE-FINALIZED is not evaluated in such case because the error happens when macroexpanding the form
18:12:40
VincentVega
It also seems to be the case when quickloading a project. If the file has an error, it's as if no definition before the error ever got evaluated so I have to eval manually till the error. It's a bit annoying. tbh.
18:13:41
phoe
you should be able to click on the line in *slime-compilation-errors* and jump to the file position
18:17:10
VincentVega
Well, it's still weird, because if no changes should take effect, then the second compilation of the progn should yield the same result, shouldn't it?
18:19:32
phoe
the no-class-found error I get is consistent if I answer N to loading the created/broken fasl file
18:34:06
hendursaga
How might I use lquery to, say, append a string to the text of every <p> node? replace-with looks like it might work but I'm new to CL
18:36:29
hendursaga
I've been looking through sample code on Github but I can't see anything that might fit.
18:41:09
hendursaga
Basically, how do I refer to the current set of elements being acted upon inside replace-with?
20:50:12
macoy
Hi, I'm writing a Lisp-like language and was wondering if you guys could help me with a detail: In macro expansion time, does the interpreter basically traverse the entire AST recursively, and evaluate anything which happens to have a macro name by an open paren, regardless of any context? e.g. if I make up a DSL, but it wants to use a name which a macro also has, there's nothing to stop that macro from being expanded?
20:51:24
macoy
(because macro expansion time has no idea we're supposed to be interpreting it as a DSL marker)
20:54:03
phoe
"regardless of any context" is not really true, e.g. (case 42 (defun foo () ...) ...) will not macroexpand DEFUN
20:55:05
phoe
if your DSL performs some sort of code walking, then it can introduce its own macro system when it compiles your DSL down to your Lisp
20:58:16
macoy
phoe: Ah, I think I see what I was misunderstanding: I was imagining macro expansion would happen like function argument evaluation, where if you invoke a macro within another macro's arguments, the invoked macro (deepest) will be expanded first.
20:58:16
macoy
With the case example, it makes sense that macros actually need to be generated immediately once encountered, then that generated code is evaluated for further macro expansion.
20:58:17
macoy
So my DSL won't have problems with macro name collisions because I convert all the DSL symbols into something else (otherwise it wouldn't be a DSL, it'd just be Lisp)
21:02:12
phoe
and the macroexpansion may not even contain the form (BAR (BAZ ...)) or any form like it
21:04:53
macoy
phoe: That makes much, much more sense than what I was thinking. Thanks a lot, you've saved me a lot of heartache had I tried the other approach first! :)
21:12:43
macoy
phoe: That's fair enough. I suppose I didn't do too deep of research (besides using Elisp and SBCL a bit, and generally knowing about tokenizers and parsers). I'm not trying to make a classical Lisp, it's more a Lisp-ish thing that I don't really know how to define. It uses generated C code to do all the actual work, and the only thing I define is macros and generators (generators do nothing but receive tokens and output C/C++ code;
21:12:51
aeth
They're more problematic in Lisp-1s because name conflicts are easier. That and Scheme doesn't namespace symbols like CL does, so name conflicts are easier. (You can actually still get name conflicts in CL, with FLET, since functions/macros aren't usually gensymmed.)
21:14:55
aeth
Lisp-1 means functions and variable share a namespace, if you're wondering. So (let ((list (list 1 2 3))) ...) can really easily mess with macros in the ... that call list. In CL, you generally only gensym the variable namespace, since the function/macro namespace has other protections (and the CL package, containing CL:LISP can be protected from redefine in a DEFUN or FLET)
21:17:07
bitmapper
what to do about this code that expects in-package to make a package if it doesn't exist
21:17:54
aeth
My point is, Lisp-2's like CL don't really worry about non-variable gensyms in macros because (0) you have to modify the function, not variable, namespace (probably locallly with FLET/LABELS), (1) you're probably not USE'ing a package (and it might not be exported; so it's other-package::foo, not foo), (2) if you are using a package and it's CL it's protected from redefinition
21:18:15
aeth
While Lisp-1 macro design in Scheme worries about this sort of thing more and focuses on hygiene.
21:19:30
aeth
but how the language choices affect the preferred macros is more of a topic for ##lisp
21:21:08
macoy
phoe: Yes, C-mera looks exactly like what I'm doing. Too bad I didn't discover it sooner! I want to continue working on my version, but C-mera looks interesting for sure
22:01:28
dra
macoy: Here's a small snippet from an interpreter I wrote some time ago in C++: http://pastie.org/p/3LGO6xC0aQ6wIIBQQ0lUAB