<beach>
I am not sure why you insist on abbreviations such as "inst" or "bb".
<beach>
It doesn't make it easier to read the code.
<beach>
... or "mk".
<bollu>
beach what is the preferred style? Would `instruction` or `basic-block` be better? or do you advocate for `i` and `b`?
<bollu>
beach :) yeah, I can move to `make`, I don't min.
<bollu>
mind*
<beach>
Yes, "instruction", "basic-block", "make" etc.
<bollu>
yup, all right
<moon-child>
bollu: I suggest calling accessors specifically rather than using WITH-SLOTS
<beach>
"make-assignment-instruction" rather than "mk-inst-assign".
<bollu>
moon-child why is that? I like with-slots because it "feels" like pattern matching / destructuring a value.
<beach>
bollu: You carefully create a constructor mk-inst-add, but then you don't always use it.
<moon-child>
slots are implementation details. An object might decide it would like to materialize an attribute on-demand rather than storing it in a slot, for instance
<beach>
bollu: You still have mysterious blank lines, incorrect indentation for IF, and the wrong number of semicolons in some places. There should be a single semicolon for a comment after code on the same line.
<sm2n>
note that with-accessors exists
<moon-child>
I am a little confused by the behaviour of const-prop on an assignment instruction. Presumably an assignment is a mutation, rather than simply creating a binding?
<beach>
bollu: And there is no particular reason to have a newline after LET*.
<sm2n>
though now that I'm looking at it again, " The consequences are undefined if any accessor-name is not the name of an accessor for the instance. "
<bollu>
beach I'm using whatever indentation lispworks appears to offer, so I am unsure what's going on there. I didn't know about the single semicolon rule, let me fix that
<sm2n>
which isn't great if for example you want to make an accessor into a method that generates things dynamically
<bollu>
beach ah, you are indeed correct. Mh. I should learn how to enable format-on-save for lispworks
<moon-child>
bollu: you are still using EQUAL rather than EQ to compare symbols
<moon-child>
and, really, I would suggest EQL as a base case for your DEEPEQ
<sm2n>
Does lispworks not have some paredit equivalent?
<beach>
And you still have closing parentheses by themselves on line 60.
<bollu>
moon-child This is something I don't quite follow. is EQUAL wrong, in that it produces incorrect answers, or "too strong" for the use-case at hand? (that is, EQ will suffice for symbol comparison)
<bollu>
moon-child what is wrong with const-prop for assignment? It overwrites the old assignment with the new value, does it not?
<bollu>
moon-child what is wrong with const-prop for assignment? It overwrites the old assignment with the new value, does it not?
<moon-child>
bollu: I don't know exactly what the semantics of your language are, and I haven't read your code very closely. But unless an environment is local to a basic block, you will need control-flow analysis to know where to propagate assignments
karlosz has quit [Quit: karlosz]
<bollu>
moon-child ah yes, that is fair. I'll have to change to a lattice-map, which will union values if there are overlapping keys.
<beach>
bollu: About the EQ vs EQUAL: there is a general rule in programming that one should use the most specific construct that will do the trick, so as to help the person reading the code understand it as quickly as possible.
<bollu>
beach understood
<White_Flame>
also, you might get unintentional matches if your equality test is too broad, and unexpected data gets in there
<bollu>
Is there a mergeWith in common lisp to merge two assoc lists, with a handler for values defined in both assoc lists? I need to merge two maps using a semilattice join operator
<moon-child>
union :key #'car?
<moon-child>
'handler for values defined in both' could use a custom test that mutates a closed-over overlap list
<moon-child>
(or just mutates the tested value directly)
sloanr` has quit [Remote host closed the connection]
sloanr` has joined #commonlisp
rain3 has joined #commonlisp
<jgart>
hi, what is the equivalent of os.environ.get("SERVER_NAME") in common lisp?
<jgart>
sm2n, answered in #lisp
<jgart>
thnx!
rain3 has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
rain3 has joined #commonlisp
rain3 has quit [Ping timeout: 240 seconds]
jealousmonk has quit [Quit: ERC (IRC client for Emacs 27.1)]
rain3 has joined #commonlisp
sloanr` has quit [Ping timeout: 240 seconds]
parjanya has joined #commonlisp
<beach>
jgart: It is always better to explain what it id supposed to do than to assume that all #commonlisp participants instantly identify and know that language you are using for comparison.
<beach>
s/id/is/
<jgart>
oh c'mon who doesn't know that is python? lol jk
<jgart>
I'll try to explain next time better
<jgart>
thnx
<beach>
ywlcm
* jgart
needs a language server protocol for internet acronyms
<jgart>
in order to keep up
<sm2n>
I hope that was just abbrev failing because I have no clue either
<beach>
It was a statement in favor of using abbrevs rather than abbreviations like that in the text.
<sm2n>
heh
parjanya has quit [Read error: Connection reset by peer]
<beach>
I am still baffled by how few people use abbrevs.
<sm2n>
Most people don't do irc in emacs, and most operating systems don't come with system-wide abbrev functionality people know how to use out of the box
<beach>
Then I am still baffled by the reason people prefer to use inferior tools.
<moon-child>
beach: I would argue the point, but it is hopeless :)
<sm2n>
time, effort, access to knowledge, and possibly questionable aesthetic choices
<moon-child>
(re abbreviations, that is)
<sm2n>
I am always baffled (and appalled) by how much computation people do under corporate control, but there are reasons for that too
<beach>
Right. I often hear the equivalent of "I don't have a choice", but that can't possibly be true. Alternative choices might be difficult, but certainly not impossible.
<sm2n>
Sure, at the end of the day I think it comes down to priorities
<jgart>
what irc client do you use with emacs? circe?
<beach>
I personally use ERC, but I haven't done many comparisons.
<sm2n>
haha, I don't actually use emacs for irc
<jgart>
tbh, I'm using gajim with an irc bridge at the moment
<jgart>
ha
<beach>
I very much like having my same abbrev processor, my same spell checker, etc. for IRC and for other text production.
<jgart>
but I've used circe once
<jgart>
same for erc
<sm2n>
Yeah, I will probably switch eventually. Weechat was just easier to set up with my bouncer
<sm2n>
I do all my other textual work in emacs
<jgart>
might end up using catgirl or ii once I get fed up enough with gajim
<sm2n>
though this is getting pretty off topic now
<sm2n>
one approach would be to call read-line in a loop
monaaraj has quit [Ping timeout: 256 seconds]
<sm2n>
something like (loop for line = (read-line :eof-error-p nil) while line collect line)
<beach>
*sigh*
monaaraj has joined #commonlisp
<sm2n>
but yeah I wouldn't do that, as beach is probably going to say
<sm2n>
just call uiop:directory-files
<beach>
I was just going to remark on "while line", but I'll refrain.
<sm2n>
how would you handle the implicit null here? `until (null line)`?
<loke[m]>
I don't really see that as problematic.
<loke[m]>
I have probably written code exactly like that many times.
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
attila_lendvai has joined #commonlisp
<beach>
sm2n: Yes, to conform to the rules on page 13 of the LUV slides. But I wasn't going to argue this again. I have done it many times already.
<sm2n>
Yeah, I just wanted to know what you were going to point out since I didn't see the issue at first glance
<beach>
I understand.
<jgart>
> uiop:directory-files
<jgart>
sorry, the thing I was more interested in is the way to get stdout/err from any arbitrary command
<jgart>
ls was just one example
<sm2n>
oh
<jgart>
but I see the suggestions above
<jgart>
so thnx :)
<jgart>
nice to know uiop:directory-files exists, though
<beach>
loke[m]: The fact that you (or anybody else, for that that matter) have written code of a particular form is not a good argument for whether it is a good or a bad way of writing it.
<moon-child>
beach: all other things being equal, it is good to write code in a conventional fashion
<jgart>
so
<jgart>
(loop for line = (read-line :eof-error-p nil) while line collect line)
monaaraj has quit [Ping timeout: 256 seconds]
<sm2n>
lol
<jgart>
is one approach
<jgart>
ha
<sm2n>
I agree with beach that (null x) is clearer code
<jgart>
what are some others for getting stdout/err from *list-files*?
<beach>
moon-child: Absolutely. Then it "just" boils down to who can be trusted to establish such conventions.
monaaraj has joined #commonlisp
<sm2n>
it's just not something I usually think about because I have experience in languages where such things are idiomatic
<moon-child>
beach: it is not a matter of trust. Conventions have been established, and it is our task to _identify_ them
<sm2n>
(same thing with (and x (f x) ...))
<moon-child>
more interesting, though (imo) is to identify cases when all else is _not_ equal
<beach>
moon-child: I don't believe that is quite true. Given the relatively low level of training and very limited experience of apparently most programmers, I am not willing to just look at average behavior as being "conventional". That's why I trust Norvig and Pitman much more than I trust most people here, including myself.
<sm2n>
jgart: uiop gives you a stream, so you can use any way of reading a stream you have
<sm2n>
I don't have another one off the top of my head
<beach>
moon-child: The argument in the LUV slides is about the reaction of people other then those who wrote the code to certain constructs. Most people here seem to have very limited experience with working in teams with other people, at least compared to Norvig and Pitman. That is why I put less trust in arguments such as "but *I* prefer it that way" or "I have done this a lot and had no problems with it" than the arguments of Norvig an
<beach>
Pitman.
<jgart>
ah ok, so thinking of it as a stream is the way to go
<moon-child>
read-sequence?
* moon-child
considers taking a cheap shot at Peter ‘Python is an acceptable Lisp’ Norvig, decides against it
<sm2n>
jgart: look at the optional :stream parameter in read-line
<sm2n>
moon-child: I also thought better of it
<loke[m]>
beach: how would you write it?
<beach>
moon-child: Yes, I have seen counterarguments like that in the past. "Norvig is a traitor so can't be trusted, so we can then safely ignore his experience and advice".
<beach>
loke[m]: until (null line) or while (stringp line)
<beach>
loke[m]: I really don't want to go through this again. Sorry.
<beach>
loke[m]: And it is not how *I* would write it. It is about the consequences of the advice by Norvig and Pitman.
* jackdaniel
strategically keeps being quiet
<jackdaniel>
good morning :)
<beach>
Hello jackdaniel.
<sm2n>
morning
Jing has joined #commonlisp
<jgart>
what is a stream?
<jgart>
> Streams are high-level async/await-ready primitives to work with network connections.
<jgart>
does that sound like a good definition of a stream in lisp?
<phoe>
> A stream is an object that can be used with an input or output function to identify an appropriate source or sink of characters or bytes for that operation.
<phoe>
that is the standard definition of a stream in Lisp
<jackdaniel>
not only characters and bytes if we account for gray streams
<phoe>
but the question is whether the term is overridden or not
<sm2n>
I think reading js or python documentation is not a good idea when writing cl
<jackdaniel>
gray streams doesn't propose the protocol to read and write arbitrary objects, but this does not mean that you can't define your own operators, i.e stream-read-gesture
<phoe>
jackdaniel: that's the part that I was missing, thanks
<jackdaniel>
you subclass fundamental-{input,output}-stream directly instead of fundamental-{character,binary}-{i,o}-stream
<jackdaniel>
or you subclass the character stream and implement operators so the stream works like bivalent streams
<jgart>
are streams lazy?
<phoe>
jgart: lazy as in?
<jgart>
lazy evaluation
<phoe>
lazy evaluation of what exactly
<jackdaniel>
no, they are not generators
<moon-child>
jgart: it depends on how they are implemented
<phoe>
oh, like that
<moon-child>
jgart: elements read from a stream may be generated lazily, on the fly, or not. It depends entirely on the implementation
<jgart>
thnx
<jgart>
does common lisp have generators or are they called something else?
<sm2n>
no, but I think you can simulate them with closures
<jackdaniel>
QA Thursday :) there are no builtin generators
<sm2n>
(essentially cps if you need multiple yield points, I think)
<sm2n>
actually it's 3am I'm not sure what I'm talking about
<jackdaniel>
3am is the best phase of night to be sound asleep
<moon-child>
how do I type these characters * : ( ) without my shift key?
<moon-child>
(nb. I copy-pasted them from your message)
<phoe>
moon-child: for parens, `setxkbmap -option parens:swap_brackets` on a linux machine
<phoe>
* is on your numpad
<phoe>
and the colon is left as an exercise to the reader
<moon-child>
KP_star is not the same as star
<moon-child>
COUNTERFEIT!
<jackdaniel>
that's what you have key to character mappings for
monaaraj has quit [Ping timeout: 256 seconds]
<phoe>
hmmm
<phoe>
madnificent: I think I am facing a problem similar to the one you faced
<phoe>
I want to write an equivalence predicate for some value-semantics-only stuff, and I want to handle cycles in it
monaaraj has joined #commonlisp
random-nick has joined #commonlisp
monaaraj has quit [Ping timeout: 240 seconds]
cosimone has joined #commonlisp
monaaraj has joined #commonlisp
igemnace has quit [Remote host closed the connection]
igemnace has joined #commonlisp
lisp123 has joined #commonlisp
etiago has joined #commonlisp
lisp123 has quit [Ping timeout: 256 seconds]
wyrd_ has joined #commonlisp
gaqwas has joined #commonlisp
wyrd has quit [Ping timeout: 276 seconds]
jpl01 has joined #commonlisp
sdx has joined #commonlisp
igemnace has quit [Quit: WeeChat 3.4]
<rotateq>
phoe: I thought using #+(or) instead of #+NIL is better for such forms. :)
<jackdaniel>
if we ignore finger injuries then sure
<rotateq>
öhm .. :D
<sdx>
This might be offtopic but I wanted to hear how lisp developers handle this topic: do you usually audit the libraries that you are planing to use? I usually clone the library and then read through every file that the library consists of but I've been told that this is a waste of time by other developers, so what do you do and why?
<jackdaniel>
ensuring the license compatibility is the first step; the rest depends on how many dependencies you have (and how big they are)
<phoe>
there's a lot of implicit trust both in free software and in a part of the lisp community I am aware of
<jackdaniel>
it wouldn't be feasible to audit a large codebase
<jackdaniel>
(that may be argument for not reusing too much "free" code)
<jackdaniel>
and yeah, trust and ducktape is what's holding the computer world together
<jackdaniel>
and some spit
amb007 has quit [Ping timeout: 240 seconds]
<rotateq>
phoe: Much implicit trust all around, like when going to the doctor and get medicine, or buying food.
amb007 has joined #commonlisp
<phoe>
yes
<jackdaniel>
well, doctors and shops would be held responsible for selling poison while most free software has a "no warranty" label
<rotateq>
yes right, but in the first place a doctor must be a person of trust by themselves for me :)
<rotateq>
and jackdaniel, to fill in the recent responses, in German it's also "Zauberhut" so with magician ^^
<jackdaniel>
I have to say that lispers are well versed in Moomins. coincidence? I don't think so! ;p
<_death>
sdx: I do the same (well, skim not read.. after initial reading it becomes easier since you just need to keep up with changes when you update), especially for the projects I actually use
<rotateq>
phew long time ago for me that i saw it as a child and it's way older than me. and Anime series :D
etiago has quit [Ping timeout: 256 seconds]
tyson2 has joined #commonlisp
gaqwas has quit [Remote host closed the connection]
<rotateq>
phoe: and to be more ontopic with it, your sentence reminded me of another line, that we show trust (in each other) by using CLOS, whereas in C++ and such everything is public/private and they trust no one
<_death>
sdx: of course it's not complete coverage.. for example, when I update sbcl I disregard many of the changes because I lack the prerequisites.. but with ordinary lisp libraries, which are much smaller, it's better
<sdx>
_death: I just got kind of "paranoid" I guess becuase of all the recent supply chain attacks especially in the web world that I think that there must be some better way and since then I started auditing everything I use in my projects.
<rotateq>
but that was with Java ..
<jackdaniel>
do you think that lisp is not capable of parsing logged strings and querying ldap servers?
<jackdaniel>
probably not :)
<_death>
sdx: well, that's one reason I guess.. for me it's more about understanding and taking note of breaking/unexpected changes
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
sdx has quit [Quit: Client closed]
<phoe>
rotateq: which one was with java?
gaqwas has joined #commonlisp
<jackdaniel>
log4j had a security issue
<phoe>
log4shell wasn't a supply chain attack though, it was a feature that turned out to be exploitable
<moon-child>
rotateq: (progn (defclass c () ((#1=#:slot :initform 0))) (defun frob (x) (incf (slot-value c '#1#))))
<moon-child>
rotateq: ^^ as close as it gets to a private member
<jackdaniel>
someone depended on log4j, for them it was something "supplied" from the outside
<moon-child>
sure, you may be able to divine it anyway. But you can also memcpy a private member in c++ sooo
<beach>
Why would it not trust you to define a superclass, but then trust you if you add a method on this function?
<beach>
Why not a second one, like validate-validate-superclass-method?
<_death>
it's not about trust, but about lowering the chance of accidental use
<beach>
And you can lower it even more with that second function I suggested.
<jackdaniel>
it is a declaration that you've ensured that both metaclasses are compatible
<jackdaniel>
from the programmer that is
<beach>
I know what it is. But why did I not do that already when I defined the superclass?
<beach>
er, the subclass.
jeffrey has joined #commonlisp
<beach>
And I wonder what there is in a typical Common Lisp implementation that does not allow the system to check whether the superclass is valid.
<jackdaniel>
I think that if you deal with custom metaclasses it is not very hard to mistakenly define a standard class that subclasses something that has a custom one
<beach>
jackdaniel: And then we magically think that it would be harder to define a method on validate-superclass?
<jackdaniel>
I'm sorry but I fail to grasp what is the concern here. when you make a mistake, validate-superclass called by the implementation will error on you
<jackdaniel>
so you will know that you forgot to ensure that classes are not compatible
<jackdaniel>
s/not//
<_death>
the utility function depends on both the possibility of misuse and the complexity of the prevention and detection mechanisms
<beach>
But why is it easy to make the mistake that you said, but not easy to make the mistake of defining a method on validate-superclass?
<jackdaniel>
and either define a method or resign from subclassing the incompatible superclass
<jackdaniel>
well, validate-superclass is directly concerned with metaclasses while when you create a class then you may be oblivious to that
<jackdaniel>
(to the metaclass of your superclass that is)
<beach>
So why do we think that the programmer will make the mistake to define an invalid superclass, but then not make the mistake of defining a method on validate-superclass?
<beach>
I would guess most programmers would just immediately define such a method without investigating further.
treflip has joined #commonlisp
<jackdaniel>
that's very sad assessment of most programmers
<beach>
No worse than using the wrong superclass.
<jackdaniel>
well, I don't share that opinion
<beach>
Of course.
<jackdaniel>
either way now I have better understanding why do you consider this function weird, thanks for elaborating
<beach>
Sure.
alevykh has joined #commonlisp
<phoe>
Xach: thanks for merging my vecto stuff
<Xach>
phoe: thanks for making it
rotateq has quit [Ping timeout: 240 seconds]
alevykh has left #commonlisp [#commonlisp]
<jackdaniel>
metaclasses may be provided by a third-party library and the consumer of said library may have insufficient knowledge to decide whether they are compatible
<jackdaniel>
so the burden falls on shoulders of person who defines metaclasses
<phoe>
if an implementation does something that is explicitly prohibited by the standard, then in theory it's not an extension, it's non-compliance
gaqwas has quit [Remote host closed the connection]
Bike has joined #commonlisp
<madnificent>
I'm looking for sensible libraries for a semi-high throughput http system. Assuming a few thousand http requests coming in from a limited amount of endpoints, and a few thousand http requests going out at the same time (something between 1 and 50 but no hard upper limit). Outward communication goes to two http endpoints and communication is well-formed json (should that ever matter). Any suggestions on the http lib
<madnificent>
defaults are hunchentoot and drakma) and/or multi-threading constructions I should investigate?
<Alfr>
nij-, what in the description of sequence makes you think that?
<Shinmera>
madnificent: woo and dexador, probably.
<madnificent>
I'm running on SBCL. Each of the requests have some processing that needs to happen on them. I will also have to lift off the pressure from the component I call when it can't follow, that will create some more open connections temporarily.
<madnificent>
Shinmera: Thank you :D Other suggestions as these are labeled beta and the author isn't always as highly regarded here. I'm going to try them though, the design targets match mine.
mgl has joined #commonlisp
<Shinmera>
there are no real choices other than woo and hunchentoot as far as I'm aware.
lisp123 has joined #commonlisp
<madnificent>
Any ideas on thread pooling, or is that included with Woo somehow?
<nij->
Oh I see. I got mixed with "extension" and "non-compliance". Thanks.
<madnificent>
I see a set of workers, but I doubt 10k running threads is SBCL's target. I should probably split up processing steps and let each step be handled by workers as they come free.
lisp123 has quit [Ping timeout: 240 seconds]
etiago has joined #commonlisp
gaqwas has joined #commonlisp
s-liao has quit [Quit: Client closed]
sloanr` has joined #commonlisp
engblom_ is now known as engblom
engblom has joined #commonlisp
engblom has quit [Changing host]
waleee has joined #commonlisp
<jeffrey>
Shinmera, I use caveman2 which supports both
<jeffrey>
or @madnificent I eman
monaaraj has quit [Ping timeout: 240 seconds]
monaaraj has joined #commonlisp
<Shinmera>
caveman is a web framework, not a web server.
<jeffrey>
Ofcourse, excuse me
gpiero has quit [Quit: Quitting...]
gpiero has joined #commonlisp
Inline has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
thomaslewis has left #commonlisp [#commonlisp]
hisacro has quit [Quit: \o|]
monaaraj has quit [Ping timeout: 240 seconds]
hisacro has joined #commonlisp
monaaraj has joined #commonlisp
attila_lendvai has quit [Ping timeout: 256 seconds]
<madnificent>
jeffrey: thanks though. I'm only going to have 4 endpoints on this server which will actually only two types of requests.
wyrd_ has quit [Ping timeout: 276 seconds]
nature has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
rotateq has joined #commonlisp
jealousmonk has joined #commonlisp
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
rain3 has quit [Ping timeout: 240 seconds]
wyrd has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Client Quit]
taiju has quit [Quit: Quit]
nij- has joined #commonlisp
<engblom>
Is there any ready function that would work like (butlast ...) but for strings?
taiju has joined #commonlisp
taiju has quit [Client Quit]
<engblom>
I would want to use a such function for extrating only 334 from (cl-ppcre:scan-to-strings "(\\d)+(/)" "54foof334/asdfasd123/"). Now I would get "334/" as result.
<jeffrey>
(str:substring 0 -1 "text")?
<Bike>
subseq. but for that you should probably just ues capture groups, no?
<engblom>
jeffrey, Bike! I am asking so I do not unnecessary reinvent the wheel.
lisp123 has joined #commonlisp
<lisp123>
beach: What is your ERC settings? I find when I use it I get flooded with a lot of unnecessary messages
<beach>
What is an "unnecessary message"?
<lisp123>
x has joined / y has left to a large degree
<beach>
I find those extremely useful. But I think there is a flag to turn them off.
<_death>
there's erc-hide-list
<lisp123>
I see, thanks. _death - oh great, let me play around with that
amb007 has quit [Read error: Connection reset by peer]
sloanr` has quit [Remote host closed the connection]
amb007 has joined #commonlisp
<_death>
maybe hack a designated line containing something like "J: [18:05 user1] [17:39 user2] | P: [18:20 user3]" instead
sloanr has joined #commonlisp
<lisp123>
_death: I usually just check if the person is there via tabbing on their name, although I have a custom IRC app which is really cool (but not Emacs obviously)
<phoe>
I'd like to specify an extra argument for a slot definition, :ALWAYS-BOUNDP T, which is meant to ensure that a slot can never be unbound - meaning that attempts to create an instance with neither INITFORM nor INITARG should signal an error, and so should SLOT-MAKUNBOUND. the latter is a matter of defining a new method on SLOT-MAKUNBOUND-USING-CLASS, but how do I easily achieve the former?
<_death>
lisp123: sure, it's just a way to see recent join/parts without spending lots of line on it
<jgart>
lisp123, what's the irc app? do you have a public repo for it?
kevingal_ has joined #commonlisp
kevingal has quit [Ping timeout: 256 seconds]
<lisp123>
_death: Indeed, its a pretty good idea, others may find it useful
<lisp123>
Not mine obviously..I can barely join lists today :P
<lisp123>
phoe: I usually would do it a different way, which most likely is not suitable. If you have the slot as a mixin, you could do a check in an after method?
<phoe>
lisp123: which method?
<phoe>
or rather, an after method on which GF?
<phoe>
slot-value-using-class?
Oladon has joined #commonlisp
<lisp123>
initialize-instance?
<_death>
phoe: my first thought is initialize-instance
<jgart>
lisp123, oh ok, thnx
<phoe>
hmmm; I'd need to iterate across all slots and ensure that all are bound inside it, right?
<phoe>
or are you thinking of something else?
<lisp123>
it would probably work, but if each slot is a mixin, have them inherit from must-be-initialized-protocol
<lisp123>
then do an after method there, some MOP magic to then check if slots bound
<phoe>
I mean, I need to accept the :ALWAYS-BOUNDP keyword argument anyway, so I need to write a custom slot definition
<_death>
phoe: across the slots marked always-bound
<phoe>
_death: yes
<_death>
phoe: but why not just :initform (error "gimme")
<phoe>
_death: !
<phoe>
mostly to avoid typing it over and over and over again
<_death>
(I often use :default-initargs for that)
<phoe>
if you have tens of slots and/or :default-initargs forms then you have tens of (error "gimme")
<_death>
in any case you need to specify it somehow.. could be :always-bound t
<phoe>
mfiano: should be an error
<_death>
mfiano: me, I think if you slot-makunbound you deserve it
<_death>
if you have tens of initargs that are required.. maybe you should change your interface
<phoe>
I mean, across dozens of defclasses
<_death>
then (error "FOO is required.") is not so bad
tyson2 has joined #commonlisp
<phoe>
:initform (error "FOO is required.") repeated fifty times across twenty DEFCLASS forms makes me unhappy though
<_death>
is the purpose of the metaclass specifically always-bound?
<phoe>
that's an average of 2.5 (error "FOO is required.") per DEFCLASS
<phoe>
to be honest, yes - 100% of my use case is going to be "having a class whose slots are always meant to be bound"
<phoe>
s/whose slots/whose instances' slots/
<_death>
well, you can write it an see how you like it.. personally I have :foo (error "FOO is required.") and don't feel it to be an issue
<_death>
*and
<phoe>
_death: I mean, it's currently this way in my code, and it's not really much of an issue either
<phoe>
...until I forget it once or twice
<_death>
there are many small things that can be tweaked in defclass and other forms.. but it comes down to bang-for-the-buck
<phoe>
yes
* phoe
ponders his MOP
<lisp123>
So there's no way to do :always-bound T and make it work?
<phoe>
lisp123: there is
<phoe>
plenty of ways actually, I'm just figuring out the best one now
<lisp123>
oh, let me read
<lisp123>
re-read*
<lisp123>
phoe: if you find some good way, can you let me know? I am curious since my CLOS vocab is very limited
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phoe>
lisp123: I will
<lisp123>
phoe: Thanks!
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
gaqwas has quit [Remote host closed the connection]
<phoe>
if I understand the instantiation protocol correctly, it's no real use to add methods to SHARED-INITIALIZE of the slot definition itself, because this problem isn't really about slot definitions, but about concrete slots - so it seems that any checking should happen during SHARED-INITIALIZE :AFTER of the instance itself
<_death>
why shared-initialize?
kevingal_ has quit [Ping timeout: 256 seconds]
<phoe>
my current idea is, whenever a new instance of an all-slots-always-bound-metaclass is created, there should be a method added to SHARED-INITIALIZE :AFTER that will fire for instances of this metaclass, perform this checking, and signal an error if appropriate
kevingal has joined #commonlisp
<phoe>
and any old such method might need to be removed in order to avoid leaks
<_death>
if you have an instance where the slots are bound, I don't think you can make reinitialize-instance make them unbound
<phoe>
hmmm
<_death>
(other than playing tricks of course)
<phoe>
that's one of the great four
<phoe>
the remaining three are MAKE-INSTANCE and U-I-F-R-C and U-I-F-D-C
jeosol has quit [Quit: Client closed]
<phoe>
these *might* result in unbound slots I think
jstoddard has joined #commonlisp
<_death>
for make-instance, there's initialize-instance.. you need to have methods for the two others anyway
<phoe>
either have different methods for all three or try to have one method in shared-initialize :after - am I thinking wrong?
<Bike>
u-i-f-r-c and u-i-f-d-c can indeed add unbound slots, if the new class doesn't have initforms for them
<_death>
no, you need to handle the case where always-bound value changes, or where an instance is changed to be of a class with different always-bound values
<phoe>
if the always-bound value changes in any way then I don't care, it's still bound after all
<Bike>
why don't you just do the (error ...) thing, except make it the default initform if no initform is provided, so you don't have to write it out
<phoe>
Bike: hmm, I guess that works
<_death>
phoe: if always-bound is false, and an instance exists.. what happens if you redefine the class to have always-bound true
<_death>
(the instance has the slot unbound)
<phoe>
_death: good point
wheelsucker has joined #commonlisp
<phoe>
Bike's solution sounds simple
<phoe>
;; even if I don't know if it solves this particular case
<Bike>
what wouldn't it solve
notzmv has quit [Ping timeout: 240 seconds]
<phoe>
always-bound is false, instance exists and has an unbound slot, class is redefined to have always-bound true
<phoe>
but truth be told solving this with some sort of u-i-f-r-c methods sounds complex
<_death>
right, you could have a restart asking for a default or instance-specific value, but sounds like something to think about
<lisp123>
related/unrelated question - does adding handler-case and restart-case cause some minor slowdown in performance?
<lisp123>
(or any conditions construct for that matter)
<phoe>
yes, you need to perform dynamic binding/unbinding
<Bike>
yeah, ok, i guess you'd need a u-i-f-r-c method
<lisp123>
phoe: Thanks
<phoe>
lisp123: but I have no idea if it's a noticeable difference
<Bike>
might also need to allocate the handler closures. shouldn't be anything major though.
<phoe>
but all in all I have no idea what's the real difference in practice in real-world lisp programs
<lisp123>
phoe: Thanks. I guess its a good habit regardless. Perhaps one day I will benchmark and see how much effect it has
<phoe>
that test by nikodemus was actually very heavy on backtracking and it basically benchmarked just the condition system alone
<phoe>
I don't think it's anything that can be a source of any major slowdown
<Bike>
yeah, this also involves repeatedly making and signaling conditions, rather than merely installing handlers
<phoe>
and that in turn repeatedly walks the handler tree
epolanski has joined #commonlisp
materialfuture has joined #commonlisp
<NotThatRPG>
phoe: Isn't a cheesier, but easier solution to shadow defclass with your own macro that handles :always-bound t and inserts the error initform?
<phoe>
NotThatRPG: that's what I am doing at the moment
<phoe>
and it works but is kiiiinda unclean for my 2022 taste
<NotThatRPG>
Arguably ugly, but also conceptually a *lot* simpler (and likely more efficient)
<_death>
it may also be more future-proof.. sometimes (:metaclass foo) is an implementation detail and supplements a define-foo-class operator anyway
wyrd has quit [Quit: leaving]
wyrd has joined #commonlisp
miique has joined #commonlisp
gaqwas has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
Oladon has quit [Quit: Leaving.]
aeth_ has joined #commonlisp
aeth has quit [Killed (NickServ (GHOST command used by aeth_))]
aeth_ is now known as aeth
frodef has joined #commonlisp
tyson2 has joined #commonlisp
epony has quit [Ping timeout: 240 seconds]
Oladon has joined #commonlisp
epony has joined #commonlisp
<frodef>
Hi all! I just had usocket err on me with a NS-TRY-AGAIN-CONDITION. This surprised me because it is not a SERIOUS-CONDITION, which supposedly is "All conditions serious enough to require interactive intervention". Is this perhaps a fault in usocket?
<pjb>
Well, a try again condition is not really an error, is it?
<pjb>
frodef: why would it require interactivity? Just write a loop to try again.
<frodef>
pjb: Well, I'm not the one saying it requires interactivity, usocket is. It threw me into the debugger.
<Bike>
not a socket expert, but i would think the idea is that you'd have your program try again automatically, without manual intervention
<Bike>
putting you in the debugger doesn't mean manual intervention is required. it means there's no code telling it what to do instead.
alvaro121 has quit [Ping timeout: 240 seconds]
<frodef>
I suppose the real question is, if I want to run some code "non-interactively", then dealing with SERIOUS-CONDITION, nor ERROR as IGNORE-ERRORS does, will really do the trick.
alvaro121 has joined #commonlisp
<frodef>
...only *DEBUGGER-HOOK* will..?
<frodef>
..or should I just HANDLER-BIND all conditions?
<frodef>
BTW the full(er) entry for SERIOUS-CONDITION is this: All conditions serious enough to require interactive intervention /if not handled/
<frodef>
seems to me the latter three words indicate that NS-CONDITION should inherit from SERIOUS-CONDITION.
gaqwas has quit [Remote host closed the connection]
<frodef>
Bike: I mean, there are obviously many serious-condition that don't require manual intervention in the sense that dealing with them automatically is impossible.
cage has quit [Remote host closed the connection]
<Bike>
i suppose it depends on how usocket signals it. which i'm not sure of, from glancing at the code
<frodef>
Not easy to see, but since I ended up in the debugger, it must have been by way of ERROR somehow.
<phoe>
frodef: the stack frames should give you the position of last ERROR call
<phoe>
if anywhere
<phoe>
but, yes, looks like a proper patch would be to have USOCKET raise the seriousness of NS-TRY-AGAIN-CONDITION
<frodef>
phoe: there's some weird FFI going on. And now I lost the sldb buffer, somehow.
<frodef>
I reported/asked about this in a github issue now.
lisp123 has quit [Remote host closed the connection]
treflip has quit [Quit: good night]
thomaslewis has joined #commonlisp
<phoe>
does CLHS have a list of all standardized classes somewhere?
akoana has joined #commonlisp
<phoe>
I only see CLHS 4.2.3 which contains a soup of type specifiers and class names
<phoe>
(class-of *instance*) ;=> #<ALWAYS-BOUND-CLASS COMMON-LISP-USER::TEST-CLASS>, so the proper specializer for the OBJECT argument would be ALWAYS-BOUND-CLASS
<yitzi>
Yeah, that is not the way I have used `slot-value-using-class` before
<phoe>
(class-of (class-of *instance*)) ;=> #<STANDARD-CLASS COMMON-LISP-USER::ALWAYS-BOUND-CLASS>, so the proper specializer for the CLASS argument would be STANDARD-CLASS
<_death>
21.2.1 (git:c646799145538997d84ed6d8755be7e7837eb7ef) gives me Broken at CLOS:SLOT-MAKUNBOUND-USING-CLASS. In: #<process TOP-LEVEL 0x7f2bad1c9f80>.
<yitzi>
_death: ecl master which was 21.2.1 ... let me look again. Maybe I did something wrong.
<yitzi>
_death: You are correct. It gives an error. I don't what I did wrong...bump.
<yitzi>
Ok. Scratch my previous...CMUCL gives the expected error. Somebody revoke my paste license.
<_death>
clisp doesn't like it *** - CLOS::EFFECTIVE-SLOT-DEFINITION-CLASS-<EMF-2>-1: illegal keyword/value pair :NAME, SLOT in argument list. The allowed keywords are NIL
theothornhill has joined #commonlisp
notzmv has joined #commonlisp
<yitzi>
ABCL gives expected error.
<phoe>
_death: :NAME? huh, I can't see that anywhere in this code block
<_death>
ccl gives error as expected
<yitzi>
SBCL 2.1.11 gives me no error.
<rotateq>
as long as ABCL doesn't let the multibear free ^^
<phoe>
yitzi: _death: thanks for verifying
<_death>
phoe: I think it's a clisp issue
<yitzi>
np
<phoe>
_death: yes, I think the same
<_death>
phoe: if I add &allow-other-keys to the e-s-d-c method it gives error as expected
gaqwas has quit [Remote host closed the connection]
<phoe>
_death: oh wait, am I supposed to add &A-O-K in all method lambda lists even if the GF has it?
<_death>
phoe: no.. the problem is that the GF doesn't have it (but neither does SBCL's).. both have (class &rest args)
<phoe>
ooh, I see
<_death>
that's the definition in MOP
cage has joined #commonlisp
gaqwas has joined #commonlisp
gaqwas has quit [Remote host closed the connection]
<_death>
I don't remember whether it's needed in this case
<_death>
usually it's &rest args &key &allow-other-keys
<yitzi>
I don't think it matters. The key specification is supposed to sit on the generic as I recall. The methods can add keys, but thats it.
<_death>
phoe: so maybe your defmethod should be (defmethod effective-slot-definition-class ((class always-bound-class) &rest args) ...)
<phoe>
_death: sure
<_death>
since the GF doesn't specify &key
<phoe>
...
<phoe>
can I actually simplify my code a real lot?
<_death>
right, since you didn't implement :always-bound yet
* phoe
kicks out the whole slot definition thing
<phoe>
yes, this is just slot-makunbound stuff at the moment
Oladon has quit [Quit: Leaving.]
mason has left #commonlisp [#commonlisp]
lisp123 has joined #commonlisp
monaaraj has quit [Ping timeout: 240 seconds]
monaaraj has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
karlosz has quit [Quit: karlosz]
theothor` has joined #commonlisp
theothornhill has quit [Ping timeout: 240 seconds]
gaqwas has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
aartaka has quit [Ping timeout: 256 seconds]
nitrowheels has joined #commonlisp
<phoe>
_death: I think I found a way to implement a class-wide always-bound mechanic without a custom ESD at all
<_death>
if it pertains to all slots, then yeah I guess
<phoe>
yes, that's my use case
<_death>
but then it becomes kinda limiting, since sometimes you want to initialize a slot in initialize-instance/shared-instance, and it may have a :type specifier that you don't want to extend
<phoe>
but then per-slot toggles can be just :initform (required-argument ...)
<phoe>
although that doesn't prevent unbinding
<phoe>
hmmmm
<phoe>
I'll think of it tomorrow or something
<_death>
right.. but you don't need custom e-s-d for slot-makunbound-using-class
<phoe>
yes
<_death>
without preventing makunbound, I guess instead of always-bound-class you can call it default-initform-class
Oladon has joined #commonlisp
foxfromabyss has joined #commonlisp
<_death>
but then you may want per-slot information, say the slot's name
<_death>
to specify in the error
<foxfromabyss>
hello :) are there any books you could recommend, that would be a good introduction to Common Lisp? I've done the SICP so far as the foundation for Lisp family languages, but would love something more specific for Common Lisp
<_death>
minion: tell foxfromabyss about pcl
<minion>
foxfromabyss: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<foxfromabyss>
I was actually looking at exactly that one, but wasn't sure :D thanks a lot!
<_death>
you could also go to the slime threads buffer C-c x t, choose the REPL thread and type d (to break into the debugger).. but in some cases that also may not work.. then maybe go to the inferior-lisp buffer and try calling interrupt-thread from there
<phoe>
I'll expand on it once I'm fresher
<phoe>
good night for now
<_death>
(it's C-c C-x t actually)
<yottabyte>
thanks
<nij->
Using counsel-describe-function can tell you what it is bound to on the fly. It's very neat.
tyson2 has quit [Remote host closed the connection]
monaaraj has quit [Ping timeout: 240 seconds]
monaaraj has joined #commonlisp
cage has quit [Remote host closed the connection]
random-nick has quit [Ping timeout: 256 seconds]
monaaraj has quit [Ping timeout: 240 seconds]
<bollu>
You are approaching the heap size limit for the Personal Edition of LispWorks. If you choose to continue now you are advised to save your work at regular intervals. :(
<bollu>
Hmm, I can't setup quicklisp
<bollu>
well, no, I can setup quicklisp, I just can't load FSet sadly
monaaraj has joined #commonlisp
gaqwas has joined #commonlisp
MichaelRaskin has quit [Ping timeout: 260 seconds]
monaaraj has quit [Ping timeout: 256 seconds]
monaaraj has joined #commonlisp
jeffrey has quit [Quit: Client quit]
<yottabyte>
oh that's very cool
lisp123 has joined #commonlisp
nitrowheels has quit [Quit: Leaving]
lisp123 has quit [Ping timeout: 240 seconds]
gaqwas has quit [Ping timeout: 240 seconds]
epolanski has quit [Quit: Connection closed for inactivity]
tyson2 has joined #commonlisp
taiju has joined #commonlisp
Danishman has joined #commonlisp
miique_ has quit [Read error: Connection reset by peer]