freenode/#lisp - IRC Chatlog
Search
6:10:25
axion
Does anyone happen to use company-mode in common lisp code buffers? I am trying to switch from auto-complete, but it seems to only be working in the repl mode. I would be interested in checking out someone's emacs config if it's no trouble.
8:22:22
phoe
Also (digits -12345) ;=> 5 and (digits 0) ;=> 1, but these are easy once I have the tool for positive integers.
8:22:30
beach
Yes, the logarithm base 10 will probably. You might run into problems with precision if the numbers are large.
8:43:52
loke
The native function create_thread returns the thread id, but that return value is thrown away.
8:45:55
loke
You can see a call to %create-thread there. It checks whether the retyurn value is zero, bu8t if not, it should save it in the thread structure.
9:21:21
phoe
Is there any MOP way to prevent defining any writer or accessor functions for a class? I want to create a class that is immutable, as in, its slots are only set during creation.
9:26:52
beach
You define a subclass of STANDARD-CLASS, and then you define a method on (SETF SLOT-VALUE-USING-CLASS) that specializes to the new metaclass.
9:27:37
phoe
Will this error be called during the compilation of a SETF method, or when such a method is used?
9:46:17
phoe
More importantly - if I declare this metaclass IMMUTABLE-CLASS to be a protocol class, meaning that it can't be instantiated, will I have to create a STANDARD-IMMUTABLE-CLASS as an implementation and use this as :METACLASS in DEFCLASS?
9:48:51
phoe
More generally speaking, are metaclasses instantiated? If so, at which moment? How many?
10:03:56
phoe
Because if BAZ is a protocol class, then it cannot be instantiated. Only its subclasses can be instantiated.
10:04:37
phoe
I can't instantiate FOO, because it means that I'll have to instantiate BAZ, which is an error.
10:05:16
phoe
Because, by definition, protocol classes cannot be instantiated. BAZ is a protocol class, so I cannot instantiate it.
10:05:34
loke
phoe: There is no definition of "protocol class" in the clhs nor the AMOP as far as I know.
10:11:57
_death
phoe: when you define a class, a class object is instantiated.. this is a metaobject, and its class is a metaclass
10:18:57
phoe
so my assumption was correct - I need to create a protocol metaclass, then an concrete metaclass, and then use the concrete metaclass in class definition.
10:22:15
phoe
What is the proper verb to use when describing the relation between classes and metaclasses?
10:23:37
phoe
"The :metaclass class option is used to specify that instances of the class being defined are to have a different metaclass..."
10:36:59
phoe
beach: I'm in some trouble here. A simple method on (setf slot-value-using-class) prevents me from initializing the object.
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