freenode/#lisp - IRC Chatlog
Search
4:04:23
beach
Omg_cholesterol: It means that the semantics of Common Lisp work as if every object you manipulate is in reality a pointer or a reference to some chunk of memory.
4:04:59
beach
But your remark about malloc/free makes me think that you are asking a different question, perhaps.
4:08:54
Omg_cholesterol
lets say I want to read a string from a file, you could just allocate a buffer and hope its big enough maybe 64K or you could calculate the size of the string then alloate a buffer of that size
4:11:55
no-defun-allowed
If you want to reuse a buffer like that, you could use make-string to make the buffer, then repeatedly read-sequence into that buffer. When read-sequence returns a position less than the length of the buffer, you've finished consuming the stream.
4:11:56
aeth
Omg_cholesterol: What I usually do in this situation is I make an adjustable string like this starting with some power of 2 size: (make-array (expt 2 4) :element-type 'character :adjustable t :fill-pointer 0)
4:12:38
aeth
Omg_cholesterol: And then at the very end I (subseq adjustable-string 0 (fill-pointer adjustable-string)) to make a fixed-size (more efficient) string. This last step will copy, though, and isn't strictly necessary.
4:13:27
aeth
You add to it with vector-push-extend, which will extend it if necessary (in my example, it will start at 0 and only extend when it reaches 16)
4:14:33
aeth
And in theory, a compiler could probably recognize this idiom and not copy with the SUBSEQ if it knows that adjustable-string is only used within a very limited scope, but I doubt that optimization is done. (Instead, it would just change the type prefix of the string, which is a dangerous operation and would have to be done at the compiler level.)
4:15:16
aeth
(Technically, a subseq is always supposed to allocate a new sequence, so this optimization would have to be very careful to not semantically change things and appear as if it is following the standard.)
4:20:23
aeth
I think that this style (although it might not be 0 to FILL-POINTER because there might be parts of the string that you want to drop on either side) is the intended style for this in the standard because SUBSEQ (if used on a vector) turns an array into a simple array that otherwise has the same type, i.e. it will no longer be adjustable.
5:21:16
flip214
and local variables might "vanish" in the sense that they're only a register in code, not a memory location anymore
5:29:45
beach
That's an interesting idea for a feature of an implementation though. I wonder how efficient it could be, i.e., how to avoid too much slowdown when such a feature is enabled.
5:35:30
beach
dbotton: Emacs Lisp is not terribly fast, so the overhead of a watch point would not be that great. Your typical Common Lisp implementation is optimized for speed, so variables will be put in registers by the register allocator. Not only could you not put a watch point on such a thing without recompiling, but it would slow down the operation by an order of magnitude.
5:38:21
dbotton__
I guess it would be possible that an implementation would know that a variable is being "watched" and add the appropriate call
5:39:40
dbotton__
I guess I forget as I am learning CL that it is in the end a compiled language that just feel interpreted
5:39:43
aeth
lexical variables are only going to be guaranteed to be visibile in optimizing implementations like SBCL if (debug 3)
5:40:22
beach
dbotton__: There is no such thing as a compiled or interpreted language. It is all about implementation strategies.
5:40:55
aeth
dbotton__: Any CL implementation is going to have a compilation phase, but it could be bytecode compilation (e.g. CLISP... and I guess technically ABCL on the JVM)
5:41:24
aeth
But even that phase is probably going to hide unnecessary lexical variables unless (debug 3).
9:07:37
pve
Hello! It seems that standard-class is an instance of standard-class (at least on SBCL). Is this magic, or can I replicate this for my own class? (i.e. have it be an instance of itself)
9:10:45
beach
Though, of course, in SICL, I made a point of turning (defclass standard-class (...) ...) into something operational.
9:12:13
beach
pve: The only solution to avoiding an infinite metaclass hierarchy is to make the graph circular at some point.
9:12:47
pve
I'm looking at a class diagram, and I *think* this means I'm not going to be able to recreate it exactly
9:15:14
beach
What I find most fascinating about it, is that the AMOP book assumes the situation where you want to add CLOS to an existing pre-ANSI Common Lisp implementation, so the only solution to these problems (bootstrapping and metastability problems) they suggest are based on that situation.
9:17:51
beach
Yes, sort of. And to build your Common Lisp implementation from one that already has CLOS and the MOP.
9:19:04
beach
But there is this widespread idea that to create some system, you can only use systems that are less complete (less powerful, more primitive, whatever) than the one you are creating.
9:20:21
beach
I understand the AMOP point of view in that, at the time, there was no implementation available with CLOS already in it.
9:20:59
beach
But I don't understand how they could omit a chapter on what to do better if such an implementation existed (which, of course it inevitably will, once you have added CLOS).
9:28:36
pve
I wonder what the implications are if I just have my class be an instance of standard-class and be done with it, since I can't achieve the circularity myself.
9:32:03
pve
no-defun-allowed: I'm not even sure what it will accomplish, I'm just trying to recreate or approximate the Smalltalk-80 class hierarchy, as described in the "Blue book"
9:32:36
beach
pve: One thing that helps is to remember the naming convention. If you say "x is a thing", that means "x is an instance of the class named thing". So when you say that "cc is a standard class", it means that it is an instance of the class STANDARD-CLASS.
9:33:52
beach
pve: The solution to that problem is to avoid mapping Smalltalk classes to Common Lisp classes. Just make them non-class Common Lisp objects. Then you can have a slot that refers to the object itself.
9:33:54
no-defun-allowed
In Netfarm, there is also a circular schema hierarchy; a schema is an instance of the schema named "the schema schema". (You could probably say that quickly out loud, but it's no fun to think about). I also wanted to recreate that in Lisp, but then the schema class would be an instance of itself.
9:35:30
beach
pve: There is nothing particularly special about class metaobjects. They are just objects themselves, and they act as templates in that you can call a function to create an instance of the model, i.e. MAKE-INSTANCE.
9:37:11
no-defun-allowed
So instead, there is a NETFARM-CLASS metaclass, and a SCHEMA class that is an instance of that. One can fabricate a NETFARM-CLASS from a schema using SCHEMA->CLASS, which is reasonable for my uses.
9:38:22
beach
pve: So if you are implementing a different programming language, just represents classes in that language by non-class objects in Common Lisp, and create yourself the equivalent of MAKE-INSTANCE in your language that creates an "instance" of that non-class object.
9:39:24
no-defun-allowed
What I am considering for a Smalltalk-80 implementation is to represent the instances with object slots with one structure class, the instances with byte slots with another, and the instances with 16-bit word slots with another.
9:41:07
pve
beach: I see your point, but I feel like I'd lose a lot of good stuff by not mapping to CL classes. If possible, I'd like to have seamless integration between CL and my language.
10:00:48
schweers
This may seem like a pretty silly question, but here goes anyway: do you often use AMOP during day-to-day programming? I’ve got the AMOP book at home and tried to understand it, but have had trouble so far. So currently I’m living without it. Am I missing alot?
10:04:35
beach
schweers: If you do "application programming" you only occasionally need some custom metaclass or some custom method combination. But to answer your question, I use the MOP in my day-to-day programming, which is about implementing a fully conforming Common Lisp implementation.
10:04:36
_death
if you mean writing code that uses the MOP, it depends on what kind of programs you write and what style you choose to use for them.. personally I've not written MOP-related code for a long time now
10:05:52
schweers
Yes, I meant application programming. So it seems my plan to do properly learn about it some time is warrented, but not urgent.
10:06:15
beach
pve: Right, if you want some kind of integration with Common Lisp, like if you want to write methods on your Smalltalk classes in Common Lisp, and use DEFMETHOD to do that, then my suggestion may not work, but that is much harder problem for other reasons as well.
10:21:40
pve
beach: yep, that was pretty much what I was thinking of.. it's not going to be a stand-alone language, but rather something to play with when I feel like going on a language-safari within the confines of my comfy REPL :)
12:18:19
Xach
Ok, I annotated http://report.quicklisp.org/2020-09-29/failure-report.html a bit. if system A fails due to the failure of system B, there's a link to system B from A.
12:28:31
phoe
Xach: a minor usability feature would be to reverse the order of systems there, so they're alphabetical
12:53:08
mfiano
I still think it'd be more readable if it was presented hierarchically, so you could see all affected systems under a cause.
12:53:57
Xach
mfiano: it turns out not to be as hierarchical as i thought it might be. there's never multiple levels.
12:54:19
Xach
what i thought would be second-level leaves are actually attached to the root because of how errors are reported.
12:54:34
mfiano
Sure I wouldn't expect there to be. I just don't want to scan linearly for all "caused by rpcq" when they could all be grouped under "rpcq"
12:55:36
Xach
if things are sorted by impact, then alphabetically, things are essentially grouped around common causes also
13:09:21
mfiano
I recall there being html to create collpasible/expandable tree nodes. that would be a good way to present the information in a concise way to really see the main offenders, with the option to expand for more details
13:24:16
borodust
Xach: :claw is heavily outdated in quicklisp repo - i bumped quicklisp version of it, but it requires those systems: https://github.com/quicklisp/quicklisp-projects/issues/1909
13:26:50
Xach
borodust: it does not look like it to me from looking at github. am i looking in the wrong place?
13:48:57
borodust
i kinda don't touch stuff that works in quicklisp and mainly distribute via custom dist
13:54:27
borodust
_death: i think the reasoing was that i really need a point in history to pin rather than something inherently moving
13:54:41
borodust
_death: basically, what i did with branches was just resetting them to something in master
13:58:57
_death
borodust: sure, if it works for you.. I always treated tags as user-friendly names for commits, but maybe it's a narrow view
14:02:28
d4ryus
You will run into all kinds of issues when you move tags, i guess since they are not supposed to. For example, fetching fails when tags get moved.
14:04:07
borodust
because only place i'm using tags in that way is stable/testing things in my lisp software
14:06:40
d4ryus
git wont "clobber" existing tags if fetch.pruneTags (or similar) is not set and -f (force) is not specified. You get a "... would clobber existing tags" error message.
14:10:15
d4ryus
borodust: https://stackoverflow.com/questions/58031165/how-to-get-rid-of-would-clobber-existing-tag the second answer, not sure how to link it. But, as the answer states, there is nothing wrong with having a moving tag, but you might run into problems.
14:10:52
borodust
https://stackoverflow.com/questions/9662249/how-to-overwrite-local-tags-with-git-fetch
14:22:11
borodust
ACTION sometimes accesses internal symbols without asking API authors to expose them