Xach changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook>
notzmv has quit [Ping timeout: 250 seconds]
makomo has quit [Ping timeout: 240 seconds]
notzmv has joined #commonlisp
notzmv has quit [Ping timeout: 252 seconds]
cjb has quit [Ping timeout: 260 seconds]
rt has joined #commonlisp
rt has quit [Remote host closed the connection]
rt has joined #commonlisp
waleee has quit [Ping timeout: 250 seconds]
Guest29 has quit [Quit: Client closed]
tyson2 has joined #commonlisp
flip214 has joined #commonlisp
nirnam has quit [Read error: Connection reset by peer]
notzmv has joined #commonlisp
bpanthi977 has joined #commonlisp
notzmv has quit [Ping timeout: 245 seconds]
rt is now known as robin
notzmv has joined #commonlisp
bpanthi977 has quit [Quit: bpanthi977]
brettgilio has left #commonlisp [The Lounge - https://thelounge.chat]
prxq has joined #commonlisp
notzmv has quit [Ping timeout: 240 seconds]
prxq_ has quit [Ping timeout: 245 seconds]
derelict has quit [Ping timeout: 256 seconds]
trufas has quit [Ping timeout: 245 seconds]
<sm2n> Bike, this was the error I got: https://plaster.tymoon.eu/view/2587#2587
<sm2n> I will delete the fasls and see what happens
<Bike> that's not an error. that's a compiler note that refers to an error.
<Bike> it's saying that the call to error is unreachable and has been deleted.
<sm2n> oh whoops, sorry for wasting your time
<sm2n> I should have read that correctly
<Bike> it is kind of confusing
<Bike> and maybe i should go in and figure out the #+ incantations to make the note go away, since it's not really interesting
tyson2 has quit [Remote host closed the connection]
dsk has joined #commonlisp
<beach> Good morning everyone!
akoana has left #commonlisp [#commonlisp]
igemnace has quit [Quit: WeeChat 3.2]
igemnace has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
<Josh_2> Morning beach
igemnace has quit [Client Quit]
igemnace has joined #commonlisp
<mfiano> That was fun. The new Sussman book was very thought provoking and makes me want to revisit some of my complicated CL projects.
<beach> Sounds like I must get a copy? What makes it so good?
<mfiano> It has a few techniques for what I usually call additive programming - extending designs beyond their initial intentions without modifying existing code. Some of the ideas, while hard to explain briefly on IRC, really hit home for me.
<Bike> i haven't finished it yet, but unlike most things on programming i've read it emphasizes rewriting programs. a lot of the examples are along the lines of "okay, so we made this thing of perfect crystalline beauty in the last section, but now we need it to do something else. how could we have written it more mutably in the first place to avoid having to completely rewrite it now?"
nirnam has joined #commonlisp
<beach> Interesting.
<Bike> oh huh, and it has the ball of mud quote i like, but says it was made up. how about that
<moon-child> wikipedia says the alleged originator of the quote claims he called it a hackey sack, not a ball of mud
<moon-child> err, bean bag
<Bike> oh well that's fine then.
<lotuseater> mfiano: What's the title of the new Sussman book?
<Bike> software design for flexibility
<mfiano> Software Deisgn for Flexibility - How to Avoid Programming Yourself Into a Corner
<Bike> oh, and it uses scheme instead of lisp, which shouldn't really be surprising
<Bike> so it is only somewhat on topic
<mfiano> I would not recommend it as an introductory book on Lisp nor software design.
<beach> I ordered it.
robin has quit [Remote host closed the connection]
<hayley> Hey, with the number of people asking if they can learn Common Lisp from SICP, another Sussman book can't be that off topic.
robin has joined #commonlisp
<mfiano> beach: Just try not to grumble too much when you don't see any explicit objects or generic functions :)
<mfiano> It's all closures in the usual scheme spirit
<lotuseater> Bike: it isn't surprising and I would have bet on it
<lotuseater> they also reused the lambda sorcerers for the cover :)
<mfiano> Well it is considered an advanced sequel to SICP
<lotuseater> do you also know this "Structure and Interpretation of Classical Mechanics"? they do even Hamiltonian and Lagrangian mechanics
<Bike> huh, and it mentions not only MOP, but AspectL
<lotuseater> ok that's offtopic. but interesting as a somewhat physicist in spe
<lotuseater> oh what's AspectL?
<beach> mfiano: I'll keep that in mind.
<lotuseater> s/interesting/interesting to me
<Bike> aspectl (they actually mention aspect-oriented programming, but w/e) was the predecessor to pascal costanza's contextl project https://github.com/pcostanza/contextl
<Bike> which is an interesting system to dynamically add data and behavior to classes and generic functions and stuff, though i haven't really used it
<lotuseater> sounds very advanced
<mfiano> Guile's CLOS port has some nifty features not found in (at least standard) CL, that I'd like to find support for one day when I'm bored enough.
<Bike> like what?
<mfiano> 2 examples:
<mfiano> defining a generic function with the defgeneric equivalent on a builtin function like #'+ will register it as the base case method, allowing you to extend any regular function.
<mfiano> and, arity overloading...new methods don't have to conform to the required positional parameter protocol.
<Bike> mm. both things people want sometimes
<moon-child> former is a nonstarter as such for performance reasons, but you can easily define a '+' method in your own package that uses cl:+ as its base case
<moon-child> latter is cool though
<hayley> 1. Either you are doing UB or someone should be in trouble for not making something generic 2. Bye-bye lambda list
Bike has quit [Quit: sleep]
taiju has quit [Ping timeout: 258 seconds]
pranavats has left #commonlisp [#commonlisp]
taiju has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
selwyn has joined #commonlisp
pve has joined #commonlisp
karlosz has joined #commonlisp
lisp123_ has joined #commonlisp
derelict has joined #commonlisp
dsk has quit [Ping timeout: 258 seconds]
<beach> mfiano: The first thing is easy in SICL. Simple functions in SICL are funcallable standard objects. All that is needed is a CHANGE-CLASS and the definition of the initial method.
karlosz has quit [Quit: karlosz]
asarch has joined #commonlisp
silasfox has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
notzmv has joined #commonlisp
wilfred has joined #commonlisp
pranavats has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
asarch has quit [Quit: Leaving]
amb007 has quit [Ping timeout: 258 seconds]
amb007 has joined #commonlisp
spr has joined #commonlisp
vats has quit [Ping timeout: 252 seconds]
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
pve has quit [Ping timeout: 240 seconds]
rgherdt__ has joined #commonlisp
rain3 has joined #commonlisp
icer has joined #commonlisp
notzmv has quit [Ping timeout: 258 seconds]
shka has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life_ is now known as Lord_of_Life
kakuhen_ has quit [Quit: Leaving...]
kakuhen has joined #commonlisp
spr has left #commonlisp [#commonlisp]
icer has quit [Quit: WeeChat 2.9]
scymtym has quit [Remote host closed the connection]
peterhil has joined #commonlisp
voltron has joined #commonlisp
amb007 has quit [Ping timeout: 245 seconds]
amb007 has joined #commonlisp
fengshaun has quit [Quit: bibi!]
fengshaun has joined #commonlisp
silasfox has quit [Ping timeout: 245 seconds]
silasfox has joined #commonlisp
santiagopim has joined #commonlisp
dsk has joined #commonlisp
santiagopim has quit [Read error: Connection reset by peer]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
santiagopim has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
santiagopim has quit [Ping timeout: 250 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
peterhil has quit [Ping timeout: 240 seconds]
amb007 has quit [Read error: Connection reset by peer]
santiagopim has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
santiagopim has quit [Remote host closed the connection]
rgherdt_ has joined #commonlisp
lisp123 has joined #commonlisp
gaqwas has joined #commonlisp
rgherdt__ has quit [Ping timeout: 258 seconds]
lisp123_ has quit [Ping timeout: 240 seconds]
<jackdaniel> traffic is low, so I'll share an artifact of a tutorial I'm writing for McCLIM that aims at "gadget" developers: http://turtleware.eu/static/paste/aea793e7-clock.webm
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
<rain3> Awesome
<jackdaniel> thanks
<jackdaniel> I plan to also discuss an interactive "date picker" gadget (sort of a calendar)
kakuhen_ has joined #commonlisp
kakuhen has quit [Ping timeout: 245 seconds]
silasfox has quit [Ping timeout: 272 seconds]
kakuhen_ has quit [Quit: Leaving...]
silasfox has joined #commonlisp
kakuhen has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
<lisp123> jackdaniel: does McClim require any dependencies outside of the lisp files?
srhm has joined #commonlisp
<lisp123> I tried using it once but it errored out on MacOS
<beach> lisp123: The current main backend needs X11.
<moon-child> lisp123: try installing xquartz, maybe?
<lisp123> thanks beach & moon-child, will do
<lisp123> Can't wait to get rid of this Mac..
<beach> What's stopping you?
<lisp123> I bought a 27" 5K screen a few years ago, and it only works with Mac
<lisp123> So I need to use this for a few more years to make the purchase worthwhile
<moon-child> sounds like the sunk cost fallacy
<lisp123> I tried doing Linux via VM, but the fonts are not as sharp (probably because of the screen being HD)
<lisp123> moon-child: more or less :)
vats has joined #commonlisp
<pjb> moon-child: in a way; but also, the screen is gorgeous. Even if you didn't used macOS, you'd use it on macOS with X11.app to your linux box…
<pjb> lisp123: tramp is nice for that; you run the local emacsformacosx.com with the nice font, editing remote files.
jimka has joined #commonlisp
<lisp123> pjb: I have that Emacs, with tramp does that mean I can remote into a VM but use Apple's screen rendering?
<lisp123> as in I am using that version (emacsformacosx.com)
<jimka> hi everyone, I was having lots of trouble connecting. I was reading https://www.cliki.net/irc, which lead me in the wrong direction. From that web page I thought the server name was libera.chat, but it is irc.libera.chat.
<beach> jimka: Hey, welcome [back].
<jimka> beach. I was about to send you an email asking you how the irc channel works now. I don't know what gave me the idea to try irc.libera.chat rather than libera.chat. First I was trying libra.chat (being dislexic and not noticing the infix e)
<beach> Yes, I see.
<jimka> Hey can someone help me with something that has bugged me for many years.
<beach> You were absent when we had all the discussions and made a decision to move.
hendursa1 has joined #commonlisp
gaqwas has quit [Ping timeout: 258 seconds]
<beach> jimka: Try us.
pve has joined #commonlisp
<jimka> Is there a place in the hyperspec (or elsewhere) which documents the format directives. What I mean is a mapping from directive to meaning. the spec has many sections you can click though one by one until you find the one you want. But what if I want to know what ~w means (for example) how can it find it more easily?
<jackdaniel> jimka: try typing ~a in l1sp.org
hendursaga has quit [Ping timeout: 244 seconds]
<jackdaniel> it provides a link to the appropriate section in the hyperspec
<lisp123> If you have slime, believe this works: common-lisp-hyperspec-format, or C-c C-d ~, to lookup format control characters.
<jimka> so there's no table in the spec that lists all the directives ?
<jimka> that's a shame.
<lisp123> jimka: try this (not a table, but still): https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html
<jimka> The clojure language as a very good implementation of cl-format. whoever implemented this function did an amazing job. The documention of the function gives the url of the cl hyperspec page. I've started using it more and more. and I've started posing a few cl-format recipies in the open clojure docs.
<jimka> but it is hard for clojure users to navigate the hyperspec. I thought a summary table would be a good thing for reverse engineering a given call to cl-format.
srhm has quit [Quit: Konversation terminated!]
<jimka> can someone tell me the relation of ~A to pretty printing?
srhm has joined #commonlisp
<jimka> is ~A supposed to pretty print its argument or not or is that a choice of the implementation or does it depend on the value of *print-pretty* ?
<jimka> someone (not expert) told me this was a matter in dispute.
<lisp123> jimka: looks like it is based on princ, so if you look up the CLHS for that you will get the answer. "It binds *print-escape* to false and *print-readably* to false
<jackdaniel> ~a means aesthetic print, not pretty print
<jimka> in sbcl
<jimka> (format t "~A~%" '(or (and a b) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and c d) (and x y)))
<jimka> is printed as
<jimka> (OR (AND A B) (AND C D) (AND C D) (AND C D) (AND C D) (AND C D) (AND C D)
<jimka> (AND C D) (AND C D) (AND C D) (AND C D) (AND C D) (AND C D) (AND X Y))
<jimka> maybe that is because of line-length or margin or something? not because of pretty-printing ?
<hayley> As I see it, *PRINT-PRETTY* defaults to T on SBCL, and so ~A uses pretty printing.
<hayley> And the margins are only respected when pretty printing.
<jimka> the issue http://www.lispworks.com/documentation/HyperSpec/Issues/iss169_w.htm talks about whether *pretty-print* should get bound by ~A and ~S. However, I don't understand whether this *issue* was implemented or left up to implementations.
<jimka> Motivation for my question/comment: in the clojure implementation of cl-format, the ~W directive invokes the pretty printer but ~A does not, regardless of the value of *print-pretty*. however ~A does print aesthetically in the sense that it calls the equivalent of print-object on its argument.
<jimka> I didn't even know that ~W existsed.
<jimka> existed
<jackdaniel> since the specification does not mention that ~a binds *pretty-print* this issue has not been put in the standard
<jackdaniel> issues are supplemental
<jackdaniel> as of why it did not end up as part of the standard -it might be that they didn't have time to put it there
<jimka> hayley, where do you get that the margins are only respected when pretty printing? Is that something you gather from experience, or have you seen it written somewhere?
<hayley> I can't remember where, but loosely speaking, the pretty printer is just clever about where to put newlines. When pretty printing is enabled, the margins are used to decide where to break, and no newlines are printed otherwise.
wilfred has quit [Quit: Connection closed for inactivity]
<hayley> clhs pprint-newline
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
<jimka> pprint-newline and pprint-logical-block make my head spin.
<jimka> hats off to anyone who has implemented this.
<jimka> beach, who implemented format for clasp?
<hayley> Yeah, when I was trying to figure out how to use the pretty printer I just grepped through Quicklisp code to find a suitable FORMAT string.
<hayley> Oh, and it then went through ECL, which Clasp was based off to an extent.
<beach> jimka: Clasp copied the Common Lisp code of ECL, so I am guessing it came from there.
<jimka> the clojure implementation is only 1950 lines long. It was authored by Tom Faulhaber in 2009. The source code is goverened by an Eclipse Public License. The header says it implements chapter 22 of "Common Lisp the Language, 2nd edition", but it does not give an indication whether it was written from scratch, or based off of (translated from) some other source.
<beach> SICL FORMAT is almost exactly twice that size.
<beach> ... and there are still a few directives missing.
<jimka> beach, are you including the code for pprint? or is that a seperate section?
<beach> PPRINT is not included in that count.
<jimka> beach, if you strip away the comments, how many lines is it?
<jimka> the clojure version is not heavily commented, but pretty understandable, at least locally.
<beach> 3300 without comments.
<jimka> curious.
<beach> I probably do things very differently.
<beach> Does clojure have a format-directive compiler?
<jimka> did anyone know that ~R has support for new-roman and old-roman I.e, iv vs iiii ?
<beach> For each directive, I have an interpreter method and a compiler method.
makomo has joined #commonlisp
<jimka> It has a function named compile-directive. So that's probably what you're talking about. right?
<beach> I guess.
<jimka> is that good or bad?
<beach> Well, if it is a monolithic function, that's probably not great. SICL format parses directives to instances of standard classes and then it has methods specialized to those classes on the interpreter and the compiler generic functions.
<beach> This way, FORMAT is both extensible and possible to customize.
<jimka> the compile-directive function extracts the params and the flags, determines the dispatch function from the directive, emits an error if it cannot do so, and returns a structure that I don't immediately understand if it was successful.
<beach> How does it determine the dispatch function from the directive?
<jimka> the function is 20 lines long.
<beach> I guess I could study it if I wanted to.
<jimka> there is a data structure defined by a macro called defdirectives. each directive looks like it contains 5 fields which look to me like the specify things like padding, at and colon, and a lambda function of 3 argument which appently evenutally prints the result.
<jimka> does anyone know Tom Faulhaber?
<jimka> he was/is obviously lover of common lisp.
voltron has quit [Ping timeout: 272 seconds]
<beach> Maybe Tom is hiding here behind some nick.
lisp123 has quit [Quit: Leaving...]
lisp123 has joined #commonlisp
<beach> jimka: Thanks. I don't think I have the time to study it now.
kevingal has joined #commonlisp
<jimka> that's prehaps a better page. apparently the code within the clojure code base compiles lots of files togehter from the original project into a single file.
selwyn has joined #commonlisp
<jimka> I still haven't found any attribution of where the original code came from. reading the comment the author wrote it from scratch
santiagopim has joined #commonlisp
<beach> It could be. It's a fun project. SICL FORMAT was the first SICL module I wrote I think.
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
scymtym has joined #commonlisp
pillton has quit [Ping timeout: 260 seconds]
jimka has quit [Ping timeout: 258 seconds]
nij- has joined #commonlisp
<nij-> It's hard to program in C interactively. Is this going to change if I learn and use cffi?!
<hayley> It Depends™️. It is nice to be able to interactively prod at alien things, but those alien things can sometimes be written in a way that is hostile to interactive prodding.
<hayley> And you are out of luck if you need to change anything on the C side, which I am shore probably won't be necessary if you are using someone else's library, but is worth mentioning.
<nij-> s/shore/sure/ ?
<hayley> Hm, no, the C side has a shore.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
tyson2 has joined #commonlisp
<mfiano> oh boy :)
<nij-> lol ok :)
waleee has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<lisp123> Is C a hard language to learn?
PinealGlandOptic has joined #commonlisp
dsk has quit [Ping timeout: 250 seconds]
frgo has quit [Remote host closed the connection]
<mfiano> No, but it's hard to use effectively.
jimka has joined #commonlisp
frgo has joined #commonlisp
<nij-> I'm spoiled by lisp's interactive devel experience.. C seems hard
<lisp123> mfiano: thanks
<hayley> It's simple enough, but you don't get much to work with, and what you do get out of the box is quite nice for blowing your feet off.
<mfiano> Just your feet? You're lucky
<lisp123> Will C always be around or will "Rust" take over?
<hayley> Neither.
<lisp123> Assembly?
<hayley> mfiano: I'm pretty sure the idea is to merely scare them, not give them nightmares for the rest of their life.
<hayley> lisp123: If your name is John von Neumann, sure.
<mfiano> There will always be languages with gimmicks, just like there always has been.
<mfiano> I wouldn't say any will "take over"
rogersm has joined #commonlisp
<lisp123> For example, as I understand now, a Lisp compiler will parts of its code written in C, will there be a future where C is not used as the base language?
<nij-> I'm overwhelmed.. could someone help come up with a basic usage example for this lib...... https://github.com/tdrhq/cl-unix-sockets/blob/master/unix-sockets.lisp
<nij-> It's full of CFFI and I don't really know C :(
<lisp123> And Emacs also has some code written in C
<mfiano> As long as you are interfacing with traditional operating systems, it is unavoidable.
random-nick has joined #commonlisp
<lisp123> mfiano: i see - thanks
<hayley> nij-: Well, there is a test file which shows off most of the interface: https://github.com/tdrhq/cl-unix-sockets/blob/master/test-unix-sockets.lisp
srhm has quit [Quit: Konversation terminated!]
srhm has joined #commonlisp
<nij-> Oh, it reminds me that tests are actually my friend not foe! Thank you hayley :)
<hayley> You can barely get by with mere syscalls on Unix, so C is avoidable. But another view is that you don't touch bare C from Emacs or most Common Lisp code.
<hayley> But none of the big native-code Lisp compilers (SBCL, Clozure, SICL) have C code; the latter two have interface stuff written in C, but that's it.
<lisp123> hayley: interesting, thanks for the colour
<pjb> nij-: there are C interpreters.
<pjb> with repl etc.
<nij-> Can I expect to find the standard C libs in linux in Windows as well?
<pjb> nij-: cf. cint, eic,
<pjb> standard C libraries are found anywhere a standard C compiler runs.
<nij-> pjb: my impression is that they are not stable enough.. remembered trying some of them
<nij-> pjb oh that makes sense!
<pjb> well, that depends on the number of users. More users => more bug found => more maintenance work => fewer bugs remaining.
<nij-> Then.. why is cl-unix-sockets not supporting Windows? Both C and common lisp should be able to run on Windows.
<mfiano> Not enough developer interest more than likely
<hayley> Are there even Unix sockets on Windows?
<nij-> Yeah, it's not the nature of C that prevents a good enough C interpretor to be made?
<hayley> And, also note that C doesn't specify how networking works - that is specified in the standard for your operating system (e.g. POSIX).
<nij-> hayley: I don't know really. I'm not sure if that's an abstraction of socket that's called by the name "Unix sockets".
<mfiano> hayley: win10 and later apparently
<pjb> nij-: no, there are windows sockets on windows, not unix sockets.
<pjb> nij-: not at all the C language doesn't prevent a good interpreter to be implemented.
<hayley> You could surely write a C interpreter, but a. I doubt it would make for a productive environment and b. you are asking the wrong question - a compiler would also work, you just have to be able to run it on the fly.
<mfiano> pjb: there are Unix domain sockets in windows 10 version 1803
<pjb> nij-: it's the nature of C programmers that prevents them to use interpreters.
<pjb> mfiano: but does it uses the same API as on unix?
<hayley> I think Windows snarfed the BSD socket API a long time ago.
<mfiano> No idea. I haven't used Windows since windows 2000
<nij-> Seems that they support bash too...
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<hayley> Nasty example code though.
kakuhen has quit [Quit: Leaving...]
srhm has quit [Ping timeout: 258 seconds]
selwyn has quit [Read error: Connection reset by peer]
jimka has quit [Ping timeout: 240 seconds]
jimka has joined #commonlisp
<lotuseater> lisp123: i found a book with a mathematical introduction to C, maybe that will help me. but better learn to use CFFI first
<lotuseater> hayley: there's a C++ interpreter written by CERN physicists for their ROOT system
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<lisp123> lotuseater: Hvae you see the recipe for CFFI in Common Lisp Recipes? It was quite good (but maybe its too basic for what you are after)
<lotuseater> yes i did
<lisp123> thought so
<lotuseater> the big difference is, when you write bindings to *.so files or such, you're not enslaved to write that in C but do it in CL
<lotuseater> lisp123: there's a 2h video by cbaggers about CFFI, very good and one of his longest in the series
<lisp123> lotuseater: Nice, I will watch it one day. For now I'm lucky to avoid having to use anything outside of Lisp
<lotuseater> but be careful out there, they will tell you it MUST be done in C :)
<beach> lisp123: Are you saying that there must be some C code in a Common Lisp system?
<lotuseater> so when you ie do cffi:with-foreign-object in SBCL (and surely the most other similarly) it gets stack-allocated with dynamic-extent. all those (for us) alien objects
<lisp123> beach: I was saying that some point (I may likely be wrong) that C is required - it can be thrown away later once its compiled?
<lisp123> is likely to be required* - from what I have read
<beach> lisp123: You should have told me that a decade ago. I would never have started SICL if I knew that.
<beach> lisp123: I am still waiting for that day to happen though. So far, there is not a single line of C code in SICL.
<lisp123> beach: Glad I didn't :D
<lotuseater> beach: I think lisp123 means iff nothing else is there formerly.
<lisp123> lotuseater: yes, that's what I meant
<beach> So back in 1957?
<beach> C didn't exist then.
<lotuseater> so you can say as with McCLIM "Now featuring 100% less C."
yitzi has joined #commonlisp
<lotuseater> I once wanted to tell a C programmer the type "void" can't exist, he got scared and yelled at me.
<beach> nij-: As hayley said, C can certainly be interpreted, just as Common Lisp can be compiled. But the definition of C and most static languages is such that there is a compile-link-execute cycle. These languages don't have defined semantics for (say) modifying a definition at run time.
<lisp123> beach: in the context of something like this: https://guix.gnu.org/en/blog/2020/guix-further-reduces-bootstrap-seed-to-25/
<hayley> The void type sorta does exist; we can say that some expression is of type void. And you can return a "void" value of some sort, but it's not really a value. In ML, for example, the equivalent to void would be a tuple of 0 elements, i.e. the type ().
<beach> lisp123: But that's not in 1957. That's now. Now that we have several very good Common Lisp systems, no C is required.
<lisp123> beach: but at some point those systems required C, no?
<phoe> at some point they even didn't require C
<beach> No! What makes you think that?
<phoe> ;; because C did not even exist
<lisp123> I see
<hayley> For example, given the declaration void foo(); we know the expression foo() is necessarily of type void. It is impossible to use such a value, but the type itself exists.
<shka> void is not real, it can't hurt you
<beach> lisp123: I am really curious to understand why you think C is required.
<phoe> also see mezzano for a completely C-less Lisp implementation
<jackdaniel> lisp123: computer (as a machine) has certain binary protocols for telling the machine what to do
<jackdaniel> usually an abstraction layer is put on top of it (a kernel so to speak), but that's not even necessary
<lisp123> beach: Well I was reading this paragraph "Currently, Mes consists of a mutual self-hosting scheme interpreter and C compiler. It also implements a C library. Mes, the scheme interpreter, is written in about 5,000 lines of code of simple C. MesCC, the C compiler, is written in scheme. Together, Mes and MesCC can compile a lightly patched TinyCC that is self-hosting. Using this TinyCC and the Mes C library, it is possible to bootstrap the enti
<lisp123> re Guix System for i686-linux and x86_64-linux."
<jackdaniel> either way, said program is compiled by some means to that binary protocol language
<hayley> shka: "Who is lotuseater?" "He is afraid of the void type." "foo()!" "Stop it, hayley! You're scaring him!"
<shka> lisp123: oh, you can write without C
<jackdaniel> and there is no need to have the source language to be "C", it may be very well lisp
<shka> you can even write without glibc
<beach> lisp123: But the fact that one system requires C doesn't mean that every system requires it. I am still curious about why you thought so.
<jackdaniel> omnipotence of C ABI certainly gives that impression ,)
<lisp123> I thought operating systems were written in C?
<beach> lisp123: As in, I am interested in the kind of thinking that lead to that conclusion.
<phoe> omnipotence?
<phoe> or omnipresence?
<phoe> lisp123: no?
<phoe> again, see mezzano for a completely C-less operating system
<shka> lisp123: usually they are, but they don't have to be
<hayley> lisp123: Only if your name is Andrew Tanenbaum.
<beach> Heh.
<lisp123> But was CMUCL written on a platform that was written on C?
<shka> lisp123: the big thing with C is the libc which allows you to not use system calls directly
<phoe> lisp123: no idea, some part of it surely was
<beach> lisp123: You keep bringing up examples. But I am interested in knowing why you thought that *any* system would require C.
<jackdaniel> phoe: omnipotence has at least two meanings I'm aware of -- one is (as you probably assumed) being all-powerful; second is adaptivity (as in cellular biology)
* pl recalls OSes written in Lisp, C#, Pascal, Oberon, Ada, PL/I, PL/M, BLISS...
<hayley> It probably was, but -- I'm just going to say what beach said.
<phoe> but some parts of it might have been written on a lisp machine which was microcode + lisp
<lotuseater> hayley: I can greatly imagine this scene in a meme! :D
<pl> CMUCL originated from a system without C
<lisp123> shka: thanks for that
<phoe> jackdaniel: oh, I think I understand now
nirnam has quit [Remote host closed the connection]
<hayley> But, do note, that going back a few hours in context, you don't need to touch C for most programming exercises anyway.
<pl> I believe the C runtime portion that SBCL also kinda inherited showed up much later eith Unix port
<shka> lisp123: btw, it is not just lisp, Golang in the original guise was producing binaries which would not link libc
<shka> even
<shka> but this was difficult to maintain
<hayley> Hm, Macintosh Common Lisp (aka Clozure) would have had Pascal code early on. The FFI uses Pascal terms from memory.
<lotuseater> shka: it's just saying "hey, I'm a funny procedure doing nasty side-effects. have fun!"
<lisp123> C's got a good marketing team :)
<pl> Golang still doesn't link with libc outside of few platforms
<beach> lisp123: Please! I am very interested in the way people reason about these things. So help me out here.
<pl> I often setup building without libc on purpose
<shka> pl: well, it does link with libc even on linux now :/
<hayley> lotuseater: That is still a type though. Oh, in Haskell we might write IO ()
<pl> shka: not mandatory
<shka> true
<pl> shka: and lots of software builds without libc
jimka has quit [Ping timeout: 256 seconds]
<lotuseater> hayley: you're right of course :)
<hayley> But then again, write does an obvious side effect, but returns a ssize_t, which is not void, so it cannot be a funny procedure doing nasty side-effects.
<shka> lisp123: thing is, C is just another programming language, it's position is because of historical reasons
<pl> Also, Windows specifically does not require C
<shka> in the alternate timeline, pascal for instance could occupy the same niche as C
<lotuseater> and it's more or less special purpose for handling register machines
<lisp123> shka: or even lisp
<phoe> lisp123: the thing is that our x8664 or ARM machines don't run C or Lisp or whatever other language, they run assembly
<pl> shka: it used to, even beating out C++ (I did a lot eith Delphi)
<beach> lisp123: Even if you meant "a language with the low abstraction level that C has", I am interested in your reasoning.
<shka> pl: yeah, that's the point!
<phoe> and assembly can be generated from lots of languages by compilers written in lots of languages
<shka> turbo pascal was hot stuff at some point
<phoe> and then fed to the CPU, bam, we have useful programs
<lisp123> beach: It was because I assumed people didn't program directly in Assembly, so they used something one level up
<pl> lisp123: btw, it's arguably impossible to write OS in standard-compliant C
<phoe> lisp123: that's the case most of the time
<phoe> but that thing one level up does not need to be C
<shka> lisp123: i mean, you can write lisp in lisp
<beach> lisp123: So now I am interested in knowing why you think a Common Lisp system must have some assembly code in it.
<pl> lisp123: at the very least you end up with A LOT of assembly subroutines
<shka> just like gcc is written in C
<pl> beach: does LAP/VOPs count as assembly? XD
<lisp123> shka: but at some point you have to talk in the language of machines
<lotuseater> starting with the metacircular interpreter :)
<shka> lisp123: listen, language of machines is just vectors of bytes
<pl> lisp123: yes, you can do so through the compiler
<shka> your cpu is not executing C
<shka> it is executing machine code
<beach> pl: I am interested in lisp123's reasoning, because I think there are lots of people out there who does the same kind of reasoning, and I think it is fascinating.
<lisp123> shka: yes but I assume people don't want to write their lisp interpreters in 1s and 0s
* hayley got dangerously close to writing a LAP for Cleavir today.
<shka> which is essentially vector of bytes
<jackdaniel> lisp123: how about writing lisp compilers in lisp?
<lotuseater> hayley: what does LAP mean in this context?
<lisp123> beach: I will give you a timeline of this non scientific thinking
<beach> lisp123: Yes, the code generator of the compiler much generate machine instructions.
<phoe> lotuseater: Lisp Assembly Program
<hayley> lotuseater: Lisp Assembler Program
<pl> beach: I think it's related to memetic "C is close to hw" (very untrue), combined with how bad knowledge transfer is in computing
<beach> lisp123: Is that what you mean?
<shka> lisp123: i think that you are confused about the term "interpreter"
<lotuseater> thx :)
<phoe> hayley: assembly or assembler?
<hayley> Good question.
<shka> perhaps both
<lisp123> if I have file of lisp commands which I need to execute - one needs to convert this to processor instructions right
<beach> lisp123: Yes, the compiler does that.
<lisp123> and what is the compiler written in?
<beach> Common Lisp.
<lotuseater> I'm rather the dumbest person in the room and ask annoying questions than just pretending to know it. or I try to
<lisp123> But how did the computer run the first Common Lisp program
<lisp123> the compiler
<jackdaniel> lisp123: you may write a compiler to arch-xxx assembler in common lisp; what's even more interesting, that compiler may be compiling java to assembly (despite being written in common lisp)
<pl> lisp123: are you bootstrapping from zero?
<lotuseater> and to be honest, form of Assemblers is more close to some kind of lisp when one removes the parentheses
<pl> Because remember, if you want to make an apple pie from scratch, you start by creating the universe
<lisp123> pl: yes, at least from processor instructions to lisp
<beach> lisp123: You cross compile on a different computer, so that a binary for the new computer is generated. Then you transport that binary to the new computer.
<lotuseater> pl: that would be really scratchy :P
<jackdaniel> (what beach said is also done for C compiler ports to new architectures)
<phoe> ah yes, the famous cross-compilation technique
<lotuseater> or with GHC and and and
<tyson2> At my former company, we created cross-assemblers in Lisp for various microprocessors
<lisp123> beach: yes, of course, that's obvious. But to go from scratch to lisp was my point
<jackdaniel> why though?
<lisp123> And I assumed (likely incorrectly) that C helped there
<tyson2> I still have a copy of the 8086 assembler, two pages of lisp
<jackdaniel> do you program C compiler from scratch in 0 and 1?
<beach> lisp123: So we are back in 1957?
<pl> lisp123: you need /something/ to start programming with
<lisp123> jackdaniel: say we have a new super chip from a company called "Orange", M77
<lotuseater> and then one designs special hardware in FPGA and you can run run lisp natively for real
<Josh_2> Afternoon
<lisp123> I was thinking one would write the C compiler first and then the lisp
<hayley> It is not unlikely that the first Common Lisp system was compiled by another Lisp system.
<shka> lisp123: yes, you technically can write lisp (or C!) compiler in assembly
<phoe> I assume that some people are interested in trusting trust and what not, and want to be able to ensure that their software does not have any backdoors compiled in by already existing compiler binaries
<pl> Wurst Kase scenario, you start by low level switch panel and enter bootstrap code you assembled by hand
<lisp123> that was the whole basis of the initial thought
<phoe> so they want to start with 100% source code and no binaries
<hayley> lotuseater: "Good God no, don't do that!" - Cliff Click
<jackdaniel> jackdaniel: then C compiler vendor writes a port for their compiler in C; and Lisp compiler vendor writes a port of their compiler in Lisp (both targetting Orange M77)
<shka> lisp123: are you wondering about the bootstrapping process?
<jackdaniel> then they cross compiler compilers to that machine and poof, each may run natively
<beach> lisp123: No, you would generate an executable on a different system, and then transport that executable.
<jackdaniel> lisp123: ^
<pl> lisp123: but if you are starting from position where other computer exists, you build a cross compilation system that can generate a binary of your compiler for the new chip plus ways to load it
* hayley has memorised only the funny parts of watching too many Java implementation presentations.
<lisp123> beach: but to answer your more general question, its because everyone talks about C - so the conneciton is that C is required at some level. Doesn't mean its the right thinking, but that's what others would be thinking too if I imagine
<lotuseater> beach: I hope you don't get peevish about such phrases.
<hayley> Who is "everyone"?
<jackdaniel> C ABI is present on all major operating systems (Linux, Windows, OSX, even Android)
<shka> lisp123: C is not required, but it is simply very convenient
<lisp123> shka: yes you could say that. If its a brand new chip with brand new instructions, how woulod you do it?
<shka> now, that is interesting question!
<lotuseater> hayley: if I would be able doing VHDL or Verilog some day ... you can get cheap open hardware boards by OLIMEX with also an open toolchain
<pl> lisp123: I'd write a compiler backend for SBCL, then follow its cross-compilation mechanism?
<phoe> lisp123: use an existing compiler, write a new backend for it
<phoe> then copy the resultant binary to the new machine
<pl> (not too specific)
<shka> lisp123: ok, so here is how this works
<hayley> lisp123: I would modify the backend of a compiler to emit code for that instruction set, and have it compile itself.
<lisp123> and that would be written in lisp?
<phoe> that can be written in anything
<shka> lisp123: ok, let's go back to basics
<phoe> a compiler is just a program
<beach> This is fascinating stuff.
<phoe> it eats source code and spits out some binary blobs
<shka> so on the cpu, you gonna need a specific vector of bytes to execute
<shka> it will be different on different instruction sets
<lotuseater> lisp123: you can if you would like, also imagine lisp macros as little compilers
<phoe> the interesting stuff is that a compiler can spit out amd64 blobs even if it is not running on an amd64 machine
<phoe> do you know how this works?
<shka> however, compilers are usually separated into few parts, and one of those is the code generator
<phoe> or how that is possible?
<lisp123> lotuseater: thanks, makes sense
<shka> and if you wanna support new instruction set, optimistically you need to make a new code generator
<lisp123> shka: ok that makes sense
<lotuseater> hayley: oh damn. but I must watch later, about to going out
<hayley> Rather just make a nice instruction set that is easy to compile to. David Ungar and David Patterson's Smalltalk on a RISC went down the same way, and the LMI K machine would have: http://fare.tunes.org/tmp/emergent/kmachine.htm
<lisp123> So basically we don't need anything other than Lisp, thats good to know :D
<phoe> lisp123: in theory the same goes for any Turing-complete language
<shka> but you can still use your parser, some optimizers and everything else which is portable across architectures
<beach> lisp123: And that is what I fully intend to pull off with SICL, which is why I teased you with that in the beginning.
<phoe> it's just a matter of what is the most convenient to use
Bike has joined #commonlisp
<shka> and obviously, since we are still talking about vectors of bytes, sure, you can generate those vectors let's say on the x86 PC for the ARM linux machine
<shka> no problem
<lisp123> yes that makes sense
<shka> i mean, in theory, sometimes it gets tangled in a technical details
<lisp123> beach: so will you have something that converts lisp to machine code?
<shka> lisp123: that is called a compiler
<lisp123> as in new machine code
<beach> lisp123: Yes, what shka says. It's the compiler.
<beach> lisp123: Yes, the code generator of the compiler spits out native instructions.
<lisp123> nice
<beach> lisp123: So hayley is working on the "register allocator", and next is the "code generator".
<hayley> lotuseater: If I had a FPGA and a lot of time, I'd build a relatively boring RISC, but one I knew how to compile to easily, and with some more subtle tricks like read and write barriers in hardware.
<beach> lisp123: But that's nothing new. SBCL does that as well.
<lisp123> beach: that makes it very cool because its no longer dependent on any other programs or lisp
<lisp123> I assumed there was some C somewhere
<beach> There is in SBCL, but very little, and nothing in the compiler I think.
<lisp123> but I guess when you put it in terms of creating machine instructions directly from lisp (for new processors), it makes sense
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
<lisp123> existing processors I never had an issue with, because one already had the binaries
<beach> lisp123: Good that we finally sorted out that issue.
<shka> (SBCL has C for garbage collection, this could be technically be done in lisp, but it would make it more difficult AFAIK)
<beach> Again, fascinating stuff.
<shka> lisp123: remember, CPUs are stupid, they just talk in vectors of bytes
<lisp123> Wonder why GNU Mes is using C?
<beach> lisp123: And, as other pointed out, Mezzano is a complete Common Lisp system and an operating system, entirely written in slc.
<beach> in Common Lisp
<lisp123> They should've just done it all in Scheme or Guile or whatever
<phoe> lisp123: it says GNU in the name, tons of gnu utils are written in C since that is what was popular in their circles
<shka> (CPUs essentially do very simple stuff, very, very, very quickly)
<beach> lisp123: The thinking that it took half an hour or so for you to accept is pervasive.
<phoe> but that's just a history tidbit and might not be 100% true
* hayley wonders what abbrev slc is a typo of. No obvious characters nearby on this keyboard.
<lisp123> shka: indeed :)
<lisp123> phoe: Thanks
<beach> hayley: "cls" is my abbrev for "Common Lisp"
<phoe> SLC = Simple Lisp Compiler, beach's new project to each compiler basics as well as lisp basics to new people
<Xach> catastrophic dabbrev failure
* phoe ducks
<shka> lisp123: well, the historic goal of GNU was to replace the unix with open source copy
<phoe> s/each/teach/
<shka> and unix is written in C mostly
<shka> so perhaps this is the explanation
<lisp123> shka: thanks
<shka> don't quote me in on that, i am not well versed on the gnu history
<lisp123> beach: and that's where you will find a lot of us assuming C is omnipresent everywhere (to your earlier question)
<shka> lisp123: yeah, the omnipresence in the strongest side of C
<beach> lisp123: Yes, but I am interested in how the thinking goes.
<shka> but notice that it has little to do with the design of the language
<shka> and everything with the huge success of unix which spread C all over the computers
<shka> but, for instance, the OG apple macintosh
<lisp123> beach: C is systems language -> C is fast -> Other languages slow (C is "closest to the metal" -> Other languages written in C -> OK we understand stuff can get compiled to binary -> some fuzzy autocomplete -> C is required somewhere to write compilers for other languages because its fast
<shka> IIRC the operating system for this machine was more pascal
<lisp123> doesn't sound great when writing it down, but I wouldn't be suprised if many thought the same way
<shka> lisp123: C is not fast, it does not make your computer to execute more intructions per second
jimka has joined #commonlisp
<phoe> lisp123: "C is systems language" sounds like "C is THE systems language"
<phoe> which is, eh
<nij-> Anyone knows how C deal with UNIX sockets natively? I wonder why CL needs to go through it in order to take control..
<nij-> Like.. what's preventing me from dealing with UNIX sockets directly using Common lisp?
<phoe> nij-: you mean network or local ones?
<lisp123> shka: nice, did you have one?
<nij-> local ones, file based
<nij-> We have one here, but it's using CFFI and C https://github.com/tdrhq/cl-unix-sockets/blob/master/unix-sockets.lisp
<lisp123> shka: some people seem to think one can do special tricks with C
<shka> nah, i am from poor eastern country, at the time zx spectrum was the high point of computer freak aspirations
<shka> well, commodore as well
<Bike> nij-: operating systems have system functions that you can call, such as socket(2)
<lisp123> which makes it closer to assembly / coding directly in machine language
<Bike> nij-: the lisp compiler needs to be aware of how to call them, but it's doable, and i think SBCL has direct system calls for some things
<shka> lisp123: you can't do anything, because it boils down to the fact that the only thing which C is
<shka> is the description of how to generate machine code
<shka> it is not like your computer be able to do anything different if you use C
<Bike> i'm not sure if syscalls are part of the posix standard or what
lotuseater has quit [Quit: ERC (IRC client for Emacs 27.2)]
<shka> however some of the C programmers know the compiler really, really well and they KNOW what kind of machine code should be expected from the C code they wrote
<beach> lisp123: Thanks. I am interested in how the reasoning goes, because it is responsible for a lot of unnecessary maintenance requirements.
<Bike> i think the system calls are in general not stable compared to libc, so going through libc is easier maintenancewise
<shka> this is partially because those programmers put enough of time to get good at it, and partially because C is thin abstraction compared to let's say Common Lisp
tfeb has joined #commonlisp
<nij-> Bike: Oh, so it's possible? And the reason why C seems to be a better language for this job is that there are many libs to interact with the system functions already?
<nij-> And also, C has prevailed. So it's actually better for me to call C for maximal portability?
<Bike> that is basically my understanding
<hayley> beach: I've seen two people think that C is only worth mentioning because of imagined popularity and influence.
<Bike> and of course operating systems commonly present a C API
<beach> The problem with C as a low-level language for writing things like operating systems, though, is that such a system requires code that has undefined behavior according to the C standard, so you have to write for a particular version of a particular compiler.
<shka> lisp123: regardless, in other world Pascal (for instance!) would be the system language and C would be this obscure language of historical significance
<nij-> Cool
<beach> hayley: Here?
<hayley> Not to say people don't use C, but it's not the damn "backbone of the internet" or "modern" computing or so on.
<lisp123> shka: is Pascal more of an abstraction than C? Because that would imply it would be a bit harder to get the same performance out of it?
<hayley> beach: Not here, no, just anywhere on the Internet.
<beach> I see.
<shka> i would rather not discuss Pascal here :D
<shka> lisp123: but my point is, C is not unique as a language, it is the historical background which made it so relevant as it is today
<hayley> Though amusingly someone at my old university took a look at an uncited programming language popularity list, added up usage of C and C++ (claiming the latter was a superset of the former) and proclaimed it even more popular than Java.
<shka> lisp123: one should not confuse the technical side of programming with sociological and historical surroundings
<lisp123> shka: that makes sense
<shka> to be fair it is easy to get confused because computer history is not accessible subject
<shka> AFAIK there is no handbook that would explain "How we got here"
<shka> and trying to figure out when certain language features where invented is sometimes just impossible
<shka> for instance when were docstrings invented?
<lisp123> Yup, and everything contributed to each other - its a shared struggle of progress
<shka> but this is offtopic
<hayley> Clearly Python invented docstrings. :)
<shka> clearly
<hayley> Though I could imagine they invented the shortening of "documentation string" in a more formal setting.
<shka> lisp123: i hope that you are less confused when you were before
<lisp123> shka: a little better thanks. I know now lisp is fully free and independent :)
<shka> well, same goes for other languages
<shka> like for instance Golang
<beach> lisp123: That kind of thinking leads to increased maintenance because some people think you need to write a Common Lisp system in layers, starting with CAR/CDR, and then each new module must use only the subset provided by previously defined modules. Even the SBCL compiler does not use generic functions and standard classes for instance.
<lisp123> beach: yes, its not a practical thought. I suspect it might be because Lisp programmers like to build their programs up, and hence would like the the underlying compiler to do the same
vats has quit [Ping timeout: 272 seconds]
<hayley> I don't build from mere cons cells though.
<beach> lisp123: Well, in the case of SBCL, it is that CLOS is added last, because SBCL (or CMUCL) was started before CLOS was part of the standard, so for such systems CLOS is "bolted on" at the end.
<phoe> build our programs up?
<phoe> hmmm
<phoe> I thought it's more like adding more mud to a ball of mud
<phoe> and then you just split it in half and reshape into two balls of mud
<tfeb> but the ball of mud was once a mud atom
<phoe> it was once a ship of theseus but the wood got rotten real bad
<contrapunctus> lol
<hayley> But, if you play it right, you can implement Lisp with all of Lisp. However, you cannot build your new program with another implementation of it.
<shka> we are all slaves to the history :P
<tfeb> ... or at least some claim so. Pretty sure there was always just mud
<hayley> So I believe language implementation is very different to implementing a typical program.
<beach> I have thoughts about creating an industry talk entitled something like "n psychological forces that decrease your productivity in developing software", and this "bootstrapping" thinking should be part of it.
<tfeb> hayley: for me as a lisp hacker, language implementation and programming are the same thing
<hayley> tfeb: If you want to phrase it that way, then with a program, you have no other implementation to borrow while building. But with a metacircular implementation, you can borrow the old implementation while you work your way to completion.
tyson2 has joined #commonlisp
<hayley> There is a lot of handwaving in that phrasing, but either case requires a different strategy to me.
<tfeb> that's not what I meant: I think of my (nontrivial) programs as languages which extend CL. There's usually no metacircularity because
<tfeb> s/because//
jimka has quit [Ping timeout: 258 seconds]
selwyn has joined #commonlisp
<contrapunctus> beach: hey ^^ I tried to approach my project in a way that avoids the need for sandboxing, but got frustrated with it. I'd like to see if I can help make CL-implementation-independent sandboxing a reality. What does it involve doing? Can someone with no experience in Lisp implementation do it?
davep has joined #commonlisp
<flip214> contrapunctus: if you only allow functions (and macros) within one package, and that package doesn't include OPEN, RUN-PROGRAM, etc., then no external access is possible.
<phoe> contrapunctus: CL is a hard language to sandbox in the general case
<phoe> if someone gains access to the COMMON-LISP package then you are toast
<contrapunctus> flip214: CL packages? I thought it was possible to override them with package::symbol 🤔️
<phoe> not only becaue you have unrestricted EVAL, but also because you can destroy memory safety via e.g. RESTART-BIND and other DYNAMIC-EXTENT stuff
peterhil has joined #commonlisp
<tfeb> If you wanted a sndboxed lisp I don't think you'd start from CL unless you had to.
<phoe> see e.g. (flet ((fireworks () (restart-bind ((fireworks (lambda ()))) (compute-restarts)))) (print (fireworks))) on SBCL
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
<flip214> contrapunctus: If you read an external file, you can either make #\: an error, or just check the input for the symbols used.
<hayley> (funcall (intern "RUN-PROGRAM" "SB-EXT") ...)
<contrapunctus> flip214, phoe, tfeb: to be clear, I was implicitly referring to beach's work on first-class global environments. He has mentioned on many occasions its potential for use in sandboxing.
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #commonlisp
cosimone has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
jimka has joined #commonlisp
<flip214> hayley: well, INTERN must not be allowed, of course. Or FIND-SYMBOL.
<tfeb> or format, or ...
lisp123_ has joined #commonlisp
<beach> contrapunctus: It is already possible with SICL first-class global environments, but I have not written any documentation meant for that purpose.
lisp123 has quit [Ping timeout: 250 seconds]
tfeb has quit [Quit: died]
<contrapunctus> beach: you mean, in an implementation-portable way? I was under the impression there was work to be done before that was possible ._.
<beach> contrapunctus: I do that on a daily basis when I run the bootstrapping script for SICL. It has to execute code that is totally separate from the host code. It works in any Common Lisp implementation, provided it also has CLOSER-MOP.
<hayley> It is possible to mechanically rewrite Common Lisp code to use first-class global environments.
cage has joined #commonlisp
<beach> contrapunctus: What hayley says. The way we do it is we take the Cleavir-based compiler and translate the code to ASTs. Then we translate the ASTs back to Common Lisp, but with every reference to a function or a special variable replaced, so that it refers to the first-class global environments instead.
<beach> The Cleavir-based compiler is non-trivial of course, but it exists, and it seems to do the job. The inverse translator is pretty trivial.
<beach> This way, you can put in the first-class global environments what you want exposed to the code, and nothing else.
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
Inline has joined #commonlisp
<nij-> Hello! #'flexi-streams:string-to-octets transforms string of latin chars to a vector of octets. But my strings could contain other things.. is there nice transformer for general strings?
<nij-> (I want to later transform it back too.)
cosimone has quit [Read error: Connection reset by peer]
<hayley> babel:string-to-octets
<hayley> However, you could specify another encoding by e.g. :external-format :utf-8 for either function. The latter will most likely default to some Unicode though.
jimka has quit [Ping timeout: 250 seconds]
cosimone has joined #commonlisp
lisp123 has joined #commonlisp
nirnam has joined #commonlisp
lisp123_ has quit [Read error: Connection reset by peer]
dnaeon has joined #commonlisp
waleee has quit [Ping timeout: 256 seconds]
notzmv has joined #commonlisp
<dnaeon> Hey Lispers! Is there a way to inspect the condition within a `restart-case' in case I need to provide more details to the user when an error is signalled. A use case would be to inspect the condition instance and change the prompt accordingly? For example `(restart-case (something-that-errors-out) (restart-A () ..) (restart-B (CONDITION) ...))` . How do I make restart-B accept an instance of the respective condition?
<Josh_2> (restart-b (c) :report "blah blah" (do-something-with-condition))
<Josh_2> c being the condition
<pjb> dnaeon: you can pass the condition to the restart case: (restart-case (handler-bind ((error (lambda (condition) (inspect condition) (invoke-restart 'restart-B CONDITION)))) (something-that-errors-out)) (restart-A (arg) ..) (restart-B (CONDITION) ...))
<pjb> dnaeon: but the idea is to inspect the condition in the handler, and to give the restart only the data it needs to perform the restart.
<pjb> Of course, it would be silly to unwrap a rich condition into another object just to pass it to the restart. In that case you can just pass the condition to the restart.
<yitzi> Adding to pjb, by itself restart-case or restart-bind won't do this. The lambda of each restart comes from invoke-restart or the interactive invoke. The condition is not included in the interactive invoke.
<nij-> hayley: <3 thanks!
<dnaeon> pjb: I had the same idea about using `handler-bind' within a `restart-case', but wasn't sure whether this is idiomatic approach or not, so I abandoned that idea quickly.
<pjb> It is the tool. Don't think in terms of idioms, think in terms of tools.
<pjb> If you have conditions, handler-case and handler-bind are the tools.
<yitzi> dnaeon: You could also bind a dynamic variable to the current condition. This would make invoke-restart-interactively work without the condition in the lambda list.
<dnaeon> pjb: yitzi: thanks!
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #commonlisp
vats has joined #commonlisp
<nij-> Hmm.. I can't spot why there's a type error in -
<nij-> (SB-KERNEL:CHECK-TYPE-ERROR VECTOR #(51 50 49) (VECTOR (UNSIGNED-BYTE 8)) NIL)
<nij-> Here's the code that caused the problem: https://bpa.st/NMBA
ggoes has quit [Changing host]
ggoes has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
<nij-> Notice that I have (apply #'vector [elided]) to transform the input to a vector of octets.
lisp123 has joined #commonlisp
silasfox has quit [Ping timeout: 258 seconds]
<beach> nij-: Specialized vectors are created as such and do not become such as a result of the elements in them.
<Bike> nij-: babel wants a vector specialized to unsigned-byte 8. the function VECTOR returns a general vector, specialized to type T
<mfiano> (coerce result '(vector (unsigned-byte 8)) instead
<mfiano> (of apply)
lisp123 has quit [Ping timeout: 258 seconds]
<beach> Bike: So does that mean that it relies on the implementation having such a vector type?
<beach> ... because those are not required by the standard as I recall.
<Bike> i assume not, because if the implementation doesn't support that specialization it's impossible to refer to it
<Bike> yeah it just does (check-type vector (vector (unsigned-byte 8))) and stuff
<beach> I see.
yitzi has quit [Quit: Leaving]
<nij-> mfiano: Works for latin chars, but not for UTF-8 @@
srhm has joined #commonlisp
<mfiano> You should read the babel documentation for that function
<nij-> I mean (babel:octets-to-string (babel:string-to-octets "🐖")) does return the emoji.
<nij-> So I suppose that's not a problem with babel.
<jcowan> The idea of Mes is that if you have either a C compiler or a Scheme interpreter that you trust, you can build (forked) tcc, and from that you can build an old version of gcc, and from there to anything you want. It minimizes the TCB.
<jcowan> And because both parts of Mes are pretty easy to understand, you can eyeball them without turning green and yellow.
<nij-> Moreover, (babel:octets-to-string (coerce (babel:string-to-octets "🐖") '(vector (unsigned-byte 8)))) also returns the correct emoji.
<Bike> string-to-octets probably returns a (vector (unsigned-byte 8)), so the coerce is a no-op
<nij-> Yeah, but even without that it works fine. Hmmm
<Bike> yes, that's why i said that
<Bike> string-to-octets takes an encoding argument. that is probably what mfiano is referring to
<Bike> (i don't actually see a docstring, tho)
<Josh_2> By default it its :utf-8
<mfiano> Well you are reversing the octets before decoding them to a string, but I don't know what you are trying to do
<nij-> OH!
<nij-> I see. Lemme fix that.
<mfiano> It's probably not very efficient to not chunk them anyway
<mfiano> byte for byte can't be great
dnaeon has quit [Quit: EOF]
<nij-> Oh.. it works :)
peterhil has quit [Ping timeout: 252 seconds]
notzmv has quit [Ping timeout: 272 seconds]
lisp123 has joined #commonlisp
icer has joined #commonlisp
jimka has joined #commonlisp
jimka has quit [Ping timeout: 240 seconds]
_dave has joined #commonlisp
cosimone has quit [Ping timeout: 256 seconds]
<sterni> are the gcl.tar.gz actually the ANSI standard or just some subset of it?
<sterni> (the info files)
<beach> Where is that file?
jimka has joined #commonlisp
<beach> Or those files.
<beach> The "gcl" suggests a particular implementation.
lisp123 has quit [Ping timeout: 258 seconds]
<sterni> seems to me that the GCL ppl just converted it similar to how the hyperspec was made, thought maybe somebody here knows the backstory
<beach> I think it is for GCL, and has nothing to do with the standard.
<beach> Oh, you may be right.
<sterni> “The third info file gcl details the Ansi standard for common lisp, to which this subset tries to adhere.”
<beach> I wonder what they used as source then.
lisp123 has joined #commonlisp
<sterni> ah, likely it's the draft ANSI standard and not the real one
<sterni> so 1984 I guess?
<beach> sterni: The dpANS is nearly identical to the standard.
<beach> sterni: In fact, the standard can only be had as a bad photocopy. ANSI apparently lost the source files.
icer has quit [Quit: WeeChat 2.9]
<sterni> lol
<mfiano> Why are you interested in GCL?
selwyn has quit [Read error: Connection reset by peer]
<shka> jesus
<shka> ANSI loosing documents
<shka> are you kindding me?
<sterni> mfiano: I was mostly interested in the info version of the draft tbh
<sterni> but now I'm kinda interested in GCL I wasn't aware it existed
<mfiano> I see. I don't know if GCL will ever be a conforming implementation.
<sterni> is it even active anymore?
<mfiano> I think it gets like a small commit per year or something last I checked
<mfiano> It is quite active lately
<sterni> interesting, maybe I should play around with a version from git
<pjb> mfiano: it could become, with some work.
<pjb> FSF would be happy.
<pjb> In the meantime, we use ecl which is similar and conforming.
<pjb> There's a compiler in ecl that generates C code compiler with gcc.
makomo_ has joined #commonlisp
makomo has quit [Ping timeout: 240 seconds]
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
jimka has quit [Ping timeout: 258 seconds]
<pl> shka: or they lost build env
<MichaelRaskin> Losing assumes they have _ever_ cared about the sources
yitzi has joined #commonlisp
dnaeon has joined #commonlisp
<jcowan> Often enough the "source" is just a paper document produced on a typewriter.
<MichaelRaskin> Where «enough» is «enough to ANSI to have workflows assuming this is always the case»
jimka has joined #commonlisp
<jcowan> Whenever there's an ECMA standard, I always use it (freely available0
dnaeon has quit [Changing host]
dnaeon has joined #commonlisp
<jcowan> )
dnaeon has quit [Client Quit]
dnaeon has joined #commonlisp
dnaeon has quit [Changing host]
dnaeon has joined #commonlisp
dnaeon has quit [Client Quit]
dnaeon has joined #commonlisp
<sterni> how can they even sell it if they don't have the sources
<sterni> I guess they haven't lost the ps
<sterni> or the first pressing never sold out
<jcowan> No, what they've got is paper, and they photocopy that and send you the copy.
<sterni> is that true
<shka> pl: still, keeping those things accessible is part of the job description
<shka> would WSCL be published under CC?
<lisp123> I have a copy of the ANSI Standard
<lisp123> Or at least I assume I do
<lisp123> I bought it off the ANSI website
amb007 has quit [Ping timeout: 258 seconds]
amb007 has joined #commonlisp
<jcowan> I was slightly wrong: your US$60 gets you a PDF of the crappy photocopy
<lisp123> Yes, its a photocopy
<lisp123> Someone could probably OCR it
karlosz has joined #commonlisp
peterhil has joined #commonlisp
<lisp123> This is a reference document, not a tutorial document. Where possible and convenient, the order of presentation has been chosen so that the more primitive topics precede those that build upon them; however, linear readability has not been a priority.
<lisp123> Not that bad of a copy, can copy/paste pretty easily without errors (example above)
lotuseater has joined #commonlisp
<lotuseater> hello there :)
<Josh_2> Hi hi
<lotuseater> hope I didn't miss something interesting the last hours when topic was on compilation
<lotuseater> hayley: what was the time point at the Java on 1000 cores talk you linked me?
peterhil has quit [Ping timeout: 252 seconds]
jimka has quit [Ping timeout: 272 seconds]
PinealGlandOptic has left #commonlisp [#commonlisp]
attila_lendvai has joined #commonlisp
cosimone has joined #commonlisp
peterhil has joined #commonlisp
dnaeon has quit [Ping timeout: 252 seconds]
<phoe> dnaeon: still need some restart help?
lotuseater has quit [Quit: ERC (IRC client for Emacs 27.2)]
davep has quit [Quit: Connection closed for inactivity]
peterhil has quit [Ping timeout: 258 seconds]
waleee has joined #commonlisp
Catie has joined #commonlisp
nij- has quit [Ping timeout: 258 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
amb007 has quit [Ping timeout: 245 seconds]
amb007 has joined #commonlisp
karlosz has quit [Quit: karlosz]
<shka> phoe: hey, did you got my email?
<phoe> shka: yes, thank you
<phoe> I collected it, just didn't acknowledge it yet
<shka> ok, great
<shka> good night!
<phoe> nini
gaqwas has joined #commonlisp
makomo_ has quit [Ping timeout: 252 seconds]
cosimone has quit [Remote host closed the connection]
gin has left #commonlisp [#commonlisp]
tfeb has joined #commonlisp
dnaeon has joined #commonlisp
dnaeon has quit [Changing host]
dnaeon has joined #commonlisp
tfeb is now known as tfb
JoshYoshi has joined #commonlisp
JoshYoshi has quit [Remote host closed the connection]
Josh_2 has quit [Ping timeout: 272 seconds]
lonjil2 is now known as lonjil
tyson2 has joined #commonlisp
<phoe> minion: memo for rpg: UIOP:DEFINE-PACKAGE docstring does not mention :MIX-REEXPORT or :USE-REEXPORT. Is that expected?
<minion> Remembered. I'll tell rpg when he/she/it next speaks.
pve has quit [Quit: leaving]
selwyn has joined #commonlisp
dsk has joined #commonlisp
tfb has quit [Quit: died]
rain3 has quit [Ping timeout: 258 seconds]
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
jimka has joined #commonlisp
cosimone has joined #commonlisp
raeda has joined #commonlisp
cosimone` has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
cosimone has quit [Ping timeout: 258 seconds]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
asarch has joined #commonlisp
victor has quit [Ping timeout: 272 seconds]
splittist has quit [Ping timeout: 240 seconds]
hubvu has quit [Ping timeout: 240 seconds]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
jimka has quit [Ping timeout: 258 seconds]
asarch has quit [Quit: Leaving]
dnaeon has quit [Ping timeout: 250 seconds]
waleee has quit [Quit: WeeChat 3.2]
makomo_ has joined #commonlisp
waleee has joined #commonlisp
jimka has joined #commonlisp
shka has quit [Ping timeout: 272 seconds]
akoana has joined #commonlisp
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Client Quit]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
splittist has joined #commonlisp
yitzi has quit [Quit: Leaving]
lisp-newbie has joined #commonlisp
jimka has quit [Ping timeout: 250 seconds]
lotuseater has joined #commonlisp
selwyn has quit [Quit: Leaving]
hubvu has joined #commonlisp
victor has joined #commonlisp
jimka has joined #commonlisp
<lotuseater> good evening
lisp-newbie has quit [Quit: This computer has gone to sleep]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
santiagopim has quit [Remote host closed the connection]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
santiagopim has joined #commonlisp
cosimone` has quit [Remote host closed the connection]
gaqwas has quit [Ping timeout: 258 seconds]
<copec> Now stylewarning, tell me you know the answer and that it was rhetorical https://twitter.com/stylewarning/status/1423353749850845186
jimka has quit [Ping timeout: 258 seconds]
hafat has joined #commonlisp
Inline has quit [Quit: Leaving]
jimka has joined #commonlisp
pillton has joined #commonlisp
tankrim has joined #commonlisp
<tankrim> In the incomplete (in-package :a) (defun foo () (format t "~&package: ~A" _)) (in-package :b) (defun bar () (format t "~&package: ~A" _) (a:foo))
<tankrim>
<tankrim> How can I make it so that calling BAR while in "B" prints one message with "package: A" and one with "package: B"? All my attempts end with both having either "A" or "B". Sorry if I'm not clear.
<_death> why would it print "package: A" if *package* is bound to the package named "B"?
<_death> you could do something like (if (eq *package* (find-package "A")) "B" "A") of course, but it's not clear what you really want to do
<tankrim> _death: that's kinda my point. This is really about logging, and I would like for logged functions to report their home package in the log message.
<tankrim> regardless of the package they're used in
<_death> functions don't have anything to do with packages
<tankrim> right, symbols
<Catie> *PACKAGE* has dynamic scope, not lexical scope if I'm not mistaken
<Bike> (let ((*package* (find-package "KEYWORD"))) (format t "~a" 'foo))
<Bike> hm... or does that work...
<_death> maybe you want the package name of the symbol FOO
<_death> *of the home package of FOO
<_death> like (package-name (symbol-package 'foo))
<tankrim> _death: I think that may be what I want
<tankrim> thank you, I'll experiment some more
<_death> if you want a fully qualified symbol, Bike's solution should work (except maybe "~S" should be used)
jimka has quit [Ping timeout: 240 seconds]
dsk has quit [Ping timeout: 258 seconds]
lisp-newbie has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
jimka has joined #commonlisp
<lisp-newbie> I want to have something like (make-instance 'class-name var and then the list of key value pairs :key value)
<lisp-newbie> oy
<lisp-newbie> lost the whole write up
<lisp-newbie> Hi, if I have an association list, and I want to instantiate an object where I want to check if the key is a slot in the object, and if so, use it as part of the instantiation process. Is there an easy way to do this programatically for any class I may give and any list of key value pairs?
<lisp-newbie> I want to have something like (make-instance 'class-name var and then the list of key value pairs :key value)
jimka has quit [Ping timeout: 240 seconds]
<lisp-newbie> that make-instance would be the outcome, it would be some (defun instantiate-from-assoc (class-name assoc-list) (some-magic (make-instance ...)))
<lisp-newbie> I googled a lot and couldn't find so many ideas. I'm trying with mopp:class-slots but I don't know what to do with the result
<Xach> lisp-newbie: if you change the spec a little it's feasible.
<Xach> but maybe that would not be helpful.
<Xach> if you change it so that "keys name initargs for slots", you can convert the alist to a plist and apply make-instance with allow-other-keys along with the resulting plist.
<lisp-newbie> I'm basically getting an assoc key value par list from the server, and I want to use it to instantiate my objects, so that I don't have to hand write for every class a mapping
<lisp-newbie> Xach I have no idea what you just said, it flew over my head a little bit. Is allow-other-keys meaning ignore the extra keys? or instantiate them into the object regardless?
<Bike> xach is just saying that you could require initargs rather than slot names. like if you had (defclass foo () ((bar :initarg :bar))) your alist could be ((:bar . 7)), rather than ((bar . 7))
<lisp-newbie> init args are the default values?
<Bike> in which case you could skip mop entirely and do (apply #'make-instance class :allow-other-keys t (plist-to-alist plist))
<Bike> initargs are what you specify with :initarg in the slot description
<lisp-newbie> Bike thanks, understanding now
<Bike> like you'd make a FOO with (make-instance 'foo :bar 7)
<lisp-newbie> reading slowly what you write to understand
rgherdt_ has quit [Ping timeout: 258 seconds]
<Xach> you could also have initargs that are plain, not keyword, symbols, if that helps. or convert the keys to keywords. there are many ways to do what you want even before you dig into MOP.
<Bike> i was gonna start explaining slot-definition-initargs and stuff but this is a much easier path
<lisp-newbie> thanks, yeah. I could just add a colon to the string and somehow turn it into a symbol?
<Bike> i meant (alist-to-plist alist). excuse me
<Bike> you have strings?
<lisp-newbie> Yeah, ("world" . 26)
<Bike> in that case you could do (intern string "KEYWORD") [or whatever package you put the initargs in]
<Bike> and you'd have to upcase them probably
<lisp-newbie> Sometimes there are embedded objects like ("hello"
<lisp-newbie> ("world" . 26))
<Bike> shouldn't matter
<Bike> well, unless you want those inner objects to also get make-instance'd, maybe i'm misunderstanding
<hayley> lotuseater: The link has a timestamp, but it is 20:13 or so.
<lisp-newbie> if there's an inner object, I will probably check and want to run the method for that class as well
<Bike> might also want to keep in mind that make-instance and such can have methods defined on them that can do literally anything, so in general passing unvetted data from the internet may be unsafe
<lisp-newbie> before\
<lotuseater> hayley: I'm now back home on the other machine and the tab was still open, thx anyway, I'll start watching in some minutes.
tyson2 has joined #commonlisp
lisp-newbie has quit [Quit: This computer has gone to sleep]
makomo_ has quit [Ping timeout: 258 seconds]
kakuhen has joined #commonlisp
random-nick has quit [Ping timeout: 240 seconds]
jimka has joined #commonlisp
<mfiano> A Common Lisp book I had never heard of was recommended to me today. It should be part of my collection soon :)
<sm2n> mfiano, what book?
<mfiano> Building Problem Solvers
<sm2n> oh, looks interesting
<sm2n> do you know how it compares to PAIP in terms of material
<sm2n> ?
<mfiano> Nope
<lotuseater> good tip
srhm has quit [Quit: Konversation terminated!]
<mfiano> Got it because it explains "truth maintenance systems", which is used by propagation networks as described by one of Sussman's students in their dissertation, of which is the origin of the brief overview in Sussman's new book
<lotuseater> one friend once told me at work they do things with this CLIPS for building expert systems
<sm2n> I see
<Xach> mfiano: the student's handle is "axch" and it caused me a little confusion sometimes
<Xach> like "axch is going to be at the boston lisp meeting this month" and i thought in my hubris it was a typo and meant me
<mfiano> Xach: Ha, really?
<mfiano> Alexey Andreyevich Radul is their name
srhm has joined #commonlisp
<Xach> axch@mit.edu
<mfiano> Ah yes, that's the same person
<Xach> I really enjoyed his presentation back in the day
<mfiano> Also, I must say I'm not a huge fan of Sussman's new book, but it did get me to further research some of these ideas I wasn't too familiar with.
<mfiano> I think the book is not very clear in conveying its ideas or describing the code fragments, and it's hard to tell if some function is yet to be described, elided, or a builtin of MIT Scheme, the dialect they chose.
<mfiano> But I did enjoy it somewhat in that it got me thinking differently
_dave has quit [Read error: Connection reset by peer]
lisp-newbie has joined #commonlisp
<Bike> yeah, there's definitely some code missing. might make more sense if i download it as the appendix mentions i can do
<Bike> but that's somewhat inconvenient
jimka has quit [Ping timeout: 258 seconds]
<mfiano> I struggled early on in the "layered data" code that makes use of a BUNDLE macro, and is used in later chapters too, but is not defined anywhere, and could not find it anywhere in MIT Scheme (I was following along with Guile).
<mfiano> Maybe it's just me missing something obvious though, but there were other points of great confusion too
<Bike> no, i think you're right