<ck_>
there are also some examples in the cells-test directory
makomo has joined #lisp
makomo has quit [Client Quit]
manualcrank has quit [Quit: WeeChat 1.9.1]
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #lisp
eschulte has quit [Ping timeout: 244 seconds]
tramplefoot has joined #lisp
mcMeowCat has joined #lisp
mcMeowCat has quit [Ping timeout: 245 seconds]
ravenous_ has joined #lisp
makomo has joined #lisp
<jackdaniel>
I think that there was a cl-cells-gtk library or something named in a similar spirit
shrdlu68 has quit [Ping timeout: 244 seconds]
<ck_>
yes, that one is mentioned in kenny tiltons blog. You can read all you want to know about cells and more there, many postings written in this style of presentation I believe it is called stream of consciousness as in a stream of thought that never ends it is really quite hypnotic
makomo has quit [Ping timeout: 248 seconds]
Necktwi has quit [Ping timeout: 258 seconds]
JohnMS has joined #lisp
orivej has joined #lisp
permagreen has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 245 seconds]
Wojciech_K has joined #lisp
manualcrank has joined #lisp
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #lisp
Necktwi has joined #lisp
igemnace has quit [Quit: WeeChat 2.5]
sonologico has joined #lisp
milanj has joined #lisp
bendersteed has joined #lisp
makomo has joined #lisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #lisp
jello_pudding has joined #lisp
random-nick has joined #lisp
mbrumlow has joined #lisp
afidegnum has joined #lisp
<afidegnum>
hello, anyone used cl-lib with emacs to write elisp script ?
<beach>
afidegnum: This channel is dedicated to Common Lisp. You may get better answers in #emacs.
<no-defun-allowed>
Very frequently, since it gives you loop and typecase among other niceties. Though, it isn't a CL implementation so I wouldn't expect any interesting responses.
<afidegnum>
emacs proponents are not forth coming
<afidegnum>
i m trying to interact with the db using cl in elisp, postgres namely
random-nick has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
varjag has joined #lisp
cosimone has joined #lisp
tramplefoot has quit [Quit: Leaving.]
kajo has quit [Ping timeout: 276 seconds]
asdf_asdf_asdf has joined #lisp
eschulte has joined #lisp
orivej has quit [Ping timeout: 268 seconds]
eschulte has quit [Ping timeout: 272 seconds]
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
SaganMan has joined #lisp
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Josh_2` has joined #lisp
Josh_2` has quit [Client Quit]
bmansurov has joined #lisp
<bmansurov>
o/ I have a recursive generic function that accepts an object or nil. What would the function signature be? I'm thinking of something like `(defgeneric my-function ((x (or nil obj))))`, but I'm not sure if it's possible.
<bmansurov>
LdBeth: my bad, I'd write it with defmethod.
shrdlu68 has joined #lisp
<Josh_2>
You would have one for (x nil) and one for (x obj) right?
<bmansurov>
asdf_asdf_asdf: I don't think that'll work. Let me check.
<bmansurov>
Josh_2: I'd rather not duplicate function body and have only one method for both.
JohnMS has quit [Quit: Konversation terminated!]
<bmansurov>
asdf_asdf_asdf: that didn't work.
<bmansurov>
Josh_2: come to think about it, when nil is passed, the function body will be different and very trivial. That may work.
<asdf_asdf_asdf>
@bmansurov; OK. Give original your signature function, which trying to do.
<bmansurov>
asdf_asdf_asdf: I have (defgeneric my-function (x)) and (defmethod my-function ((x obj))
<bmansurov>
I guess I'll create another method with (x nil)
<asdf_asdf_asdf>
What signature do you want?
<bmansurov>
asdf_asdf_asdf: I was thinking (defmethod my-function ((x (or obj nil)))
<beach>
bmansurov: You can only use classes as specializers.
JohnMS has joined #lisp
<beach>
... and EQL specializers of course.
<LdBeth>
So define a common superclass should work
<Josh_2>
For some reason, when I set my lisp image to launch using systemd (ubuntu) it never launches. I have set the image to drop into reply when launched, is that correct?
<bmansurov>
LdBeth: beach: OK, thanks.
<beach>
bmansurov: So to make the method applicable to the NIL symbol, you either need to use the class NULL which is the class of NIL, or the specializer (EQL NIL).
<bmansurov>
beach: and class NULL only contains NIL?
v0|d` has quit [Remote host closed the connection]
lucasb has joined #lisp
v0|d has joined #lisp
Inline__ has joined #lisp
tramplefoot has joined #lisp
Inline has quit [Ping timeout: 264 seconds]
JohnMS has quit [Quit: Konversation terminated!]
tramplefoot has left #lisp [#lisp]
Inline__ has quit [Quit: Leaving]
tramplefoot has joined #lisp
Inline has joined #lisp
aautcsh has joined #lisp
cantstanya has quit [Ping timeout: 260 seconds]
tramplefoot has quit [Quit: Leaving.]
tramplefoot has joined #lisp
random-nick has quit [Ping timeout: 244 seconds]
cantstanya has joined #lisp
p9fn has quit [Quit: .]
<pjb>
bmansurov: (typep 'nil 'null) #| --> t |#
<bmansurov>
ok
josemanuel has joined #lisp
random-nick has joined #lisp
cosimone has quit [Quit: Leaving]
thawes has quit [Quit: Konversation terminated!]
orivej has joined #lisp
tramplefoot1 has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
tramplefoot has quit [Ping timeout: 245 seconds]
afidegnum has quit [Ping timeout: 272 seconds]
sabrac has joined #lisp
tramplefoot1 has quit [Quit: Leaving.]
bmansurov has left #lisp ["Later"]
asdf_asdf_asdf has quit [Remote host closed the connection]
cosimone has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
notzmv has quit [Ping timeout: 258 seconds]
ravenou__ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #lisp
xkapastel has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.2)]
<frgo>
Hi - ASDF barks on me with "Warning: System definition file #P"/var/data/swdev/cl-dds/cl-dds.bindings.rti-connext-dds.asd" contains definition for system "CL-DDS.BINDINGS.RTI-CONNEXT-DDS". Please only define "cl-dds.bindings.rti-connext-dds" and secondary systems with a name starting with "cl-dds.bindings.rti-connext-dds/" (e.g. "cl-dds.bindings.rti-connext-dds/test") in that file." What am I doing wrong? TIA!
<Bike>
i think it's just that your system is named in uppercas.e
<frgo>
ck_: Right. Silly me. I wanted to overly clever - and failed. ;-) Solved.
gareppa has joined #lisp
<frgo>
ASDF actually told me what I should look for. I just didn't actually read it.
gareppa has quit [Remote host closed the connection]
<frgo>
Oh - and thanks.
Aruseus has quit [Quit: leaving]
<ck_>
Sure.
igemnace has joined #lisp
red-dot has joined #lisp
bendersteed has quit [Quit: bye]
nowhere_man has joined #lisp
elderK has quit [Quit: WeeChat 1.9]
Josh_2 has joined #lisp
ravenous_ has joined #lisp
jello_pudding has quit [Remote host closed the connection]
aautcsh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeBirdLjj has quit [Remote host closed the connection]
aautcsh has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
makomo_ has joined #lisp
aoeu256 has joined #lisp
makomo has quit [Ping timeout: 245 seconds]
<aoeu256>
I don't code Lisp, but I've heard you can embed any language into Lisp by using the s-expression version of the language then turning that into code. However, its easier to manipulate the AST if its embedded in Lisp. Is there an embedded version of C, JavaScript, Haskell, Rust? Is it actually viable, as in has anyone done this?
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #lisp
<aoeu256>
Why is this so awesome yet I've never heard of it before : ( like Term rewriting.
<aoeu256>
For certain kinds of programs you can create a custom cross-compiler to change your embedded Python code to be Rust code, hmm,... there must be some kind of a gotcha here.
<_death>
initial versions of JS/Haskell were also in Lisp so there's some code available
<Bike>
_death: you know, i've heard that, but i just looked around and couldn't find any haskell in lisp
<edgar-rft>
aoeu256: Common Lisp has a rather big "standard library" built-in, so there's less need for libraries than in other languages
<aoeu256>
well I usually programmed in Python, much easier than Lisp IMO [still getting used to Emacs]
<aoeu256>
the problem with Python is that you can't get better at Python afterawhile
<aoeu256>
I read Paul Graham's essays, but I still don't understand how to "IN PRACTICE" be more productive in Lisp, like I know in theory you can be more productive but what do you do *IN PRACTICE*
Ricchi has quit [Remote host closed the connection]
<aoeu256>
there is no documentation on the weird Lisps libraries is there?
<_death>
even without documentation, you can just play with libraries in the repl.. go-to-definition is your friend too.. this is how you do things in practice.. don't be afraid to open up a new file and start typing and evaluating and playing with it in the repl
<aoeu256>
reminds me is there a "term-rewriting" eval like trace but better.
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
<aoeu256>
It would show you (+ 1 (+ 3 5)) -> (+ 1 8) -> 9.
<aoeu256>
go-to-definition is in slime or sly?
<_death>
slime has slime-edit-definition.. standard keybinding is M-. (and M-, to pop the stack)
<aoeu256>
also i've heard someone used clojure at their java job (that was a while ago though), they said it was XML, but he also generated Java code from his Clojure code and thus he could have a Java job even although he was doing Clojure.
<aoeu256>
how do you go back after doing that?
<_death>
M-x java-mode :(
<_death>
the smiley should be part of the mode name
<aoeu256>
i mean go back after doing M-.
cosimone has quit [Quit: Leaving]
igemnace has quit [Read error: Connection reset by peer]
cl-arthur has quit [Remote host closed the connection]
<aoeu256>
nvm it was M-,
igemnace has joined #lisp
cl-arthur has joined #lisp
hiroaki has joined #lisp
<jonatack>
aoeu256: drive-by comment, in my experience no lack of libraries in CL. almost too much choice. here's a curated list: https://github.com/CodyReichert/awesome-cl
<jonatack>
aoeu256: (don't be afraid of librairies with no updates since five or ten years, CL doesn't bitrot like most PLs)
<jonatack>
cheers
anewuser has joined #lisp
notzmv has joined #lisp
bendersteed has joined #lisp
gareppa has joined #lisp
<_death>
the monkeys remark, it's just an approach.. in my experience it's often better to have a solution you understand well and that solves your particular problem than depend on a library that's so complex because it needs to be so general/performant/portable/whatever.. just a rule of thumb.. use of libraries can save work, but many times and in many ecosystems it's taken way too far.. it usually manifests itself in Very Popular Languages,
<_death>
where many people just glue things together.. I glue things too (sigh), but for production systems I'd be wary of incorporating this and that dependency on a whim
eschulte has joined #lisp
gareppa has quit [Quit: Leaving]
eschulte has quit [Ping timeout: 246 seconds]
<asdf_asdf_asdf>
Hi. Which alien type is (void (*ptr)())?
<asdf_asdf_asdf>
void B(void (*ptr)()) { // ...
<asdf_asdf_asdf>
SBCL, Common Lisp.
miklos1 has joined #lisp
bendersteed has quit [Read error: Connection reset by peer]
bendersteed has joined #lisp
dddddd has joined #lisp
Aruseus has quit [Remote host closed the connection]
<Josh_2>
Whats the best way to remove nil values from nested lists?
<Josh_2>
The nils can appear at any place
<asdf_asdf_asdf>
Maybe recursive function?
bjorkintosh has quit [Remote host closed the connection]
ebzzry_ has quit [Read error: Connection reset by peer]
<Josh_2>
I am trying that, I think I am missing something like normal xD
<pjb>
Josh_2: I guess you could always do (defun read-configuration-file (path) (second (com.informatimago.common-lisp.cesarum.file:sexp-file-contents path)))
<Josh_2>
well I don't need the quote
<pjb>
Then: (defun read-configuration-file (path) (com.informatimago.common-lisp.cesarum.file:sexp-file-contents path)) would do.
Kundry_Wag has quit [Read error: Connection reset by peer]
Aruseus has quit [Remote host closed the connection]
<Josh_2>
I did indeed
<Josh_2>
I then updated all dists
<pjb>
Sounds good.
Kundry_Wag has joined #lisp
<pjb>
And then what do you get for (ql:quickload :com.informatimago.common-lisp.cesarum) ?
<Josh_2>
System "com.informatimago.common-lisp.cesarum" not found [Condition of type QUICKLISP-CLIENT:SYSTEM-NOT-FOUND]
<pjb>
Strange. I would have to test on a different system. In the mean time, you can do: cd ~/quicklisp/local-projects/ ; mkdir com ; git clone git@github.com:informatimago/lisp.git informatimago
<pjb>
asdf_asdf_asdf: well, I don't use sbcl, but ccl currently; and it would probably depend on the version and platform. So I don't run on Windows, and my sbcl is probably older than yours…
<pjb>
asdf_asdf_asdf: but you can safely assume that this is the list of all the symbols that are interned in the sb-alien package, indeed.
<pjb>
asdf_asdf_asdf: if you want a list of almost all the symbols, you could use list-all-packages and do-symbols to gather a big list. You would only miss the symbols that don't have a home package. Some of them could be collected by walking all the values you can get your hands on, but there would remain uninterned symbols that are only reachable thru lisp objects for which there's no conforming accessor. (It's possible you could d
<pjb>
better with implementation specific operators, such as heap walking operators, if available).
<pjb>
asdf_asdf_asdf: and finally, even if you could get an exhautive list of symbols, you wouldn't have the symbols that are going to be interned the next time you read or run something!
<pjb>
interned or created.
<asdf_asdf_asdf>
@pjb; So, my list is not complete?
<pjb>
What do you want to get?
<pjb>
asdf_asdf_asdf: also, symbols internal to a package are private to this package. You should not mess with them.
<pjb>
asdf_asdf_asdf: why are you doing that? (you may have a good reason, but if your reason was good, most probably you'd know what you're doing and how to do it).
nowhere_man has joined #lisp
<asdf_asdf_asdf>
@pjb; very thanks for help; It works. (setf *print-length* nil) Show me all list symbols.
<asdf_asdf_asdf>
@pjb; my xy problem is "How write "void B(void (*ptr)()) {"?".
<asdf_asdf_asdf>
I want use alien type, but I can't find it.
<pjb>
asdf_asdf_asdf: read the documentation. I would suggest not to use sb-alien, but to use cffi instead, which is a portability library that let your code work on other implementations too. In any case, read the doc (either that of sb-alien or that of cffi).
<pjb>
asdf_asdf_asdf: in your case, ptr is a callback. You can use this term when searching the doc.
<drmeister_>
I seem to recall someone talking about it at one of the European Lisp Symposia in the last several years. But I may be wrong about that.
<gjvc>
trocado: it was just some backchat in a politics channel
<gjvc>
trocado: watching the feynman lectures on physics
xkapastel has quit [Quit: Connection closed for inactivity]
<p_l>
drmeister_: it might have been mentioned in talks about quickref?
milanj has joined #lisp
cosimone has joined #lisp
cl-arthur has quit [Ping timeout: 272 seconds]
cl-arthur has joined #lisp
waron has quit [Quit: WeeChat 2.4]
eschulte has joined #lisp
eschulte has quit [Ping timeout: 272 seconds]
scymtym has quit [Remote host closed the connection]
scymtym has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag_ has joined #lisp
Kundry_Wag has quit [Ping timeout: 268 seconds]
shka_ has quit [Ping timeout: 246 seconds]
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
<drmeister_>
p_l: Perhaps. I vaguely recall someone talking about a tutorial system they wrote with a Common Lisp system. docutils mentions an online tutorial system - but I haven't found a link to it.
p9fn has joined #lisp
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
ggole has quit [Quit: Leaving]
nanozz has quit [Ping timeout: 272 seconds]
bendersteed has quit [Ping timeout: 245 seconds]
<Josh_2>
how do I generate function names? (make-symbol "abc") produces #:|abc| which is noooo god
<Josh_2>
good*
<Josh_2>
I've done this before a few times annnd completely forgotten...
alexanderbarbosa has joined #lisp
<cl-arthur>
Josh_2: (intern "abc")
<cl-arthur>
=> |abc|
<Josh_2>
cl-arthur: that works :) is there a way I can strip the | |?
Kundry_Wag_ has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
<cl-arthur>
I don't know how, if so.
<Josh_2>
to be fair It's quite useful because the generated functions then won't cause naming issues
<edgar-rft>
(intern "ABC") => ABC without vertical bars, but it depends on variables like *pint-case* and such
<cl-arthur>
d'oh.
<Josh_2>
oh
<pjb>
Josh_2: |abc| is a perfectly good function name. There's no | | to be stripped!
Kundry_Wag has quit [Ping timeout: 272 seconds]
<pjb>
Josh_2: (symbol-name '|abc|) #| --> "abc" |# see, no #\|
<edgar-rft>
and the variable is called *print-case*, my R key is broken :-)
<Josh_2>
pjb: I think I will go with the | | version because of name conflicts
lucasb has quit [Quit: Connection closed for inactivity]
<Josh_2>
edgar-rft: don't worry, I wasn't going to :P
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<pjb>
If you use: (|SETF| |*PRINT-CASE*| :|UPCASE| (|READTABLE-CASE| |*READTABLE*|) :|PRESERVE|) then it becomes case sensitive and prints witout escapes! '(|ABC| |Abc| |abc|) -> (ABC Abc abc)
<pjb>
'(ABC Abc abc) -> (ABC Abc abc)
<White_Flame>
if you do (intern (format nil "~a-~a" 'sym1 'sym2)), then you'll get the individual parts in their proper symbol case, instead of starting from strings
<White_Flame>
because sym1 will read as the symbol-name "SYM1"
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
<White_Flame>
and if your read-case is somehow different, that type of construction will follow the different case as well
<pjb>
White_Flame: users set the *print-case* to :downcase, because otherwise, they're constantly bullyied by lispers who don't like uppercase.
<White_Flame>
I said the symbols will follow the read-case, which it does
<pjb>
White_Flame: obviously this is wrong, as I demonstrated.
<White_Flame>
how is it wrong?
<pjb>
The read case is :upcase, but it interns "sym1-sym2".
<pjb>
Basically it is wrong to use format to build symbol names.
<pjb>
Classic bug in alexandria, check its history.
Kundry_Wag has quit [Ping timeout: 272 seconds]
<White_Flame>
using symbols to construct symbols makes the csing easier
<White_Flame>
*casing
<pjb>
Yes, but the bug is in format.
<pjb>
format ~A respects *print-case*
<pjb>
you can do: (intern (concatenate 'string (string 'sym1) "-" (string 'sym2))) #| --> sym1-sym2 ; nil |#
<pjb>
so no case transformation is involved.
<White_Flame>
right
milanj has quit [Quit: This computer has gone to sleep]
<White_Flame>
but of course, when somebody is learning, all thse edge cases that nobody in practice ever helps only serve to obfuscate practical use
<White_Flame>
*ever uses
<pjb>
White_Flame: check the bug reports in alexandria.
lerax has joined #lisp
lerax has left #lisp [#lisp]
<White_Flame>
and those need to follow edgar-rft's advice ;)
libertyprime has quit [Ping timeout: 245 seconds]
Kundry_Wag_ has quit [Remote host closed the connection]
<Josh_2>
I think thonking about code and macros are not mixing in my brain oof
<Josh_2>
alcohol oof
<cl-arthur>
Learning about alcohol after having drunk macros? Now that's a challenge.
<pjb>
Josh_2: what does "thonking" mean?
<pjb>
Sounds gross…
<pjb>
code and macros are not mixing because they're already exactly the same thing.
<Josh_2>
If I pass a value like "abc" to my macro it works but if I pass (format nil "~A" "abc") the value of that function is not evaluated, but I have `(defun ,name () ,value) where ,name would be (format..)
<Josh_2>
I think I'm just being extremely stupid and should just go to bed to be honest
<White_Flame>
the parameters to macros are the literal source code
<White_Flame>
if you call (my-macro "abc"), its parameter is a string. if you call (my-macro (format nil ..)), its parameter is a list
<White_Flame>
containing CL:FORMAT as its first element, etc
random-nick has quit [Ping timeout: 272 seconds]
makomo_ has quit [Ping timeout: 245 seconds]
<White_Flame>
in your defun example, you need that format evaluated to insert its value into defun, which is a tricky case
libertyprime has joined #lisp
<Josh_2>
Defun is a macro right?
<Josh_2>
I guess that's the problem
<White_Flame>
`(defun ,(intern name ...) () ,value)
<White_Flame>
if you simply pass it a string, instead of that FORMAT construction
<White_Flame>
otherwise, you're asking the macro to do compile-time evaluation of source code, instead of just returning the new/transformed source code
<White_Flame>
technically, it is a place to use EVAL, but as always it's better to find an alternative route
<pjb>
Josh_2: the arguments to a macro are not evaluated. The purpose of the macro, is to use lisp SOURCE CODE, to compute some lisp SOURCE CODE.
<pjb>
Josh_2: now, you could use some SOURCE CODE as expression to initialize a variable that will be created AT RUN-TIME. (eg. in a LET). But then, you cannot return a DEFUN form that will be compiled at compilation-time, because the value of the name will be known only at run-time!
<Josh_2>
yes
<pjb>
Josh_2: even if the expression could be evaluated at compilation-time.
<Josh_2>
that's the problem
<pjb>
Josh_2: the clean way to do it, is to use a macro to generate the macro call.
<Josh_2>
So change my defun to a defmacro? (and everything involved in that)
<cl-arthur>
I'm doing something like (defmacro some-macro (name list ...)
<cl-arthur>
(let ((fn-name (generate-symb-name name list)))
<pjb>
White_Flame: yes, you've identified the "original problem"; and I have given the SOLUTION!
<pjb>
The solution is to perform the format inside a macro!
<pjb>
So the format can be done at compilation-time (macroexpansion-time), and the result placed in a macro call that will be expanded in a second phase by the compiler DUH!
<White_Flame>
and for each different type of format, you need to create a new defmacro in that case
<White_Flame>
which makes it suboptimal, as opposed to having a single tool you can pass multiple FORMAT forms into
<pjb>
Exactly.
<pjb>
It's not suboptimal, since in general, you do that on specific classes of macros.
<pjb>
But you can always design a macro to do it in general.
<Josh_2>
well I'm not using format.. oof
<pjb>
Josh_2: your code doesn't have any problem, apart the missing eval-when around combine-group-and-name.
<pjb>
(if you want to compile ti)
<pjb>
s/ti/it/
<Josh_2>
...
<White_Flame>
so it's (first/second/rest entry) that's going literally into your macros, right?
<Josh_2>
Yes
<Josh_2>
along with group, which sbcl says is not being used
<pjb>
Josh_2: on the other hand, if you count on *configuration-function-name* to be available at run-time, you'd better go back home and reconsider your life choices.
<White_Flame>
well, this is a differnt case than the self-contained format
<White_Flame>
because, again, the value of "entry" does not exist when the macro is expanded
libertyprime has quit [Ping timeout: 272 seconds]
<Josh_2>
pjb: xD well that was just a spitballin idea ya know
eschulte has joined #lisp
<Josh_2>
THis is what I get for trying to dynamically make functions oof
<pjb>
Josh_2: any mutation you do in a macro is only available in the compilation environment. If you eg. quit and reload the FASL, you won't have those mutations anymore.
<pjb>
Josh_2: so if you want them at run-time, you better redo those mutations in the expansion!
<White_Flame>
this is, IMO, a legitimate case for EVAL
<White_Flame>
at runtime, you read in config files and generate source code (in this case, DEFUNs) that need to be executed
<White_Flame>
however, this all depends on what uses those defuns, and how early they need to manifest
<Josh_2>
wait
<White_Flame>
it might be that you want to find/load/expand the config file _at macroexpand time_ so that the rest of the compiler can see those defuns
<White_Flame>
but that can be difficult to manage the build process
<pjb>
Possibly. (eval). But ask yourself the question: is the user a lisper who will want to use those run-time generated functions? If not, you're misled…
<Josh_2>
hnnng
<Josh_2>
The functions that are generated are supposed to be references to values in the config file
<Josh_2>
which can be used throughout a system
<White_Flame>
if none of your compile-time source code ever references those DEFUNs, then you're fine to use eval
<Josh_2>
well that's what I thought ever
<Josh_2>
hmm
<Josh_2>
I think the answer to that is no
<Josh_2>
The functions made by evalling the defuns will be needed to compile other functions
<White_Flame>
ok, but do remember that your config is NOT a runtime thing; it's a compile-time thing
<Josh_2>
Yes
<White_Flame>
one thing you can do is (defmacro init-stuff (config-file-name) (do-init-stuff config-file-name)), so that you're working with functions at compile-time
eschulte has quit [Ping timeout: 246 seconds]
<White_Flame>
it is important that those utility functions which perform the loading of the config file be available before that macro is invoked
<Josh_2>
Yes
<White_Flame>
you can use eval-when, or put them in a file that's loaded before the macro use
<Josh_2>
The config is in a seperate file, and will be loaded with the library i'm trying to make now, which would make the functions which the rest of the system could invoke when compiled
<White_Flame>
the major implication of this is that the config file name must be a source code literal
<Josh_2>
well now i'm confused
<Josh_2>
the config file is a file containing a list
<pjb>
Josh_2: the problem is that the configuration if is RUN-TIME data.
<White_Flame>
why is it not just a DEFVAR in your source code base containing the list?
<pjb>
Josh_2: So unless you have a time-machine, don't use run-time data to generate code.
<pjb>
(or unless your users are developers = time travellers).
<Josh_2>
It's not runtime data, the data is in a seperate file
<cl-arthur>
You could read the config file at compile-time.
<Josh_2>
it is not generated by the computer but by a person, BEFORE they load up the system with asdf/quicklisp
<pjb>
Josh_2: yes, it's run-time data. Unless you're using the database at compilation-time to generate code.
<Josh_2>
hnng
<White_Flame>
pjb: it's totally doable to have runtime data generating code. We do it all the time in our application servers. The lifecycle of the served application is a subset of the lifetime of the server
<White_Flame>
Josh_2: In some of those sorts of use cases, the data is stored into a special variable, instead of stored in a file
<White_Flame>
then it's available to the macros easily
<White_Flame>
especially if it's a user action to initialize that data, then launch the library
<pjb>
White_Flame: yes, it's doable. But you will generate things that are more like plugins than general API functions like this config-to-function function.
libertyprime has joined #lisp
<Josh_2>
White_Flame: I initially had just a bunch of defparamaters in a file which was just listed at the stard of the :depends-on entry in defsystem
<White_Flame>
Josh_2: a lot of our system definition stuff works like that. .sbclrc has little utility functions to set a special variable to some config data, then load in a project
<White_Flame>
sure
<Josh_2>
I can use the config file to create variables
<White_Flame>
but then the .asd specifically refers to the location of that file, and the user is mucking with 3rd party code, instead of their own config
<pjb>
Josh_2: Bad idea.
<Josh_2>
instead of functions, I just liked the idea of functions, didn't realize it would be such a hassle tbh
<pjb>
Josh_2: you will let the user create your variables, then he will create different variables than those used by your program, then your program will get a bunch of undefined variables and nothing will hook together.
Kundry_Wag has joined #lisp
<White_Flame>
in our stuff, our loaders look specifically for CL-USER::*some-config-var*, which is easily set up at the repl (or again by .sbclrc convenience functions) as a prerequisite
<Josh_2>
But if they just mess with the config file containing defpara/defvar they can do the same thing
eschulte has joined #lisp
<pjb>
White_Flame: no problem with that. You put (defvar cl-user::*some-config-var* nil) in your sources. But since the user will have to set it BEFORE loading your sources, he will have to do (defparameter cl-user::*some-config-var* 'some-value) (ql:quickload :your-system)
<White_Flame>
which is what's in either the .sbclrc convenience scripts, or the automated build scripts
* pjb
watching again Aliens (2) now.
libertyprime has quit [Ping timeout: 258 seconds]
libertyprime has joined #lisp
eschulte has quit [Ping timeout: 245 seconds]
cosimone has quit [Quit: Leaving]
<White_Flame>
Josh_2: I think a fundamental lesson is that if the source code base relies on those specific functions being there, then the definition of those functions are part of your source code
<White_Flame>
meaning the list that defines them all should just be a normally loaded file of source code, too, that the macros can then iterate
<Josh_2>
Well the config file would basically be part of the source code yes
<White_Flame>
the defparameter/defvar would provide the value of the list to the macro
<Josh_2>
if the config is misconfigured, It's fine if the whole thing doesn't work.. that's sort of the point
<Josh_2>
It's just to configure webserver locations, user controlled variables etc
<Josh_2>
that are compiled into the program
<White_Flame>
right, but I'm saying that it doesn't make sense to load a data file. The list should be a standard variable/constant value
<White_Flame>
because it's part of teh source code anyway
<Josh_2>
Why doesn't it? Many programs have config files
<White_Flame>
runtime config files, or compile-time config files?
<White_Flame>
this is a compile-time config, meaning the value needs to be available when the compilation happens
<Josh_2>
hmmmmmmmmmmmmmmmmmmm
<Josh_2>
I didn't think about it that way
<White_Flame>
a runtiem config file isn't part of the source code, and is fine living in userspace directories, instead of in buildspace
<Josh_2>
I think in this case it could be both
<Josh_2>
That's what I was going for anyway
<White_Flame>
if you change that file at runtime, likely nothign will happen, as the compilation has already occurred
<Josh_2>
The value of the variable would be changed in the image then the image would alter the config file for next time
<Josh_2>
that's what I was thinking
<White_Flame>
if you change that file before compiling/loading the project, then you're basically changing the source code, not runtime data for it, and those changes need to match the rest of the source code. It semnatically is a source code file, so make it a .lisp with a defvar so it is a source code file
<White_Flame>
there is no discernable way in which it is not a source code file, so accessing it as a "runtime" loaded data file and tryign to treat it as source code is pain. It should just be source code
<Josh_2>
I'm not saying it isn't sourcecode
<White_Flame>
this is metaprogramming, which is source code
<White_Flame>
early data defines how the code should be constructed, which the later code uses
<White_Flame>
and that's all part of the internal build process of the program
<White_Flame>
metaprogramming is certainly a Good Thing, but it is build-time
<Josh_2>
I'm saying I wanted a nicer way to control the installation of the website I made instead of modifying a bunch of global vars that were in a file called configuration.lisp
<Josh_2>
because that was annoying
<Josh_2>
I did it once and it annoyed me
libertyprime has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
<pjb>
If you generate code from a file, it's not a configuration or anything file anymore, it becomes a SOURCE file. You have to put in it git etc. Having passwords in a configuration file demonstrate that it is NOT a source file, and therefore that you CANNOT and MUST NOT use it to generate code.
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
<Josh_2>
welp
<White_Flame>
Josh_2: if you have that config per website, if the only thing the config does is help define a bunch of DEFUNs, then where do the custom defuns for that site go?
libertyprime has quit [Ping timeout: 246 seconds]
<White_Flame>
erm, where does the custom code for that site that _uses_ those defuns go?
<Josh_2>
It's values for things like postgres password, port numbers etc
<Josh_2>
for hunchentoot. pathnames etc
<Josh_2>
things that have to be configured before the site will run
Kundry_Wag has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
libertyprime has joined #lisp
<White_Flame>
well, then that really should be data, not functions
<Josh_2>
functions can eval to data doesn't really matter
<White_Flame>
because then it's much easier to pass by value
<Josh_2>
I can make it variables it doesn't matter
<White_Flame>
sure, if you want weird injection attacks and bugs from your config file, when people want to be clever
<White_Flame>
basically, your code defines a place for that data, and the values in that place get filled in from the config file
<White_Flame>
which is much more runtime data that can live outside the codebase, and the code can be completely compiled & instantiated before that config is set up
<White_Flame>
but in the scheme you had, there was no place for the data, because before that DEFUN came to being, it was unresolvable
xkapastel has joined #lisp
<Josh_2>
hmm alrighty
<Josh_2>
Well thanks for the help :D
<Josh_2>
I gotta go sleep now
<White_Flame>
hasta
* White_Flame
notices how curiously opposed "hasta" (es) and "haste" (en) are in definition
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.2)]
cl-arthur has quit [Remote host closed the connection]
aindilis has quit [Read error: Connection reset by peer]
Kundry_Wag has quit [Remote host closed the connection]