istewart has quit [Quit: Konversation terminated!]
Krystof has quit [Ping timeout: 252 seconds]
Josh_2 has quit [Quit: Gotta go fast!]
daox has quit [Ping timeout: 264 seconds]
daox has joined #commonlisp
ethanxxxl has quit [Ping timeout: 264 seconds]
daox has quit [Ping timeout: 252 seconds]
wacki has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 240 seconds]
bitspook has quit [Ping timeout: 250 seconds]
daox has joined #commonlisp
daox has quit [Ping timeout: 264 seconds]
bitspook has joined #commonlisp
clothespin has quit [Ping timeout: 260 seconds]
daox has joined #commonlisp
bitspook has quit [Remote host closed the connection]
bitspook has joined #commonlisp
chomwitt has joined #commonlisp
beach` has joined #commonlisp
beach has quit [Killed (NickServ (GHOST command used by beach`!~user@2a01:cb19:682:4600:6d0e:89f1:fa67:9735))]
beach` is now known as beac
beac is now known as beach
pve has joined #commonlisp
_cymew_ has joined #commonlisp
mrcom has quit [Quit: Leaving]
shka has joined #commonlisp
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
ethanxxxl has joined #commonlisp
Josh_2 has joined #commonlisp
chomwitt has quit [Ping timeout: 260 seconds]
<Josh_2>
((lambda () "hi :wave: "))
Cymew has joined #commonlisp
rgherdt has joined #commonlisp
daox has quit [Ping timeout: 240 seconds]
jonatack has quit [Ping timeout: 255 seconds]
jonatack has joined #commonlisp
brokkoli_origina has joined #commonlisp
brokkoli_origin has quit [Ping timeout: 268 seconds]
daox has joined #commonlisp
_cymew_ has quit [Quit: Konversation terminated!]
_cymew_ has joined #commonlisp
jamesmartinez has quit [Quit: Connection closed for inactivity]
King_julian has joined #commonlisp
chomwitt has joined #commonlisp
varjag has joined #commonlisp
wacki has joined #commonlisp
dino_tutter has joined #commonlisp
tok has joined #commonlisp
daox has quit [Ping timeout: 272 seconds]
donleo has joined #commonlisp
daox has joined #commonlisp
nybble has quit [Quit: WeeChat 4.2.2]
daox has quit [Ping timeout: 264 seconds]
mgl has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
rtypo has joined #commonlisp
tok has quit [Ping timeout: 256 seconds]
tok has joined #commonlisp
daox has joined #commonlisp
zetef has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
chiselfuse has joined #commonlisp
zetef has quit [Ping timeout: 260 seconds]
JelbyFunes has quit [Quit: Client closed]
danse-nr3 has quit [Ping timeout: 260 seconds]
Oladon has joined #commonlisp
Grauwolf_ has joined #commonlisp
shunter_ has joined #commonlisp
HerlockSholmes_ has joined #commonlisp
slondr_ has joined #commonlisp
jmbr_ has joined #commonlisp
x4d6165_ has joined #commonlisp
remexre_ has joined #commonlisp
randm_ has joined #commonlisp
youthpastor_ has joined #commonlisp
antoszka_ has joined #commonlisp
tertek_ has joined #commonlisp
Catie has joined #commonlisp
sailorCa| has joined #commonlisp
loke___ has joined #commonlisp
gaze___ has joined #commonlisp
benkard has joined #commonlisp
danse-nr3 has joined #commonlisp
bjorkint0sh has joined #commonlisp
payphone has quit [Ping timeout: 268 seconds]
dstein64 has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
sailorCat has quit [Read error: Connection reset by peer]
HerlockSholmes has quit [Read error: Connection reset by peer]
shunter has quit [Read error: Connection reset by peer]
mulk has quit [Read error: Connection reset by peer]
jmbr has quit [Read error: Connection reset by peer]
cracauer_ has joined #commonlisp
youthpastor has quit [Ping timeout: 268 seconds]
tertek has quit [Ping timeout: 268 seconds]
Catie` has quit [Read error: Connection reset by peer]
sirufer has quit [Read error: Connection reset by peer]
x4d6165 has quit [Read error: Connection reset by peer]
slondr has quit [Read error: Connection reset by peer]
cpli has quit [Read error: Connection reset by peer]
loke has quit [Read error: Connection reset by peer]
coat_ has joined #commonlisp
coat has quit [Read error: Connection reset by peer]
remexre has quit [Ping timeout: 268 seconds]
Grauwolf has quit [Ping timeout: 268 seconds]
coat_ has joined #commonlisp
coat_ has quit [Changing host]
HerlockSholmes_ is now known as HerlockSholmes
x4d6165_ is now known as x4d6165
dstein64- has joined #commonlisp
benkard is now known as mulk
jmbr_ is now known as jmbr
shunter_ is now known as shunter
youthpastor_ is now known as youthpastor
slondr_ is now known as slondr
bjorkintosh has quit [Ping timeout: 268 seconds]
antoszka has quit [Ping timeout: 268 seconds]
Oladon1 has quit [Ping timeout: 268 seconds]
gaze__ has quit [Ping timeout: 268 seconds]
randm has quit [Ping timeout: 268 seconds]
cracauer has quit [Ping timeout: 268 seconds]
White_Flame has quit [Ping timeout: 268 seconds]
cracauer_ is now known as cracauer
randm_ is now known as randm
antoszka_ is now known as antoszka
gaze___ is now known as gaze__
White_Flame has joined #commonlisp
cpli has joined #commonlisp
remexre_ is now known as remexre
dstein64- is now known as dstein64
payphone has joined #commonlisp
sirufer has joined #commonlisp
kevingal has joined #commonlisp
gone123 has joined #commonlisp
daox has quit [Ping timeout: 252 seconds]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
tok has quit [Read error: Connection reset by peer]
yitzi has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 260 seconds]
tok has joined #commonlisp
deadmarshal_ has quit [Remote host closed the connection]
gone123 has quit [Ping timeout: 250 seconds]
tok has quit [Ping timeout: 260 seconds]
daox has joined #commonlisp
jon_atack has joined #commonlisp
daox has quit [Max SendQ exceeded]
jonatack has quit [Ping timeout: 252 seconds]
deadmarshal_ has joined #commonlisp
gone123 has joined #commonlisp
<gone123>
hello
<beach>
Hello gone123.
<gone123>
how's it going today beach?
<gone123>
i just finished the chapter on the music database. macros look really cool
<beach>
Well as usual, thanks. You too I hope.
<gone123>
yep i'm doing well. hopefully the usual is good :)
<beach>
Yes.
<beach>
Macros are great for extending the syntax (at the level of s-expressions) of the language. But they are often overused by newbies. You need a macro only when the semantics of function calls won't work.
<beach>
When used correctly, macros can save a lot of boilerplate code.
tok has joined #commonlisp
wacki has joined #commonlisp
tok has quit [Ping timeout: 272 seconds]
mrcom has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 268 seconds]
bitspook has quit [Ping timeout: 250 seconds]
random-nick has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 268 seconds]
attila_lendvai has joined #commonlisp
FragmentedCurve has joined #commonlisp
robin has quit [Quit: Leaving]
chomwitt has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 268 seconds]
daox has joined #commonlisp
daox has quit [Ping timeout: 260 seconds]
kevingal has quit [Ping timeout: 268 seconds]
kevingal has joined #commonlisp
amb007 has joined #commonlisp
bitspook has joined #commonlisp
Grauwolf_ is now known as Grauwolf
yitzi has quit [Remote host closed the connection]
daox has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
tibfulv has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
tibfulv has joined #commonlisp
daox has quit [Ping timeout: 272 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
daox has joined #commonlisp
brokkoli_origina has quit [Ping timeout: 268 seconds]
danse-nr3 has quit [Remote host closed the connection]
daox has quit [Ping timeout: 268 seconds]
X-Scale has quit [Quit: Client closed]
brokkoli_origin has joined #commonlisp
daox has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
mrcom has quit [Ping timeout: 256 seconds]
daox has quit [Ping timeout: 240 seconds]
mrcom has joined #commonlisp
metsomedog has joined #commonlisp
edgar-rft_ has joined #commonlisp
edgar-rft has quit [Ping timeout: 256 seconds]
szkl has joined #commonlisp
daox has joined #commonlisp
X-Scale has joined #commonlisp
daox has quit [Ping timeout: 260 seconds]
dstein64 has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
dstein64 has joined #commonlisp
psilord has quit [Ping timeout: 264 seconds]
King_julian has quit [Ping timeout: 255 seconds]
awlygj has joined #commonlisp
yitzi has joined #commonlisp
<Shinmera>
I think 90% of macros I write are either define-*, with-*, or do-* and the latter two are frequently just sugar to make a lambda and pass that to call-with-* or map-* respectively
<craigbro>
the other type I frequently write are sexp dsls
<craigbro>
like (html (:tag ...))
daox has joined #commonlisp
King_julian has joined #commonlisp
daox has quit [Ping timeout: 240 seconds]
ethanxxxl has quit [Ping timeout: 256 seconds]
daox has joined #commonlisp
attila_lendvai has quit [Ping timeout: 268 seconds]
k_hachig has joined #commonlisp
dlowe has joined #commonlisp
edgar-rft_ is now known as edgar-rft
X-Scale has quit [Ping timeout: 250 seconds]
<cdegroot>
just in case I'm overlooking something - for Lisp-to-Lisp network comms, what's the simplest protocol? $dayJob is in the Erlang ecosystem which has the awesome External Term Format and makes this sort of stuff a breeze. I am toying with the idea to hook up my (Common Lisp-based) X11 window managers between VM guests and host to make things more seamless, the guest would recognize that it is running in a VM and would find the host and open a socket to
<cdegroot>
the WM running on the host and then they could keep config in sync, pass each other commands, etc. So fairly simple stuff, I guess just some text would be sufficient but I wonder whether there's something "more standard".
<craigbro>
we used s expressions, so just text over http, not even converting to JSON
<craigbro>
but you could just skip the http and read and write sexps on a socket fd
<cdegroot>
Yeah, direct sockets is a given. Sexps of course open up a can of worms if you eval them, but I guess if I control both sides of the thing it should be fine.
<craigbro>
a simple event-sourcing model with sexp events would be nifty there. Don't eval them, treat them as data, and events at that, not commands
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
bitspook has quit [Ping timeout: 250 seconds]
<cdegroot>
just use READ then? I think I vaguely remember that people think that that's a bad idea. Dunnow why, a neuron fired that's all I know :)
<beach>
You might want to disable read-time evaluation.
<craigbro>
yes, straight read can result in code execution thru reader macros and other mechanisms
josrr has joined #commonlisp
<craigbro>
check out safe-read in ql?
<craigbro>
or just use A JSON lib..
<reb>
cdegroot: Another option besides s-expressions for data transport is protobufs, either using binary serialization or one of the other serialization formats ... text or JSON.
<cdegroot>
I'm so old, I'd hunt for an XDR library in that case. Just to annoy the Google fanboys ;-)
<cdegroot>
But yeah, sorta between "just send some text" and "we have sexps, silly" and then I remember that someone said "don't use READ on untrusted data" so the thing then becomes a bit hairy.
<cdegroot>
(it is for a single user use case, but guess what, I might push it to an open source repo, someone else will find it and maybe say "hey, that's neat!", and then have a footshooter. So I may just go with text and an auth cookie then)
X-Scale has joined #commonlisp
<reb>
Using unevaluated s-expressions is quite handy, since you can splice parameters into message templates using backquote and comma. If you bypass HTML and just use raw sockets, you can test the API using telnet. Just use a library that turns off read-time evaluation in order to be safe.
<ixelp>
GitHub - brown/swank-client: Common Lisp implementation of a Slime / Swank client.
theruran has quit [Quit: Connection closed for inactivity]
szkl has quit [Quit: Connection closed for inactivity]
Fade has quit [Remote host closed the connection]
daox has quit [Ping timeout: 268 seconds]
zetef has joined #commonlisp
Fade has joined #commonlisp
Fade has quit [Changing host]
Fade has joined #commonlisp
Fade is now known as Fade
<cdegroot>
thx.
wheatengineer has quit [Quit: Leaving]
gone123 has quit [Remote host closed the connection]
tok has joined #commonlisp
zetef has quit [Remote host closed the connection]
waleee has joined #commonlisp
daox has joined #commonlisp
daox has quit [Ping timeout: 268 seconds]
X-Scale has quit [Ping timeout: 250 seconds]
danse-nr3 has joined #commonlisp
Cymew has quit [Quit: Konversation terminated!]
psilord has joined #commonlisp
<metsomedog>
can you get both the car and cdr while looping a list with "loop"? I know you can get the car with the (loop for x in list ...)
<beach>
,(loop for (car . cdr) in '((a . b) (c . d)) do (print (list car cdr)))
<ixelp>
↩ (A B) ↩ (C D) => NIL
<beach>
Or perhaps you mean ,(loop for (car . cdr) on '(a b c d) do (print (list car cdr)))
<ixelp>
(loop for (car . cdr) on '(a b c d) do (print (list car cdr))) ↩ (A (B C D)) ↩ (B (C D)) ↩ (C (D)) ↩ (D NIL) => NIL
<yitzi>
Probably the latter
<beach>
Yeah.
<yitzi>
LOOP destructuring is one of CL's superpowers.
psilord has quit [Ping timeout: 268 seconds]
<metsomedog>
yes, (loop for (car . cdr) on list ...) was exactly what I ment, ty!
<metsomedog>
saves me from creating a recursive function with labels all over the place
<beach>
yaw!
psilord has joined #commonlisp
<metsomedog>
is there some intuition for the words "in" and "on" here?
<yitzi>
metsomedog, in case you didn't know you can also skip stuff.
<yitzi>
,(loop for (x nil . y) in '((a 1 . b) (c 2 . d)) do (print (list x y)))
<ixelp>
↩ (A B) ↩ (C D) => NIL
<metsomedog>
oh neat
<beach>
Well, "in" seems obvious; it's the elements of the list.
<yitzi>
"on" probably means "directly ON the cons cell"
<metsomedog>
what if I want the entire list, then cdr, then cddr, etc? for example (loop for (nil . rest) on (cons nil path) do ...)
<metsomedog>
(I did 'on (cons nil path)' in the start to get the entire list in the first iteration)
<beach>
As in: ,(loop for x on '(a b c d) do (print x)) ?
<ixelp>
(loop for x on '(a b c d) do (print x)) ↩ (A B C D) ↩ (B C D) ↩ (C D) ↩ (D) => NIL
<metsomedog>
Ah i see, yes
<metsomedog>
so intuitively it seems like "in" gets the car (or n first elements if you define many variables) and "on" gets the cdr (or alternatively (car . cdr))?
<beach>
For this kind of question, you might want to join #clschool. People hang out there specifically to answer such questions.
<metsomedog>
right
<metsomedog>
will do
waleee has quit [Ping timeout: 260 seconds]
brokkoli_origin has quit [Ping timeout: 264 seconds]
danse-nr3 has quit [Ping timeout: 268 seconds]
brokkoli_origin has joined #commonlisp
decweb has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
<Josh_2>
dbotton: I've had a project in use for about a year now that uses the Clog gui and the file editor to 'bolt in' new data into the lisp image, the folks using it have to write lisp to do it but it seems to be working
<Josh_2>
Clog is pretty awesome
<Josh_2>
They fill in a clog form and that fills in a template and this lisp code is loaded into the lisp image and off it goes
chomwitt has joined #commonlisp
<dbotton>
Awesome
<dbotton>
Is it public? Josh_2
<Josh_2>
Nope
<dbotton>
If not possible to pm me a screenshot
<Josh_2>
Of which part?
<dbotton>
Any part that looks cool
<Josh_2>
Hmm
<Josh_2>
I'll look
<dbotton>
:)
psilord has quit [Ping timeout: 240 seconds]
zetef has joined #commonlisp
rgherdt_ has joined #commonlisp
mala has quit [Read error: Connection reset by peer]
mala has joined #commonlisp
rgherdt has quit [Ping timeout: 255 seconds]
danse-nr3 has joined #commonlisp
psilord has joined #commonlisp
zetef has quit [Remote host closed the connection]
ocra8 has joined #commonlisp
JelbyFunes has quit [Quit: Client closed]
bitspook has joined #commonlisp
danse-nr3 has quit [Ping timeout: 240 seconds]
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Read error: Connection reset by peer]
tedwing has joined #commonlisp
danse-nr3 has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
amb007 has quit [Ping timeout: 268 seconds]
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
amb007 has joined #commonlisp
daox has joined #commonlisp
nybble has joined #commonlisp
daox has quit [Ping timeout: 260 seconds]
bitspook has quit [Remote host closed the connection]
bitspook has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
yitzi has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
awlygj has quit [Ping timeout: 268 seconds]
awlygj has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
rogersm has joined #commonlisp
tedwing has quit [Quit: leaving]
prokhor has quit [Ping timeout: 240 seconds]
rogersm has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
marcoxa has joined #commonlisp
<marcoxa>
Hi... anybody here?
marcoxa has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
wacki has quit [Read error: Connection reset by peer]
<contrapunctus>
Gone in literally three minutes.
<craigbro>
ok, turn the lights back on, restart the party
k_hachig has quit [Ping timeout: 268 seconds]
wacki has joined #commonlisp
prokhor has joined #commonlisp
rogersm has joined #commonlisp
rogersm has quit [Remote host closed the connection]
kevingal has quit [Ping timeout: 240 seconds]
cage has joined #commonlisp
X-Scale has joined #commonlisp
alcor has joined #commonlisp
psilord has quit [Ping timeout: 264 seconds]
szkl has joined #commonlisp
bitspook has quit [Ping timeout: 250 seconds]
chomwitt has joined #commonlisp
k_hachig has joined #commonlisp
k_hachig has quit [Ping timeout: 268 seconds]
daox has joined #commonlisp
daox has quit [Ping timeout: 240 seconds]
skeemer has joined #commonlisp
awlygj has quit [Ping timeout: 260 seconds]
akoana has joined #commonlisp
awlygj has joined #commonlisp
awlygj has quit [Client Quit]
kevingal has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.3]
_cymew_ has quit [Ping timeout: 256 seconds]
k_hachig has joined #commonlisp
waleee has joined #commonlisp
yitzi has joined #commonlisp
daox has joined #commonlisp
pve has quit [Quit: leaving]
daox has quit [Ping timeout: 255 seconds]
agm has joined #commonlisp
mariari has quit [Ping timeout: 252 seconds]
mariari has joined #commonlisp
robin has joined #commonlisp
szkl has quit [Quit: Connection closed for inactivity]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
rogersm has joined #commonlisp
rogersm has quit [Ping timeout: 260 seconds]
daox has joined #commonlisp
jmercouris1 has joined #commonlisp
jmercouris1 has quit [Client Quit]
ethanxxxl has joined #commonlisp
daox has quit [Ping timeout: 260 seconds]
yitzi has quit [Remote host closed the connection]
metsomedog has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
ethanxxxl has quit [Ping timeout: 264 seconds]
Krystof has joined #commonlisp
k_hachig has quit [Quit: WeeChat 4.2.2]
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
shka has quit [Quit: Konversation terminated!]
chomwitt has quit [Ping timeout: 272 seconds]
ethanxxxl has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
mgl has quit [Ping timeout: 260 seconds]
prokhor_ has joined #commonlisp
prokhor has quit [Ping timeout: 256 seconds]
alcor has quit [Ping timeout: 256 seconds]
rgherdt_ has quit [Quit: Leaving]
decweb has quit [Ping timeout: 272 seconds]
daox has joined #commonlisp
daox has quit [Ping timeout: 252 seconds]
ethanxxxl has quit [Ping timeout: 260 seconds]
ethanxxxl has joined #commonlisp
<yottabyte>
hello, I want to write a pretty simple rest api which will use a sqlite database and use cl for it. it'll be a small app that won't have many requests coming in. I've done lots of web development, but not much in lisp, so I'm wondering how I should go about this. do I just run the server in slime or should I compile it as a native and run it as an executable?
craigbro has quit [Remote host closed the connection]
<ixelp>
clog/WEBSERVER.md at main · rabbibotton/clog · GitHub
<dbotton>
that is how I run my website
<dbotton>
as a service and sbcl --sysinit /home/dbotton/.sbclrc --eval "(ql:quickload :clogpower)" --eval "(clogpower:start-site :port 8081)"
<dbotton>
is what runs the site ultimately, but I could have created an executable yottabyte
|3b| has quit [Ping timeout: 268 seconds]
<random-nick>
you usually make an executable when you want to make your application easily distributible/deployable, you can just load it from source and fasls, or make a core file if you care about startup speed
<random-nick>
running it via slime is fine for development but for "production" using emacs is just needless complication when you can just make a script to run it
craigbro has quit [Remote host closed the connection]
<yottabyte>
gotcha
<yottabyte>
how is working with json in cl? reading it and creating it for responses
robin has quit [Remote host closed the connection]
ethanxxxl has quit [Ping timeout: 268 seconds]
<aeth>
there are, like, 20 JSON libraries, all very different, most of which have some fairly major flaws (such as the one that round trips NIL with JSON's 'null' for some very strange reason of all of the possible things NIL could represent)
craigbro has joined #commonlisp
<aeth>
a poorly written JSON library (there are many) can create an ambiguity between [], {}, false, and even null... if it chooses to represent [] with a list and {} with an alist or plist thus making both empty JSON data structures represented with NIL
hcarvalh` has joined #commonlisp
hcarvalh` has quit [Client Quit]
hcarvalh` has joined #commonlisp
<bjorkint0sh>
eh. no testing?
<aeth>
false vs null is entirely self-inflicted on those libraries' part, though. NIL is far more of a false value than a in-other-proglangs null value
hcarvalh` is now known as hcarvalhoalves
hcarvalhoalves has quit [Changing host]
hcarvalhoalves has joined #commonlisp
<gilberth>
Perhaps the reason that there are so many libraries is because everybody has different ideas on how it should like. I for one demand that I can read JSON and write it out again. w/o loss. With the sole exception that I believe assuming that JS's numbers are double floats.
<aeth>
right, JSON doesn't really map cleanly to CL so there's an infinite number of ways to represent things
<aeth>
you can represent [] with #() and avoid one ambiguity (but lots of Lispers apparently despise NOT using lists), and you can represent {} with hash tables to remove another ambiguity but now order isn't preserved
<gilberth>
To me the real degree of freedom is mainly with objects. Many libraries use hashtables mapping strings to values. I personally don't like that. First: Why not intern. Second: order is not preserved. Third: JSON doesn't promise that keys are unique.
<aeth>
so people may prefer plists/alists to preserve order but keep some ambiguity
<aeth>
gilberth: wait what
<aeth>
keys aren't unique?
<gilberth>
Nope. I was reading up abouttthat with ECMA 404 the other night. And was surprised too.
<bjorkint0sh>
it's not a database is it? why does it have to be.
<aeth>
OK, so I guess all of the 20ish libraries probably have at least one major flaw if you craft a malicious enough JSON file
amb007 has quit [Ping timeout: 252 seconds]
<craigbro>
well, you will have key collision, likely poorly defined semantics, but not catastrophic
<aeth>
bjorkint0sh: not round-tripping is just short-hand for not solving the ambiguity in one of many ways for the most part (though not preserving order also can matter)
<aeth>
lots of libraries create a situation of a->x, b->x, x->?
<bjorkint0sh>
inf
<aeth>
well, x->? when going the other order, so I guess ?<-x would be the way to represent it
donleo has quit [Ping timeout: 240 seconds]
<gilberth>
My two cents: I use [null, true, false, [1, 2.3], { "foo": "fool", "bar": 42 }] being #(:null :true :false #(1 2.3d0) (:foo "fool" :bar 42)). I use plists and keywords as destructuring-bind is just too convenient. And I soft-intern the keys. It's a keyword when one exists already and an uninterned symbol otherwise. The next Lisper will think my representation is ugly.
Josh_2 has quit [Ping timeout: 264 seconds]
<aeth>
in other situations, I have often gone with defining a false so lists can be used without the empty list + false ambiguity
<aeth>
I've never really seen the need to define a separate true, though, because T is good enough
<gilberth>
My question however is, when you pick e.g. false = NIL, [] = NIL. How would you go about writing JSON?
<aeth>
the JSON object {} probably is best (or at least most robust) as an object (defined with CLOS or whatever) that handles everything, rather than just taking in an alist, plist, or hash table
<aeth>
does add an extra wrap and unwrap, but you'd need that for some edge cases anyway, if you care about those edge cases
<gilberth>
aeth: I picked plist out of convenience. I can use destructuring-bind and I can just use `(:foo ,(+ 1 2)) when I have code making JSON.
<aeth>
I guess the real problem is that JSON is only convenient in JS (and even there there are issues with just parsing it as JS so that's discouraged) and the further from JS as a language you go, the less convenient it is (though CL isn't quite as far as the statically typed languages are)
<gilberth>
And I picked :TRUE instead of T because would I have picked T you might believe that NIL is JSON's false.
<aeth>
and yet people use JSON these days for things that are probably not being produced or consumed by JS, even e.g. 3D model formats (though, yes, the web has 2+ ways to do graphics, and will probably add another 2 within the decade)
<gilberth>
JSON is poor man's s-expressions when used that way.
* gilberth
waits for the day at which someone discovers s-expressions and that'll then become fashionable.
<gilberth>
Or better not, "they" will probably not get it and break it in funny ways.
<aeth>
there is a standard (RFC?) s-expressions-as-data format that doesn't match any Lisp
<aeth>
and each major Lisp (except maybe CL vs elisp?) have different s-expressions, although Scheme and CL are pretty close
<craigbro>
hey, EDN for the win, err actually, no
<aeth>
you also get s-expressions in... GCC. And Wasm. And probably some other places.
<craigbro>
tried using EDN, but the reader literals just cause problems
<gilberth>
I won't care whether you e.g. said 0xFF to denote a hex number or not. Or whether comments begin with "#" or "%". I was thinking about extra parens like [ ] and { } for no particular purpose.
<aeth>
R6RS does that :-)
<aeth>
at least for []
beach has quit [Ping timeout: 255 seconds]
beach has joined #commonlisp
<yottabyte>
great info everyone, thank you
<yottabyte>
Clojure uses [] and {}, do you not like that gilberth?
<random-nick>
isn't interning keys (or anything for that matter) bad if there is potentially malicious data?
<gilberth>
random-nick: I said, I "soft intern". I do (or (find-symbol s :keyword) (make-symbol s))
<random-nick>
as someone could DoS the server via heap exhaustion by interning a lot of garbage
<gilberth>
yottabyte: I don't. Look at their LET: (let [x 10 y 20] ..) why do I need to remember that I need to use [] there? That's arbitrary.
<gilberth>
My reasoning is simple. If your program actually cares about a key named "foo", it will have a reference to the :FOO symbol and so you see e.g. (:FOO 42). When some clown tries to DoS me by passing {"funny": 42}, I'll see (#:FUNNY 42) and no harm was done. I do the same when parsing HTTP headers e.g.
ethanxxxl has joined #commonlisp
<random-nick>
right, makes sense
<yottabyte>
true about the [] in clojure
<cdegroot>
One thing, by the way, I never realized until I grew so old my eyesight started getting even worse: ergonomics of Lisp. '{([])}' starts to become really hard to parse, '((()))' not so much.
<craigbro>
I appreciated clojures decisions quite a bit
<craigbro>
I think it's an improvement, and it's something I miss
<yottabyte>
why would {"funny": 42} mess you up?
<gilberth>
The concern was that when you actually intern each key in JSON data, an attacker can send you a stream of {"foo-1": 1, "foo-2": 2, "foo-3": 3, ...} and those would pile up until memory is exhausted. Since once a symbol is interned in a package, it sticks there forever.
<random-nick>
malicious interning is also a problem with reading untrusted s-expressions, but you can get around it by not using the standard reader and instead implementing your own or using eclector which lets you decide what to do with to-be-interned symbols
<yottabyte>
but since those symbols will be unique, you can still run into issues, no? and couldn't you work around this by limiting payloads to be a certain size max? if they're streamed to you byte by byte, you can just fail after a certain point
robin has joined #commonlisp
<craigbro>
just let scope and gc do the work.
<random-nick>
if you're accepting data of any size and putting it in memory then any kind of format can get you DoS'd by heap exhaustion
<craigbro>
it's not the number of symbols, it's that they never can be GCed
<gilberth>
yottabyte: It's not about single large request. I can send a request once a second mentioning a random JSON key of say 1M. You'll then leak 1M/s, if you intern those properly.
<random-nick>
the problem with malicious interning is that the symbols stay alive after the request ends
<craigbro>
I'm a fan of SAXlike JSON parsing myself
<yottabyte>
I see
<craigbro>
obviously it's not the simplest way to pass data around, more for transforming, extracting, etc..
kevingal has quit [Ping timeout: 268 seconds]
<gilberth>
I don't like that for it's complicated. I also don't like HTML generators like CL-WHO which also are like SAX-parsing in the sense as HTML is written as you go. I prefer to generate the whole document in some internal representation then just write it in one go as HTML. Or JSON, Or SVG. Or whatever. This way I don't have to deal with side effects.