tyson2 has quit [Remote host closed the connection]
akoana has joined #commonlisp
alphacentauri has quit [Quit: WeeChat 4.0.5]
<Gleefre>
Alexandria's PARSE-BODY signals an error when there are duplicate two documentations strings... Wouldn't it be better if that behaviour was configurable, or, at least, it was a continuable error?
<ldb>
with CL condition system you can continua from any error youself
<Gleefre>
Only from continuable errors, no?
<Gleefre>
I can't say to alexandria's function that "it's fine, just go on parsing declarations"
jrm has quit [Quit: ciao]
<Gleefre>
Is it an actual error to define a functions like that: (defun abc () "a" "b" "c") ? Seems like it probably is unspecified behaviour - from what I see SBCL gives a warning and CLISP signals an error, while other implementations I tested on [ cmucl, ccl, allegro, lispworks, ecl, clasp, abcl ] silently accept it.
<Gleefre>
clhs 3.4.11 says "The consequences are unspecified if more than one such documentation string is present.", so indeed seems like that
<ldb>
Gleefre: you get error because you specified :documentation t
jrm has joined #commonlisp
<Gleefre>
Yes. I want to be able to parse declarations AND documentation, and not get an error when duplicate docstrings are used
<ldb>
you can write a conditional handler do: if there is a error retry call alexandria:parse-body without :documentation t
<Gleefre>
I mean, it will be just easier to write my own version of parse-body
<ldb>
it is.
liminality has quit [Ping timeout: 258 seconds]
alphacentauri has joined #commonlisp
<Gleefre>
But I wonder if filing a feature request to alexandria would be reasonable
somename has joined #commonlisp
<ldb>
does not hurt to give it a try
cage has quit [Quit: rcirc on GNU Emacs 29.1]
greaser|q is now known as GreaseMonkey
<edgar-rft>
if I'm not totally wrong then a string is a valid form, so in (defun abc () "a" "b" "c") "a" is the docstring and "b" and "c" are forms - evaluating "b" makes of course not much sense but I don't see any error in it.
<Gleefre>
So just CLISP signals an error, SBCL warns about it, and other implementations just use the first or the last string as doc-string.
<Gleefre>
edgar-rft: Documentation strings are part of the differen function/macro definers, just like declarations and lambda-list
<Gleefre>
So while having a duplicate documentation string is undefined behaviour, it can be seen as a syntax error
<Gleefre>
*part of the different ... definers syntax
shka has quit [Ping timeout: 258 seconds]
<Gleefre>
Interesting fact: if you want to have a function with empty body but with a documentation string you can just put (declare) after your doc string
<akoana>
or use just nil instead of (declare)
<Gleefre>
That wouldn't be an *empty* body anymore though.
<Gleefre>
[ but of course the resulting behaviour would be the same ]
<akoana>
it would more obviously express the programmer's intention, instead of declare nothing, return nil
<Gleefre>
From a practical point of view - yes, that would be better than having an empty body.
<Gleefre>
But I just love noticing funny/weird edge-cases :)
<akoana>
Gleefre: besides, according to CLHS: "A declare expression ... can occur only at the beginning of the bodies of certain forms.." So with declare you already have a non-empty body anyway...
<akoana>
;)
Oladon has joined #commonlisp
lucasta has joined #commonlisp
pve has quit [Ping timeout: 255 seconds]
pve has joined #commonlisp
pve has quit [Ping timeout: 255 seconds]
rgherdt has quit [Quit: Leaving]
contrapunctus has quit [Ping timeout: 255 seconds]
contrapunctus has joined #commonlisp
tyson2 has joined #commonlisp
tibfulv has quit [Remote host closed the connection]
tibfulv has joined #commonlisp
dino_tutter has quit [Ping timeout: 258 seconds]
ldb has quit [Ping timeout: 260 seconds]
yitzi has quit [Remote host closed the connection]
akoana has quit [Quit: leaving]
alphacentauri has quit [Quit: WeeChat 4.0.5]
alphacentauri has joined #commonlisp
<Alfr>
Gleefre, I don't think (defun abcd () "a" "b" "c" "d") is ambiguous; take "a" as doc string, eval and discard "b" and "c", and eval and return "d". Though (defun abcd () "a" "b" (declare ..) "c" "d") would be a problem.
<bike>
yeah, that's the only valid parse. per 1.4.1.2.1 and the syntax descriptions of defun/whatever
lucasta has quit [Quit: Leaving]
Oladon has quit [Quit: Leaving.]
<bike>
3.4.11 is talking specifically about multiple docstrings before a declare like alfr said.
yitzi has joined #commonlisp
donleo has quit [Ping timeout: 255 seconds]
donleo has joined #commonlisp
attila_lendvai has quit [Ping timeout: 264 seconds]
flip214 has quit [Read error: Connection reset by peer]