<hexology>
is it not possible to implement the above using uninterned symbols? (not that you would or should)
<phoe>
how do you pass these while calling the function?
<phoe>
if you do (defun foo (&key ((#:really-private-api r))) (if r :secret :nothing)) then you have no way of passing that keyword without magic like (sb-introspect:function-lambda-list #'foo)
<beach>
For GETF, you can pass a unique optional value and compare.
random-nick has quit [Ping timeout: 260 seconds]
<nij->
GETF is very weird. I guess I will use hash table more often.. thanks!
easye has joined #commonlisp
<beach>
Pleasure.
<phoe>
nij-: beach: the notes for clhs getf say, " There is no way (using getf) to distinguish an absent property from one whose value is default; but see get-properties."
<phoe>
I never thought of using the unique default this way
<phoe>
TIL, thanks
<nij->
unique default feels dangerous to use though
<phoe>
a gensym should be enough, especially if ltv'd for performance
<beach>
nij-: Why is that?
<nij->
beach unique default may show up as a value in the plist.
<beach>
I usually do (LIST NIL) to get a unique value.
<beach>
That can't show up in the plist.
<phoe>
nij-: it's not unique then
<phoe>
by definition
<beach>
But if you already have one at hand that you know can't be in there, you can use it, like the value of *PACKAGE* or that of *STANDARD-OUTPUT*.
<nij->
(getf (list :a (list NIL)) :a (list NIL))
ym has joined #commonlisp
<nij->
(getf (list :b (list NIL)) :a (list NIL))
<nij->
Both return (NIL)..
<beach>
But they are not EQL.
<phoe>
(let* ((unique (gensym)) (value (getf place indicator unique)) (presentp (eql value unique))) (values (if presentp value nil) presentp))
Cymew has quit [Ping timeout: 268 seconds]
<nij->
Oh I see.
<nij->
And then you can write a wrapper for getf.
ym has quit [Ping timeout: 260 seconds]
easye has quit [Ping timeout: 265 seconds]
seletz has quit [Ping timeout: 268 seconds]
zacque has joined #commonlisp
ym has joined #commonlisp
nij- has quit [Remote host closed the connection]
larix has quit [Ping timeout: 268 seconds]
<Shinmera>
I like to do #1='#:NO-VALUE and then #1# to eq test.
<thuna`>
Should the quote be inside or outside #1=?
aartaka has joined #commonlisp
<Josh_2>
For this case I would normally just use a custom keyword, unless my hash/plist values were keywords ofc
<thuna`>
Doesn't seem to matter
<Shinmera>
If it's outside the #1= then you also need to put it outside #1#
<thuna`>
I just wondered if two (quote #:NO-VALUE)s were guaranteed to return the same object
mzan has quit [Quit: No Ping reply in 180 seconds.]
<Shinmera>
the #1# inserts the literally same object.
<thuna`>
But that object, in the case of #1='#:NO-VALUE is the sexp (quote #:NO-VALUE)
<Shinmera>
yea? and quote just returns that object.
<thuna`>
Not necessarily the symbol returned by (quote #:NO-VALUE)
<Shinmera>
why not
mzan has joined #commonlisp
<thuna`>
,(eq '#:NO-VALUE '#:NO-VALUE)
<Shinmera>
#1# inserts literally the same expression, it is not read twice.
<Shinmera>
and quote returns the literal expression
<thuna`>
Ah, quote just returns it's argument and in #1=(quote #:NO-VALUE) #1# that argument is the same. My bad
<thuna`>
s/it's/its
tevo has joined #commonlisp
<Shinmera>
Right.
pranavats has left #commonlisp [Error from remote client]
seletz has quit [Ping timeout: 268 seconds]
jolby has joined #commonlisp
pranavats has joined #commonlisp
seletz has joined #commonlisp
jmdaemon has quit [Ping timeout: 256 seconds]
<pve>
Hi, is it hideous to have simple tests inline with the code? I.e. (defun foo () ...) (define-test foo ... ), where the test emits a warning when the file is loaded if some check fails.
seletz has quit [Ping timeout: 248 seconds]
Mitpatral has joined #commonlisp
seletz has joined #commonlisp
attila_lendvai has joined #commonlisp
tyson2 has joined #commonlisp
ym has quit [Ping timeout: 248 seconds]
_cymew_ has joined #commonlisp
Cymew has joined #commonlisp
easye has joined #commonlisp
causal has quit [Ping timeout: 256 seconds]
seletz has quit [Ping timeout: 256 seconds]
jolby has quit [Quit: Client closed]
causal has joined #commonlisp
seletz has joined #commonlisp
Guest296 has joined #commonlisp
<semz>
I don't think so, unless the tests take a long time to run.
lisp123 has joined #commonlisp
frgo has joined #commonlisp
ec_ has quit [Ping timeout: 255 seconds]
anticomputer has quit [Quit: quit]
anticomputer has joined #commonlisp
Cymew has quit [Ping timeout: 265 seconds]
ec_ has joined #commonlisp
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
<sbenitezb>
I'm interested more on ideas about style, using keywords vs symbols, implicit lists, etc.
Cymew has joined #commonlisp
<phoe>
whichever style you choose, lispers will complain it's not suited to their taste
aartaka has quit [Ping timeout: 260 seconds]
Inline has joined #commonlisp
aartaka has joined #commonlisp
<sbenitezb>
Thanks, I guess I'll keep it this way.
<pjb>
sbenitezb: you could avoid keywords, by defining local functions and macros with macrolet and flet or labels.
<pjb>
This way, you could write stuff like (loop for tag in (generate-my-tags) do (tag tag)) instead of (:tags static-tag-1 … static-tag-n) for example.
<pjb>
sbenitezb: find another name than process. Process doesn't mean anything. All functions perform some process.
<Josh_2>
keywords :heart:
<sbenitezb>
pjb: interesting. I was looking at how Clozure implemented the LOOP macro. I like keywords because though
morganw has joined #commonlisp
<pjb>
sbenitezb: yes, but you need to parse them specially (like special forms). It's easier if you can avoid that, and let lisp do the parsing and evaluating itself.
<pjb>
So if you can define your DSL as a set of macros and functions, it's better.
<sbenitezb>
pjb: It's called a process because it configures a process (as in flow based programming process). I could name it anything, but I went with the typical name for FBP
<pjb>
= easier to use.
<pjb>
sbenitezb: then configure-process sounds a good name.
<sbenitezb>
pjb: it actually defines a process, more than configures it (it includes lisp code that runs when the process is executed). I guess defprocess is another option
<sbenitezb>
I also looked at defsystem and that's why I picked keywords
<pjb>
one would expect a defprocess to be a macro, and to define a process at compilation time, in the toplevel.
ym has joined #commonlisp
<pjb>
Use rather a make-process function to be able to generate different processes at run-time.
<pjb>
see make-package, vs. defpackage.
aartaka has quit [Ping timeout: 248 seconds]
<sbenitezb>
Thank you. I'll consider all options. Certainly everyone will have a different opinion, I do, so it's as difficult as naming any other thing :(
aartaka has joined #commonlisp
_cymew_ has quit [Quit: Konversation terminated!]
_cymew_ has joined #commonlisp
<pjb>
sbenitezb: in general, if you can design first a set of functions to build an object (ie. a process configuration in your case), you can define macros later to make it simplier to write syntaxwise. But then you have functions that you can use at run-time when you need to generate computed stuff.
<pjb>
The macros can expand to function calls.
<sbenitezb>
Well this will certainly be compiled into the system, so more like a defprocess, wouldn't it?
<sbenitezb>
Plus, I want to parse all those parameters and build structures, and other functions from it, so I guess a macro is better
zacque has quit [Remote host closed the connection]
attila_lendvai has quit [Quit: Leaving]
attila_lendvai has joined #commonlisp
Mitpatral has joined #commonlisp
notzmv has quit [Ping timeout: 260 seconds]
fitzsim has joined #commonlisp
Cymew has quit [Ping timeout: 248 seconds]
MajorBiscuit has quit [Ping timeout: 268 seconds]
azimut has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
Guest296 has quit [Quit: Client closed]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
morganw has quit [Remote host closed the connection]
aartaka has joined #commonlisp
seletz has quit [Ping timeout: 256 seconds]
<dbotton>
Is there a practical time I would use eval-when unrelated to macros?
<jackdaniel>
if you want to define constants in the same file, then a conforming common lisp program will have them in eval-when
<jackdaniel>
sbcl treats defconstant specially, but that's not required by the standard (and in fact it fails on ccl)
<dbotton>
(sorry I just want to make sure I understand) defconstant does not work in the same file (outside sbcl) if used in a defun for example? or just in code executing during compile time?
<Bike>
defconstant isn't defined to make the constant available at compile time
<jackdaniel>
the latter
<Bike>
so if you want the constant to be available you need to use eval-when. but you might only want that for the sake of using it in macros
<jackdaniel>
say you have (defconstant +foo+ 42) (defvar *foo* +foo+) ; +foo+ is not known for some implementations
<dbotton>
wow
<Bike>
that shouldn't be a warning, should it? even if the value isn't available the compiler should still known it'll be bound at runtime
<dbotton>
defconstant is like evil everywhere
<jackdaniel>
you are right, and I have confused things, sorry
<jackdaniel>
yes, defvar should work just fine
<Bike>
eval-when is also used in in-package and in in-readtable (in the named-readtables) library, and i guess that's not macro related
<Bike>
(in the named-readtables library)
cage has joined #commonlisp
<dbotton>
so what is a good example then where defconstant would fail at compile time?
<Bike>
the macroexpander wants +foo+ to actually be bound
<dbotton>
I meant outside macros which seems to be the only real practical need for eval-when
<dbotton>
for most of us
<jackdaniel>
and there is also the thing that it is conforming for the implementation to expect, that each subsequent time defconstant is evaluated, values assigned are #'eql
<Bike>
macros are most of the reason for eval-when, practically speaking
<Bike>
stuff that alters compiler state like in-readtable or declaim is another use
<dbotton>
code applied to EVAL is considered compile-toplevel?
<Bike>
what?
<dbotton>
if I use eval to load/execute code, when eval is loading that code does it first compile at so satisfy :compile-toplevel?
<dbotton>
(hope that is more clear)
<Bike>
If you are calling eval, compile-toplevel is not involved
<dbotton>
so that is only the case with compile-file?
<Bike>
what eval-when (with compile-toplevel) does is tell the compiler to eval stuff. it wouldn't eval it otherwise.
<Bike>
when you do (eval-when (:compile-toplevel) foo), the compiler will basically do (eval foo)
<dbotton>
sorry, I am trying to understand - when is the case
<dbotton>
when I use load from the REPL
<dbotton>
when I use compile-file from the REPL
<dbotton>
for example
<Bike>
when you load a source file, only the eval-when with :execute will be evaluated
<dbotton>
I know eval-when is more of a directive
<beach>
In what way is EVAL-WHEN a "directive"?
<Bike>
when you compile-file a file, the eval-when with compile-toplevel will be evaluated at compile time by the compiler
<NotThatRPG>
EVAL-WHEN can be helpful around DEFPARAMETER
<NotThatRPG>
I find I often want constants that can't be made with defconst
<dbotton>
beach by evaluating only under certain circumstances, a directive to what ever is compiling/loading the file
<NotThatRPG>
TBH, I think I have only once in my life used this w/o all three of the possible specifiers
<Bike>
.
<Bike>
oops
<dbotton>
NotThatRPG the question was for non macro use if I am using a defparameter chances are it is because I want to use it in a macro
<NotThatRPG>
dbotton: I have some other cases that arise in symbolic computation (theorem-provery things)
<NotThatRPG>
With data structures that get compiled...
<NotThatRPG>
Side question: Is there any documentation out there to tell me how to read an SBCL code-deletion-note? There's an IN prefix which I kinda get, but then there's a right arrow (==>) with a partial construct after it and I don't know how to parse that...
<Bike>
i think the ==> is just the fully macroexpanded context?
<NotThatRPG>
Thanks, Bike ! It might be helpful for the manual to link to this from the description of the compiler warning classes. I will try to make a MR...
<NotThatRPG>
Bike: it looks like it's the endpoint of the processing path? I'm going to make a paste, because this leaves me quite confused still
anticomputer has quit [Ping timeout: 255 seconds]
tyson2 has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
ttree has joined #commonlisp
<dbotton>
NotThatRPG do you have a link to that code say in git I could see?
<dbotton>
(github)
<Shinmera>
pve: I don't like a library pulling it a testing framework just to use it.
attila_lendvai has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
<Bike>
i see
<Bike>
sbcl definitely did not communicate that very well
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
varjag has joined #commonlisp
<NotThatRPG>
Bike: I guess it would be nice if SBCL could tell me that it's compiling away an unreachable branch. But I don't know how hard that would be to do
<Bike>
i think it would require some reorganizaation of how the compiler works. i have thought about how to do it in cleavir but haven't coded anything yet.
sedzcat has joined #commonlisp
Mitpatral has quit [Quit: Connection closed for inactivity]
ebrasca has quit [Remote host closed the connection]
son0p has quit [Ping timeout: 246 seconds]
terrorjack has quit [Ping timeout: 256 seconds]
terrorjack has joined #commonlisp
aartaka has quit [Ping timeout: 268 seconds]
prokhor has joined #commonlisp
_cymew_ has quit [Ping timeout: 260 seconds]
<pve>
Shinmera: Yeah, fair point.
makomo has joined #commonlisp
son0p has joined #commonlisp
sedzcat has quit [Quit: sedzcat]
thuna` has quit [Remote host closed the connection]