<pve>
I understand that it works if I do (shadow "ARRAY") or (shadow 'cl:array)
<pve>
but it's not clear to me why (shadow 'array) leads to that weird behaviour, because reading the hyperspec entry for shadow, I get the impression that it should work
Alloc has quit [Ping timeout: 244 seconds]
cosimone has quit [Quit: Quit.]
cosimone has joined #lisp
<pve>
are all the references to the symbol "ARRAY" stored "in one place" in the fasl, so that when the fasl is loaded, LOAD sees 'array (i.e. CL:ARRAY, before shadowing) and then assumes all ARRAY symbols in the fasl are the same?
<pve>
so the shadowing has no effect in that for that fasl
random-nick has joined #lisp
<beach>
The symbol ARRAY already exists in the cl-user package, so it is going to use the pre-existing symbol.
<beach>
Since the symbol already exists, no new symbol is created.
<beach>
It should be the same if you use "ARRAY" or 'cl:array.
<beach>
The name is a designator for a string, so only the name of the symbol matters if you give it a symbol.
<pve>
right, so shadow doesn't throw out CL:ARRAY
<pve>
i mean unintern
<beach>
Right.
<pve>
i forgot about that
Adamclisi has joined #lisp
Oladon has quit [Quit: Leaving.]
<pve>
beach: thanks
<beach>
Sure.
<pve>
but why then, does it print COMMON-LISP-USER::ARRAY if I load-compile from slime (C-c C-k)?
<beach>
Good question. I have no explanation for that. Sorry.
<pve>
could it be a "feature" of sbcl?
<pve>
(I have no other implementation currenty to test on)
<phoe>
beach: sure, I'll grab a video from you
<phoe>
also, good morning everyone
<beach>
phoe: Great!
shangul has joined #lisp
_Posterdati_ has joined #lisp
Bourne has quit [Ping timeout: 240 seconds]
msk has joined #lisp
Posterdati has quit [Ping timeout: 264 seconds]
<pve>
beach: ok, so the discrepancy must have been caused by something I was loading into my slime session (need to investigate that), because if I compile and load my example from the shell without loading any init files or libraries it prints COMMON-LISP-USER::ARRAY in both cases
<pve>
but that doesn't seem right either
<phoe>
pve: what is your Lisp implementation?
<pve>
I would expect COMMON-LISP::ARRAY
<pve>
phoe: sbcl
<phoe>
is this consistent with (describe 'array)?
<beach>
pve: I tend to agree.
<phoe>
I mean, PACKAGE-NAME SYMBOL-PACKAGE should *not* return CL-USER in this case because ARRAY is imported from CL
<pve>
phoe: it is consistent with describe
<phoe>
does DESCRIBE also give you CL-USER instead of CL?
<pve>
phoe: yes
<phoe>
......I can reproduce this
<phoe>
what
<phoe>
how
<phoe>
oh, wait
<phoe>
you are shadowing 'array in line 4
<phoe>
like, explicitly shadowing it
<phoe>
that's why it happens
<phoe>
one second...\
<no-defun-allowed>
The two (or three?) means of compiling and/or loading that code appear to do different things though.
<phoe>
beach: no, wait
<phoe>
SHADOW removes CL:ARRAY from CL-USER and creates CL-USER::ARRAY
<phoe>
"For each such name, if a corresponding symbol is not present in package (directly, not by inheritance), then a corresponding symbol is created with that name, and inserted into package as an internal symbol."
<phoe>
also, arguments for SHADOW are a list of string designators
<pve>
oh, directly
<phoe>
so the symbol CL:ARRAY is turned into "ARRAY"
<phoe>
and then this gets shadowed.
<phoe>
so if we pass CL:ARRAY, or :ARRAY, or "ARRAY", the behavior is the same
<pve>
yeah that part was my mistake
<pve>
but the "(directly, not by inheritance)" completely explains everything
<White_Flame>
the package of 'array is found by the reader
<phoe>
but 'array then gets coerced into "ARRAY" which drops package information
<White_Flame>
I mean in the parameter to FORMAT
<White_Flame>
not to shadow
<beach>
Oh, sorry. I didn't see the "not by inheritance".
<pve>
phew, I thought I was losing my mind here
<phoe>
oh! yes
Grauwolf has quit [Quit: WeeChat 2.7.1]
Necktwi has quit [Ping timeout: 256 seconds]
<White_Flame>
hmm, nevermind, I think that the eval-when should guarantee the shadowing before the format expression is read
<White_Flame>
although #. would force the issue :-P
<White_Flame>
this is why it's important to have a separate package.lisp to set everything up in a separate file
zaquest has quit [Quit: Leaving]
Grauwolf has joined #lisp
Grauwolf has quit [Changing host]
Grauwolf has joined #lisp
<phoe>
no, why? DEFPACKAGE + IN-PACKAGE at the top of a file solves that issue just as well
<phoe>
exactly because of EVAL-WHEN that both of them use internally
<phoe>
the SHADOW call should be a part of DEFPACKAGE, that's my only real gripe with this code
<phoe>
...but you can't DEFPACKAGE CL-USER, obviously
X-Scale` has joined #lisp
<pve>
my original problem was probably caused by some package-fu I'm doing in the project I'm working on
<pve>
But thank you guys for the help!
zaquest has joined #lisp
X-Scale has quit [Ping timeout: 240 seconds]
X-Scale` is now known as X-Scale
Necktwi has joined #lisp
ukari has joined #lisp
rumbler3_ has joined #lisp
ukari has quit [Remote host closed the connection]
rumbler31 has quit [Ping timeout: 240 seconds]
josemanuel has joined #lisp
bitmapper has quit [Read error: Connection reset by peer]
simendsjo has joined #lisp
bitmapper has joined #lisp
dmiles has quit [Read error: Connection reset by peer]
shangul has quit [Read error: Connection reset by peer]
jason_m has quit [Ping timeout: 258 seconds]
josemanuel has quit [Ping timeout: 240 seconds]
matijja has quit [Quit: bye]
jw4 has quit [Quit: tot siens]
logicmoo has joined #lisp
shangul has joined #lisp
josemanuel has joined #lisp
fouric has quit [Ping timeout: 240 seconds]
jw4 has joined #lisp
jfb4 has quit [Remote host closed the connection]
matijja has joined #lisp
isaac has joined #lisp
kilimanjaro has quit [Ping timeout: 246 seconds]
<beach>
Am I reading the dictionary entry for DEFCONSTANT right in that the constant is not defined at compile time?
<beach>
It says that the compiler must recognize that the name names a constant variable, but not that the value is available at compile time.
jw4 has quit [Read error: Connection reset by peer]
akoana has quit [Ping timeout: 240 seconds]
d4ryus has quit [Ping timeout: 260 seconds]
tessier has quit [Ping timeout: 264 seconds]
lowryder has quit [Ping timeout: 260 seconds]
srji has joined #lisp
mangul has joined #lisp
shangul has quit [Remote host closed the connection]
<phoe>
"An implementation may choose to evaluate the value-form at compile time, load time, or both."
jeosol has quit [Ping timeout: 245 seconds]
<phoe>
seems pretty clear to me
jw4 has joined #lisp
<beach>
OK, let me ask the question differently then.
<phoe>
if the value is allowed to be available only at load time, then it may *not* be available at compile time
yang has quit [Ping timeout: 244 seconds]
<phoe>
where "available" means "after being evaluated"
jgodbout has quit [Ping timeout: 244 seconds]
splittist has quit [Ping timeout: 244 seconds]
cgay has quit [Ping timeout: 244 seconds]
jmercouris has quit [Ping timeout: 244 seconds]
rme has quit [Ping timeout: 244 seconds]
gendl has quit [Ping timeout: 244 seconds]
selwyn has quit [Ping timeout: 244 seconds]
l1x has quit [Ping timeout: 244 seconds]
Balooga has quit [Ping timeout: 244 seconds]
avicenna has quit [Ping timeout: 244 seconds]
billstclair has quit [Ping timeout: 244 seconds]
grfn has quit [Ping timeout: 244 seconds]
<beach>
Yeah, that's what I see as well.
v3ga has quit [Ping timeout: 240 seconds]
midre has quit [Ping timeout: 256 seconds]
<phoe>
it is allowed not to be available at compile-time, BUT it also says that this behavior is implementation-dependent
ralt has quit [Ping timeout: 240 seconds]
<phoe>
so as an implementer you can do e.g. what SBCL does which is to EVAL-ALWAYS %DEFCONSTANT
hydan has quit [Read error: Connection reset by peer]
dnm has quit [Read error: Connection reset by peer]
conjunctive has quit [Read error: Connection reset by peer]
lukego has quit [Write error: Connection reset by peer]
jsatk has quit [Read error: Connection reset by peer]
chewbranca has quit [Read error: Connection reset by peer]
pent has quit [Read error: Connection reset by peer]
stylewarning has quit [Write error: Connection reset by peer]
Christ0p1er has quit [Ping timeout: 258 seconds]
avicenna has joined #lisp
yang has joined #lisp
<phoe>
but it seems that as a user you cannot really depend on the constant being available at compile time.
billstclair has joined #lisp
<beach>
Right, so a file containing (defconstant bla ...) (defun foo (..) bla) may or may not work.
v3ga has joined #lisp
chewbranca has joined #lisp
jsatk has joined #lisp
<phoe>
no no, actually
<phoe>
it might work
rme has joined #lisp
lukego has joined #lisp
selwyn has joined #lisp
ravndal has quit [Ping timeout: 265 seconds]
stylewarning has joined #lisp
<beach>
That's what I said.
<phoe>
imagine a simple implementation that implements DEFCONSTANT via DEFPARAMETER
<beach>
It may or may not work.
cgay has joined #lisp
Balooga has joined #lisp
hydan has joined #lisp
dnm has joined #lisp
grfn has joined #lisp
conjunctive has joined #lisp
<phoe>
it *must* work
<phoe>
"If a defconstant form appears as a top level form, the compiler must recognize that name names a constant variable."
<beach>
Yes, but not the value.
<phoe>
yes, that's correct
<phoe>
but we don't need the value
Christ0pher has joined #lisp
<phoe>
just to recognize that BLA is a defined name
<beach>
And when foo is compiled, the value must be known.
<phoe>
no, wait, why
<beach>
How else would you compile foo?
<phoe>
(defvar bla ...) (defun foo (...) bla)
<phoe>
or rather
<phoe>
(defparameter bla ...) (defun foo (...) bla)
<beach>
I am saying, what does the compiler do when it sees bla?
<phoe>
depends on the implementation!
<beach>
Oh, I see what you are saying.
<beach>
It silently doesn't use the constant.
ravndal has joined #lisp
<phoe>
yes
<beach>
That's vicous.
<beach>
vicious
<phoe>
but allowed for very simple implementations, I guess
<phoe>
it's impossible to do any optimizations that way
<phoe>
but this way is trivial to implement and preserves language semantics, since constant redefinition is undefined
<phoe>
so you effectively get a single-assignment global variable.
gendl has joined #lisp
<phoe>
so a really dumb implementation can go this way and still conform.
<beach>
I would tend to signal an error, or at least a warning, but I can't see whether it would be allowed to do that.
<beach>
I guess a warning and then compile it as you said.
srji has quit [Ping timeout: 240 seconds]
jmercouris has joined #lisp
midre has joined #lisp
jgodbout has joined #lisp
srji has joined #lisp
jfb4 has joined #lisp
<phoe>
a warning for what exactly?
tessier has joined #lisp
tessier has quit [Changing host]
tessier has joined #lisp
<beach>
That the compiler did not have access to the value so it had to compile it as an access to a variable defined at run time.
<phoe>
did not have access, you mean, it encountered an unknown variable?
natj212 has joined #lisp
akoana has joined #lisp
<beach>
That the compiler did not have access to the VALUE at compile time, so it could not compile the code as if BLA were the constant that it is defined to be. And instead it had to compile it as an access to a variable at run time, thereby degrading performance.
lowryder has joined #lisp
<phoe>
I think I partially understand... why would it not have access to VALUE at compile-time? an implementation is allowed to evaluate the DEFCONSTANT value at compile-time, so signaling a warning in that case sounds like a making bugticket for your own self
<phoe>
I mean, your compiler is allowed to just grab the value at compile-time and use it
<phoe>
and if user code is built in a way that doesn't make it possible, *then* it's a bug on the user side
<beach>
Because the implementation chose not to evaluate the initialization at compile time, or at least chose to not store that value for compile-time availability.
<phoe>
oh, sure
<phoe>
but then it's allowed to do that, so I guess that the only warning it can signal would be a STYLE-WARNING
<phoe>
or rather a compiler note
<beach>
Yes, and a bug on the user side could be indicated by a warning.
<phoe>
yep
<beach>
Thanks.
d4ryus has joined #lisp
Inline has joined #lisp
Inline has quit [Remote host closed the connection]
tsrt^ has quit [Ping timeout: 258 seconds]
kilimanjaro has joined #lisp
natj212 has quit [Ping timeout: 256 seconds]
tsrt^ has joined #lisp
vhost- has quit [Ping timeout: 256 seconds]
jw4 has quit [Ping timeout: 258 seconds]
mathrick has quit [Ping timeout: 258 seconds]
<iissaacc>
i redefined a method from a library in some code, and I don't get any warnings and the redefinition works as expected in a REPL session. But when I tested it in a fresh REPL session the old behaviour associated with that method happens, i.e the redefinition doesnt seem to have taken effect. Does anyone know why this could be?
jgodbout has quit [Ping timeout: 240 seconds]
<phoe>
are you sure you got the packages right?
<phoe>
this bit me a few times when doing method redefinitions
<phoe>
like, (DEFMETHOD QUUX ...) is allowed to define a method on FOO:QUUX
<phoe>
but it is also allowed to *silently* create a brand new generic function BAR:QUUX and then define a method on this
<iissaacc>
ahhhhh
<phoe>
and then calling FOO:QUUX, understandably, gives the old effects
<iissaacc>
right, so my redefinition is actually creating a new generic function in my package
<iissaacc>
instead of redefining the generic function from the package
<phoe>
that's why I wish there was a toggle to cause DEFMETHOD to error if the respective generic function is not found.
<phoe>
at least for *some* code
<phoe>
I've wasted lots of time on debugging this stuff.
<iissaacc>
so if i include the package prefix it should work as expected
natj212 has joined #lisp
<phoe>
yes, it should work if you pass the proper GF name to DEFMETHOD.
akoana has left #lisp ["Leaving"]
mbrumlow has quit [Ping timeout: 244 seconds]
<iissaacc>
thanks man that was making me scratch my head a bit
<phoe>
this behavior annoys me so much that this was the first thing I actually thought of
<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.
<phoe>
(where "The Wrong Thing™" is my subjective opinion)
<iissaacc>
what would be cool would be being able to inspect function definitions, but afaik this isnt possible because things get compiled straight away
<phoe>
inspect function definitions, what do you mean?
<phoe>
slime's M-. usually can get you to source locations of everything
jgodbout has joined #lisp
<phoe>
and then there is also FUNCTION-LAMBDA-EXPRESSION that works in some cases
<iissaacc>
ah cool
fouric has joined #lisp
pent has joined #lisp
narimiran has quit [Ping timeout: 265 seconds]
simendsjo has quit [Remote host closed the connection]
Inline has joined #lisp
mbrumlow has joined #lisp
Gerula has quit [Ping timeout: 264 seconds]
mathrick has joined #lisp
ayuce has joined #lisp
splittist has joined #lisp
luckless_ has joined #lisp
Inline has quit [Read error: Connection reset by peer]
l1x has joined #lisp
notzmv has quit [Ping timeout: 258 seconds]
tumdum has quit [Remote host closed the connection]
jw4 has joined #lisp
tumdum has joined #lisp
luckless has quit [Ping timeout: 240 seconds]
jw4 has quit [Remote host closed the connection]
jw4 has joined #lisp
hendursa1 has quit [Remote host closed the connection]
hendursa1 has joined #lisp
alfonsox has joined #lisp
cosimone_ has joined #lisp
cosimone has quit [Ping timeout: 240 seconds]
paines has quit [Ping timeout: 265 seconds]
cosimone_ has quit [Quit: Quit.]
Bourne has joined #lisp
mangul is now known as shangul
jasom_ has quit [Read error: Connection reset by peer]
jasom_ has joined #lisp
nmg has quit [Ping timeout: 240 seconds]
pent has quit [Ping timeout: 240 seconds]
mbrumlow has quit [Ping timeout: 244 seconds]
nmg has joined #lisp
l1x has quit [Read error: Connection reset by peer]
splittist has quit [Read error: Connection reset by peer]
brass has quit [Ping timeout: 240 seconds]
mbrumlow has joined #lisp
l1x has joined #lisp
splittist has joined #lisp
jgodbout has quit [Ping timeout: 244 seconds]
jw4 has quit [Ping timeout: 240 seconds]
liberliver has quit [Ping timeout: 272 seconds]
pent has joined #lisp
jgodbout has joined #lisp
liberliver has joined #lisp
jw4 has joined #lisp
brass has joined #lisp
sveit has quit [Ping timeout: 256 seconds]
femi has quit [Ping timeout: 256 seconds]
wxie has joined #lisp
gko`` has joined #lisp
nullman has quit [Ping timeout: 256 seconds]
gko has quit [Ping timeout: 256 seconds]
jw4 has quit [Remote host closed the connection]
femi has joined #lisp
bitmapper has quit [Ping timeout: 240 seconds]
jw4 has joined #lisp
nullman has joined #lisp
sveit has joined #lisp
jw4 has quit [Ping timeout: 240 seconds]
mseddon has joined #lisp
gendl has quit [Read error: Connection reset by peer]
gendl has joined #lisp
simendsjo has joined #lisp
Inline has joined #lisp
ayuce has quit [Remote host closed the connection]
Alloc has quit [Ping timeout: 256 seconds]
jw4 has joined #lisp
l1x has quit [Read error: Connection reset by peer]
Alloc has joined #lisp
pent has quit [Read error: Connection reset by peer]
pent has joined #lisp
l1x has joined #lisp
jw4 has quit [Remote host closed the connection]
entel has quit [Quit: Connection closed for inactivity]
cosimone has joined #lisp
paines has joined #lisp
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #lisp
mangoicedtea has joined #lisp
notzmv has joined #lisp
Alloc has quit [Ping timeout: 244 seconds]
jw4 has joined #lisp
alfonsox has quit [Remote host closed the connection]
jonatack has quit [Quit: jonatack]
jw4 has quit [Quit: tot siens]
yonkunas has quit [Quit: Connection closed for inactivity]
gko has joined #lisp
todun has joined #lisp
todun has left #lisp [#lisp]
todun has joined #lisp
todun has left #lisp [#lisp]
wxie has quit [Ping timeout: 240 seconds]
todun has joined #lisp
jonatack has joined #lisp
jw4 has joined #lisp
gendl has quit [Ping timeout: 240 seconds]
Bourne has quit [Ping timeout: 240 seconds]
splittist has quit [Read error: Connection reset by peer]
jgodbout has quit [Read error: Connection reset by peer]
pent has quit [Read error: Connection reset by peer]
mbrumlow has quit [Ping timeout: 240 seconds]
splittist has joined #lisp
jgodbout has joined #lisp
mbrumlow has joined #lisp
pent has joined #lisp
gendl has joined #lisp
jw4 has quit [Ping timeout: 246 seconds]
simendsjo has quit [Ping timeout: 258 seconds]
iissaacc has quit [Remote host closed the connection]
liberliver has quit [Remote host closed the connection]
liberliver has joined #lisp
iissaacc has quit [Ping timeout: 240 seconds]
p_l|shitmbp has joined #lisp
p_l|shitmbp has quit [Client Quit]
orivej has joined #lisp
p_l|shitmbp has joined #lisp
larme has joined #lisp
hendursaga has quit [Ping timeout: 240 seconds]
wigust has quit [Remote host closed the connection]
wigust has joined #lisp
Inline has joined #lisp
hendursaga has joined #lisp
mbrumlow has quit [Ping timeout: 240 seconds]
C-16 has joined #lisp
FreeBirdLjj has joined #lisp
mbrumlow has joined #lisp
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
gxt has quit [Remote host closed the connection]
mathrick has quit [Ping timeout: 240 seconds]
jgodbout has quit [Ping timeout: 240 seconds]
jgodbout has joined #lisp
jibanes has quit [Ping timeout: 240 seconds]
mangoicedtea has quit [Remote host closed the connection]
Alloc has joined #lisp
jibanes has joined #lisp
vhost- has joined #lisp
Alloc has quit [Ping timeout: 244 seconds]
iAmDecim has joined #lisp
Alloc has joined #lisp
dra has joined #lisp
brj has quit [Ping timeout: 240 seconds]
brj has joined #lisp
davepdotorg has joined #lisp
peterhil has quit [Read error: Connection reset by peer]
peterhil has joined #lisp
simendsjo has quit [Ping timeout: 240 seconds]
p_l|shitmbp has quit [Ping timeout: 258 seconds]
<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
<mseddon>
sbcl ignores it, for e.g.
johnweldon has joined #lisp
jw4 has quit [Ping timeout: 240 seconds]
tsrt^ has quit [Read error: Connection reset by peer]
davepdotorg has quit [Remote host closed the connection]
tumdum has quit [Remote host closed the connection]
jibanes has quit [Ping timeout: 240 seconds]
<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.
<_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."
<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.
mokulus has quit [Quit: WeeChat 2.9]
<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 #=
jibanes has joined #lisp
<beach>
Oh, sorry, read-char. Misread.
<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
* beach
must be tired after a long day of intense work.
<edgar-rft>
in particular 1) #n= and #n# syntax 2) whitespace presevation and 3) end-of-file handling
simendsjo has joined #lisp
liberliver has quit [Ping timeout: 244 seconds]
<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.
<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
Inline has quit [Ping timeout: 244 seconds]
gpiero has joined #lisp
jason_m has joined #lisp
<mseddon>
edgar-rft, thanks!
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
simendsjo has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
liberliver has joined #lisp
jeosol has joined #lisp
iAmDecim has joined #lisp
iAmDecim has quit [Ping timeout: 246 seconds]
EvW has joined #lisp
Inline has joined #lisp
kopiyka has joined #lisp
simendsjo has joined #lisp
<shka_>
hello
<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
<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
<shka_>
phoe: returning… where?
<phoe>
shka_: actually, well, just :BEFORE
<phoe>
:AFTER has nowhere to return it to
<shka_>
well, ok
<shka_>
if only before bothers you, it can be solved by adding separate generic function before-foo which will call the foo in :AFTER
<phoe>
I'm just annoyed that :BEFORE is the wrong tool for this job, it would have been much cleaner in my eyes
<shka_>
where foo goes like (apply #'do-foo (validate-foo arg1 arg2))
<shka_>
well, it is what it is
<shka_>
hmmm
<shka_>
phoe: i have an idea
<shka_>
phoe: instead of doing that, you can simply mutate list stored in special variable
<shka_>
and then, apply said list
<shka_>
a little bit annoying to write it by hand, but easy to generate with macro
<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)
<phoe>
this is going to fail in case of the effective method being precomputed and then applied
<phoe>
oh wait, no
<phoe>
we're talking about keyword arguments now...
<phoe>
this is a dangerous idea, still, mutating the arglist is kinda like pulling the rug that my GF is standing on
iAmDecim has joined #lisp
Jeanne-Kamikaze has joined #lisp
<shka_>
phoe: eh, keyword arguments are annoying :/
<shka_>
useful, but hard to handle
liberliver has quit [Ping timeout: 240 seconds]
<shka_>
phoe: i don't have any other ideas
iAmDecim has quit [Ping timeout: 240 seconds]
jurov has quit [Remote host closed the connection]
jurov has joined #lisp
narimiran has joined #lisp
<Krystof>
phoe: you could do your type checking in the method combination
<Krystof>
I think
<phoe>
Krystof: that's one idea, I'd need to pass types/validation into the method combination though, somehow
<Krystof>
yeah, and it doesn't work, I think, sadly:
<Krystof>
"the consequences of using such a form as the place in a setf form are undefined."
<phoe>
yes
luckless has joined #lisp
hiroaki has joined #lisp
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life_ is now known as Lord_of_Life
gko has quit [Ping timeout: 256 seconds]
alfonsox has joined #lisp
orivej has quit [Ping timeout: 240 seconds]
<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.
bitmapper has joined #lisp
Inline has quit [Ping timeout: 244 seconds]
<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.
orivej has joined #lisp
thecoffemaker has joined #lisp
<hendursaga>
I could use xmls' toxml for that, though?
FreeBirdLjj has quit [Remote host closed the connection]
<shka_>
there is also serialize function, i never used it though
<shka_>
but parsing and querying works perfectly fine
abhixec has quit [Ping timeout: 265 seconds]
<hendursaga>
shka_: lquery uses plump, actually
<shka_>
well, yes
<shka_>
and there is stuff like remove-child and stuff
<shka_>
so i think it matches your needs, right?
<hendursaga>
Yes, I finally figured it out. Wish it didn't take as long as it did, though :/
<shka_>
don't be angry, it happens
<hendursaga>
There's just so many different libraries out there, so many Lisps, so little documentation.
harasan has joined #lisp
VincentVega has joined #lisp
jeosol has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #lisp
EvW has quit [Ping timeout: 240 seconds]
dra has quit [Ping timeout: 240 seconds]
orivej has quit [Ping timeout: 258 seconds]
nicktick has quit [Ping timeout: 240 seconds]
karlosz has joined #lisp
orivej has joined #lisp
alfonsox has quit [Remote host closed the connection]
<VincentVega>
Hi guys. I have stumbled upon this weird compilation vs evaluation deal, not sure what I am doing wrong: https://pastebin.com/J0A2sWYB
<VincentVega>
Would be glad if someone could take a look.
<phoe>
why is this a macro?
<VincentVega>
I have simplified a larger piece of code I was working with.
EvW has joined #lisp
<phoe>
DEFCLASS or ENSURE-FINALIZED is not evaluated in such case because the error happens when macroexpanding the form
<phoe>
that's my first understanding
<VincentVega>
That seems to be true, indeed.
<VincentVega>
So, if the form errors out, the changes don't take effect?
<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.
<phoe>
they should not
<phoe>
wait a second, doesn't slime tell you where the error is?
<phoe>
you should be able to click on the line in *slime-compilation-errors* and jump to the file position
<phoe>
then you can fix it and C-c C-k the whole file and/or retry loading the system
<VincentVega>
Well, when it errors out, yeah it tells me there's an error.
<VincentVega>
I see, OK.
<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?
<phoe>
yes
<phoe>
I get consistent results though
<VincentVega>
sbcl version?
<phoe>
the no-class-found error I get is consistent if I answer N to loading the created/broken fasl file
<phoe>
SBCL 2.0.6
<VincentVega>
Oh. I don't reload the whole file though, I just compile the forms one by one.
ralt has joined #lisp
shangul has quit [Ping timeout: 256 seconds]
<phoe>
ooooh
<phoe>
yes, I can reproduce that
izh_ has joined #lisp
<phoe>
I wonder why that works
<VincentVega>
Yeah, me too
<phoe>
likely some compile-time side effects that are kicking
<phoe>
maybe Bike will know
<phoe>
he's not here at the moment thogh
<VincentVega>
I can certainly wait
jibanes has quit [Ping timeout: 240 seconds]
jibanes has joined #lisp
<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
<hendursaga>
I've been looking through sample code on Github but I can't see anything that might fit.
shka_ has quit [Ping timeout: 264 seconds]
<hendursaga>
Basically, how do I refer to the current set of elements being acted upon inside replace-with?
flazh1 has quit [Ping timeout: 258 seconds]
mseddon_ has joined #lisp
mseddon_ has quit [Client Quit]
mseddon has quit [Ping timeout: 258 seconds]
entel has joined #lisp
flazh1 has joined #lisp
rumbler3_ has quit [Remote host closed the connection]
rumbler31 has joined #lisp
peterhil has quit [Ping timeout: 264 seconds]
Jesin has quit [Quit: Leaving]
simendsjo has quit [Ping timeout: 240 seconds]
peterhil has joined #lisp
Jesin has joined #lisp
luckless has quit [Quit: WeeChat 2.8]
luckless has joined #lisp
yitzi has joined #lisp
oldtopman has joined #lisp
shka_ has joined #lisp
<hendursaga>
Perhaps an example of how to use lquery's each with replace?
<phoe>
hendursaga: #shirakumo might help
edgar-rft has quit [Quit: Leaving]
hendursaga has quit [Quit: hendursaga]
hendursaga has joined #lisp
Oladon has joined #lisp
shka_ has quit [Ping timeout: 256 seconds]
narimiran has quit [Ping timeout: 265 seconds]
Aruseus has joined #lisp
Aruseus has quit [Client Quit]
ralt has quit [Quit: Connection closed for inactivity]
cosimone has quit [Ping timeout: 240 seconds]
gravicappa has quit [Ping timeout: 265 seconds]
dra has joined #lisp
cosimone has joined #lisp
iissaacc has joined #lisp
cosimone_ has joined #lisp
rumbler31 has quit [Remote host closed the connection]
cosimone has quit [Ping timeout: 240 seconds]
harasan has quit [Quit: WeeChat 2.3]
macoy has joined #lisp
<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?
<macoy>
(because macro expansion time has no idea we're supposed to be interpreting it as a DSL marker)
Inline has joined #lisp
<phoe>
macoy: stop that macro from being expanded... do you mean the quote operator?
<phoe>
"regardless of any context" is not really true, e.g. (case 42 (defun foo () ...) ...) will not macroexpand DEFUN
<phoe>
this is because CASE itself is a macro and includes its own syntax
<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
<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.
<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.
<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)
izh_ has quit [Quit: Leaving]
<phoe>
macoy: no no no, macros are expanded from outside in
<phoe>
if you have (FOO (BAR (BAZ ...))) then if FOO is a macro then it is expanded first
<phoe>
and the macroexpansion may not even contain the form (BAR (BAZ ...)) or any form like it
<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! :)
<phoe>
<3
<phoe>
macoy: figure out how other Lisp dialects do it before implementing your own
<phoe>
like, you've wandered into #lisp, which is a place full of Common Lisp programmers
<aeth>
see also: ##lisp (Lisp family) and #scheme (Scheme subfamily)
<aeth>
but a lot of Schemes don't even have unhygienic macros anymore
<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;
<macoy>
generators themselves can be written with other generators etc.)
<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.)
<aeth>
So Schemes focus on hygienic macro systems which are very different.
<phoe>
macoy: so basically some sorta Lisplike macro system that spits out C code?
<macoy>
aeth: Thanks for the other room recommendations!
<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)
<phoe>
CL:LISP?
<phoe>
oh, you meant CL:LIST
<aeth>
CL:LIST heh
<bitmapper>
hmm.
<phoe>
hmmmmmm
<bitmapper>
what to do about this code that expects in-package to make a package if it doesn't exist
<bitmapper>
note: other than that, this code is rather nice unlike last time
<phoe>
write your own IN-PACKAGE and use that instead
<bitmapper>
im pleased to say that there is docstrings everywhere
<bitmapper>
and no weird hacks
<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
<aeth>
While Lisp-1 macro design in Scheme worries about this sort of thing more and focuses on hygiene.
<aeth>
but how the language choices affect the preferred macros is more of a topic for ##lisp
<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
sympt has quit [Read error: Connection reset by peer]