freenode/#lisp - IRC Chatlog
Search
10:41:28
loke
But I find the whole idea to be rather strange. Surely just not defining a writer method is signal enough that the instance isn't meant to be changed.
11:59:14
phoe
beach: Can protocols depend on each other? I have protocols FOO and BAR, where FOO has an operation FROB and BAR has an operation SCER; SCER calls FROB as a part of its operation.
12:00:05
phoe
Does it mean that both of these protocols should be merged into one, or is such a "dependency" okay?
12:20:30
phoe
There are exceptions to this, for example, Roomba was written using a subset of Common Lisp that was then compiled to code that ran on microcontrollers.
12:21:26
phoe
Low-level hardware stuff is doable. But then again, define "low-level hardware stuff".
12:24:30
beach
phoe: "operation" in this context means roughly "a function". You used it "for its operation" which suggests that it is doing something.
12:24:55
phoe
tetero: grab VirtualBox, download the latest demo (third one I think) and go play Quake-on-a-Lisp.
12:25:26
tetero
phoe: Since your talk of CCFI, I got a bit curious as to the more unusual uses of Lisp. Ran into GOAL/GOOL which, while not Common Lisp, is a pretty cool example of what you /can/ do
12:27:15
phoe
tetero: well, CFFI makes it easy to create a REPL in which you can poke/peek arbitrary bytes of memory - kind of like it was back in the days of simple computers like Apple 2
12:27:18
schweers
I know people who love doing low-level stuff and even I can sometimes get a rush out of doing things at a low level
12:28:46
phoe
beach: I am confused now. Yes, I wrote, "for its operation" - I think that MOP contains parts like this, where a description of function FOO has a phrase that under some circumstances function FOO will call function BAR.
12:30:06
schweers
I’m always sad when I see something like mezzano, because I know I’ll never be able to use it for real :/
12:31:01
phoe
you don't know what future brings, and if Mezzano got it to this level from pure scratch, then it can go from this level to be much more usable
12:31:50
schweers
I just fear that it will never have enough software because people will be scared of it
12:33:19
phoe
tetero: I think you can check the git logs for who contributes there, or how many contributors there are in total with how many commits.
12:34:40
schweers
do you know off the top of your head how they got quake and doom (i.e. existing applications) to run on mezzano? I’m guessing some sort of emulation or compatibility layer
12:35:56
schweers
um … they translated the C code to CL? but still, I’m wondering because of all the APIs these programs use (for instance opengl)
12:36:33
tetero
Damn. I'm looking at the Mezzano contributors, and while it has 8 contributors, almost all code is written by one guy
12:37:07
tetero
Not to take away from froggey, but it definitely flexes some of lisps muscles in output if one knows it well
12:39:17
tetero
phoe: It seems to give you plenty of rope that you can either use to do something great, or hang yourself with
12:39:52
phoe
While I do it for my own purposes, as in, I'm trying to grasp and understand what protocols are and aren't, I kind of hope that I'm also asking questions difficult enough to cover some corner cases in your chapter about protocols.
12:40:32
schweers
I can’t help it, but I don’t think that lisp makes it particularly easy to hang oneself with, unless performance is particularly relevant
12:40:37
phoe
Like this thing right here, about protocol descriptions mentioning calling other operations.
12:42:58
schweers
although lisp programs can become anbearibly slow if one doesn’t know what one is doing
12:43:55
tetero
phoe: I was comparing more to languages that really restrict you into one way of doing things like Java/C# which are increasingly popular these days
12:44:55
tetero
Well, those paradigms do make it more difficult for people to shoot themselves in the foot
12:45:00
phoe
Lisp is simply a multi-paradigm language, where C has a strong imperative paradigm and Java is object-oriented*.
12:45:40
schweers
tetero: I would argue that shooting oneself in the foot is the default M.O. for the so-called traditional OO languages
12:46:27
tetero
I think that my analogy was just not very good to begin with, so I'm not sure if it warrants deep discussion :)
12:47:47
phoe
I think https://www.reddit.com/r/ProgrammerHumor/comments/4mo21b/true_descriptions_of_languages/ is a good summary of this discussion so far.
12:53:20
beach
froggey: Is there a description of how Mezzano is bootstrapped somewhere? Failing that, can you describe it in a few sentences?
12:54:22
phoe
AFAIK it uses some other Lisp for cross-compiling, but froggey will explain it so much better than me
12:56:59
froggey
the mezzano compiler is loaded into a host lisp (currently sbcl) and used as a cross-compiler. a few package hacks are used to redirect some symbols (macro-function, various constants, things like that) so they refer the cross-compiler's environment instead of the host lisp's environment
12:58:13
phoe
beach: I actually hope that some of my protocol questions and/or remarks make it into the chapter, so I can later refer myself and other people to that chapter.
12:58:50
froggey
kind of. the compiler proper is the normal mezzano compiler but the file-compilation parts are reimplemented for the cross compiler
13:02:20
froggey
the cold-generator parses the fasls and produces an image. it detects & executes top-level defun forms at image-build time, while it arranges for other top-level forms to be deferred until some time in run-time initialization
13:03:26
froggey
the initial image produced by the cold-generator only contains a subset of common lisp. enough for the fasl loader to run, which is used to load most of the remaining fasls file
13:04:29
beach
froggey: "parses the fasls" sounds a bit mysterious. What is the format of your fasl files?
13:06:50
thetabit
Could I get some help with solving this problem I've been having this week with a special flat file parser? I've been asking various questions here, but I'm still not getting things right. Would someone be willing to take a look at the problem and give some guidance? :D
13:07:22
froggey
they contain operations for a simple stack machine that's used to assemble lisp values & eval code
13:09:31
froggey
right. functions are represented as chunks of native code, the cold-generate can't do anything beyond just storing them in the image
13:11:36
froggey
simple top-level forms get stored as lisp expressions (though represented in the stack machine format). (defun foo () ...) ends up as something like SYMBOL "%DEFUN" SYMBOL "FOO" FUNCTION [machine-code] PROPER-LIST 3 EVAL, which can be interepreted by the cold generator
13:13:01
froggey
and the cold-generator only understands calls to %DEFUN, it defers anything it doesn't understand
13:16:44
Bike
sbcl fasls have a separate stack and table based bytecode that can handle a few top level forms. pretty obscure even as sbcl guts go
13:18:04
Bike
fasl formats are kind of an interesting topic. if there was more consciousness of how compile-file actually works we could maybe improve it
13:18:49
froggey
I've found people generally tend not to care how bootstrapping works, only that it does work. or at least, they don't ask about it
13:20:49
phoe
I'd love to hear about how this works despite me not having asked many questions about it.
13:21:57
phoe
"SHOCK! He Bootstrapped His Own LispOS In Ten Steps! Here's How... [SEE SCREENSHOTS] [LINK]"
13:22:43
beach
froggey: I have another question. I may have many more as I learn more about Mezzano. For now: Does this technique mean that some parts of Mezzano must be written in a subset of Common Lisp?
13:23:22
beach
Steel is what Carnegie did and Banking is what Mellon did [or was it the other way around?]
13:23:24
phoe
beach: I actually double-checked that just as you wrote this. But the paper's title is amusing.
13:25:43
froggey
it does. cross-compiled files can't use CLOS (defclass/defgeneric/defmethod) in compile-time code and there are some restrictions on packages (though I forget what)
13:25:45
thetabit
Okay let's start with this: http://paste.lisp.org/display/351165 and I can explain more :)
13:26:23
froggey
the cross-compiler itself has no such restrictions, as it is loaded as ordinary code into the host
13:28:05
froggey
the supervisor (kernel-like code) also cannot use CLOS, but that's due to restrictions on how and when objects can be allocated
13:28:43
beach
froggey: But there must be shared code between the native compiler and the cross compiler, right?
13:31:30
froggey
the cross compiler is the native compiler + some additional code to make it work in a non-mezzano implementation
13:32:47
beach
froggey: So if cross-compiled files can't use CLOS, how is the compiler loaded into the image?
13:37:26
froggey
cross-compiled files can't use CLOS at compile-time. normal use is fine, assuming they're run after CLOS is initialized
13:37:34
froggey
the cold-generator has two lists of files: the cold files (theses are the ones it examines for top-level defun forms), and the warm files (which it doesn't parse at all, and includes them wholesale in the image)
13:38:37
froggey
the first set of warm files to be loaded is CLOS, which makes it available for use by subsequent files
13:38:47
pjb
My goal in life: get financing from https://www.custard.co.uk/ and https://www.maille.com so that I can make a Custard & Mustard Common Lisp !
13:40:35
beach
froggey: So you are saying that, although the host system has CLOS, it can't be used to cross compile the files that will make up the initial set of FASLs?
13:42:07
froggey
that's right. (defgeneric ...) expands into (mezzano.clos:ensure-class ...) and there's no implementation of mezzano.clos:ensure-class in the host
13:45:37
beach
My last question was meant for me to understand what parts you had to write without using CLOS.
13:49:41
froggey
there's the supervisor (mostly ordinary functions & variables), the cold runtime (the GC, basic macros, sequence functions, hash-tables, the reader, numbers, arrays) and the package system
13:49:51
beach
Maybe I am not expressing myself very well, or maybe I am misunderstanding something. You use the host to create cross compiled files. The code in those files can not have an defclass, defgeneric, defmethod etc in them if I understand it correctly. So I am interested in what those files contain, so that I can understand what you had to write using something else.
13:51:12
froggey
I think I see where the misunderstanding is: (defgeneric foo ...) works fine in when cross cross-compiling, but (eval-when (:compile-toplevel ...) (defgeneric foo ...)) does not
13:53:03
froggey
files in *supervisor-source-files* and *source-files* must run without CLOS, files after closette.lisp in *warm-source-files* can use CLOS
14:08:12
deba5e12
quick question re: macros. I'm looking to write a macro that will expand to multiple toplevel defparameter expressions on the fly -- a sort of "define a bunch of type-specific variations on pattern X" kind of thing. I've gotten to the point that I can construct each of the defparameter expressions properly, but i'm left with a list of them at the top level. how should I go about unpacking this list, so
14:08:18
deba5e12
that each member sits at the top level of the package? (alternatively: is there a more idiomatic way of doing what i'm trying to do?)
14:22:33
thetabit
I am trying to install cl-ppcre, I've loaded quicklisp fine, but then when I do (ql:quickload :cl-ccpre) I get an error which seems very cryptic, An exception occurred in context #.(SB-SYS:INT-SAP #X063BBAD0): #.(SB-SYS:INT-SAP #X063BCCE0). (Exception code: 1722)
14:24:50
thetabit
And before the error it says: To load "cl-ppcre": Install 1 Quicklisp release: cl-ppcre
14:29:46
schweers
just out of curiosity: why use linux when developing for windows? do you cross-compile?
14:31:09
phoe
and I use Linux when developing for Windows because I seriously dislike Windows as an OS.
14:31:49
schweers
I meant at work. I’m just wondering why your employer doesn’t allow you to choose if it’s not that relevant
14:32:11
phoe
He does allow me to choose, as of late, and I'm actually considering switching to Linux.
14:38:14
marvin3
i'd switch to linux completely in a heartbeat if adobe ported photoshop and lightroom
15:39:49
rumbler31
anyone on ubuntu here get swank from the repo? or do you use quicklisp slime helper instead? or slime direct from source?
15:59:13
rumbler31
I know I've asked this a few times, but with the slime-helper, I imagine that a particular version of slime/swank is installed once. do I re-run the slime-helper code in order to update where emacs looks for a new slime?
16:04:15
rumbler31
so if I wanted to start a remote lisp and have it run (swank:create-server), after using the slime-helper tool to get it installed, is it appropriate to (ql:swank), or do I have to find the swank.lisp file from wherever the helper installed it and load that instead? how do you normally get such a thing set up
16:05:49
Xach
When I do that, I start swank on the remote, tunnel the port to the local system, then use M-x slime-connect on the local.
16:10:20
Xach
rumbler31: I do. I work around that by using the latest on the server and local system.
16:10:40
Xach
rumbler31: If that's not an option, you could "lock" versions by manually installing slime and swank separate from the Quicklisp updates.
16:12:24
rumbler31
when you say that you work around it, you mean that you normally go install the latest on both places, not using quicklisp? At this time, everything seems to match now. Just curious how you manage changes
17:16:12
pjb
Posterdati: add (error (err) (format t "~A~%~:*~S~%" err) (error err)) ad the end of the handler-case and see what is printed.
17:18:52
pjb
Posterdati: or even: (error (err) (format t "~S~%" (class-name (class-of err))) (error err))
17:20:45
pjb
Posterdati: add (error (err) (format t "~A~%~:*~S~%" err) (error err)) ad the end of the handler-case and see what is printed.
17:28:08
pjb
Notice that your paste is not a full (self-sufficient) test-case. It lacks calls to quickload etc.
17:30:08
pjb
Now, indeed, if it was handled inside the with-open-socket, you could get it with an ouside handler-case. But since you got it, it's not.
17:39:06
knusbaum
You have one call on line 8 inside with-open-socket, and another on line 33 inside the error handler.
17:42:06
Posterdati
knusbaum: sure it is the first lookup-hostname function to throw, since there's no "INTELNUC" yet
17:50:12
pjb
(defparameter *my-so* (com.informatimago.common-lisp.cesarum.file:binary-file-contents "/usr/lib/libm.dylib"))
17:51:07
phoe
he pulled a ton of dependencies into a Lisp image and created a static binary that played music
17:53:53
Bike
there is a slide in his actual talk titled "application delivery with static c libraries"
17:55:00
rumbler31
phoe. you're using the term static linking for what you're talking about and I think it's confusing people
17:58:25
phoe
minion: memo for Fare: Hey, do you have more information on this slide of yours from ELS, static lin... oh. minion is dead. well, fine.
17:58:50
phoe
I don't want a shared object as a separate file - I want a single monolithic Lisp image.
17:59:09
phoe
and I don't think that he converted all the Linux .so files into static objects in order to link them with the Lisp binary.
17:59:15
pjb
At run-time you just do (setf (com.informatimago.common-lisp.cesarum.file:binary-file-contents "/tmp/libm.dylib") *my-so*) and then you can open that library.
17:59:54
rumbler31
the dumb simple way is to barf the so back out to tmp and use a cffi load library call
18:00:22
rumbler31
of course its on you to make sure that any shared objects that *they* require are either available at the destination or supplied by you and loaded in the correct order
18:01:48
knusbaum
What kind of packaging is this? When I save my lisp image, the resulting executable doesn't link to any shared objects.
18:04:20
rumbler31
simply, imagine what it would take to feed cffi load library. it needs a library name or else an explicit path to a library
18:04:58
rumbler31
how can you consume a binary file and store it in your image using native lisp calls. pjb has an answer.
18:05:14
rumbler31
then barf that back out and supply the newly barfed lib to a call to cffi load-library
18:06:01
rumbler31
pitfalls would be that the system dlopen calls might try to find other shared libraries that you forgot to ship, or that need to be loaded in the correct order
18:08:11
pjb
This is the implementation independent way. Then you can use implementation specific features to statically link static libraries with your executable save image. But on modern unix systems, a lot of libraries just cannot be delivered statically, and have to be dynamically linked.
18:08:27
rumbler31
you can instantly know on your deployment machine what libraries are required and go have them be autoingested in the correct order
20:27:54
dTal
Sure, metaphorically speaking - whatever form the "more structured" version of metaprogramming takes, it'll probably be layered on some kind of macro system
20:29:26
slark
actually as a beginner macro looks like magic and i want to use them as much as i can cause it seems "cool"
20:39:52
slark
antoszka: well it is really for people who want to learn programming with lisp as a vector
20:40:12
sukaeto
A Gentle Introduction to Symbolic Computation is perfectly good as a programming 101 book
20:46:01
antoszka
slark: The Norvig book is actually the best programming *and* CL book ever in my opinion :)
20:50:55
slark
was trying to find lib for GUI app, and found that lispworks made them easy to use on all OS
20:56:32
antoszka
slark: Hard to quantify, but I think most people here will use open-source implementations (sbcl and clozurecl being probably the two most popular) with open source UI libraries.
20:56:44
fiveop
I have a problem that I can best describe by an example (http://paste.lisp.org/display/351183) and the question "How can I conditionally splice a comma form into a backquoted list?"
20:57:35
antoszka
slark: Open source GUI libraries aren't the strongest side of CL these days, unfortunately, but most progress seems to be going on the McCLIM refresh and QT5 fronts (the latter in the form of Shinmera's work).
20:58:56
Bike
`(a ,@(when t `((+ b c))) d) => (a (+ b c) d), `(a ,@(when nil `((+ b c))) d) => `(a d)
21:00:06
Bike
double backquote kind of shuts my brain down, but the same principle shouldn't stop working
22:08:31
ptdel
hello I am very new to lisp, I have a question that is probably really silly. If I want to load multiple libraries at runtime, should I be making an .asd file that loads all of my libs or just use quicklisp?
22:09:04
ptdel
when I want to load lots of libs I am doing (mapcar #'ql:quickload :lib1 :lib2 :lib3) I'm guessing this is a jank way
22:10:56
ptdel
ah ok, correct me if I am off base, I would use the defsystem form for this correct? with each of my libs being in the :depends-on or :component keywords?
22:13:07
phoe
I have pushed the first seemingly working version of CL-LZMA on github, https://github.com/phoe/cl-lzma/blob/master/cl-lzma.lisp
22:19:18
phoe
Can any of you guys on linux64 pull this and check if it builds and if the tests pass?