libera/commonlisp - IRC Chatlog
Search
15:51:08
lisp123
White_Flame: But now I am curious, what do you mean by "very little initalization per runtime"
15:51:11
White_Flame
(relatively speaking. it initializes the heap and whatever, but all the code is extant)
15:51:29
White_Flame
lisp123: I mean it doesn't do any loading at that point. everything was already loaded before the image was made
15:51:51
White_Flame
now, further REQUIRE forms might pull in more stuff from the implementation, but generally speaking it's all already there
15:52:35
Alfr
lisp123, for the interaction and about what may or may nor be available/done to your running image when you compile a form or file, see
16:16:41
didi
The last version (2.2) of SBCL eliminated my problems with ENOMEM errors. Thank you, SBCL developers. <3
17:01:42
phoe
drakonis: we'll see where this goes - CDRs need implementations much more than they need authors
17:05:12
drakonis
some of the existing CDRs are related to runtime functionality rather than language functionality
17:09:20
beach
Maybe I am wrong here, but if something could be implemented as portable Common Lisp code, wouldn't it just be a library rather than a CDR?
17:10:43
phoe
it seems to me that the CL ecosystem depends on de-facto libraries much more than Scheme depends on SRFIs
17:11:19
phoe
and e.g. Ironclad has customized code that is compiled only on SBCL for performance reasons
17:11:28
etimmons
> For example, a CDR document can contain specifications of libraries, language extensions, example implementations, test suites, articles, etc.
17:11:58
drakonis
you can either write it as a generic library that's pure scheme/CL or write an implementation that takes advantage of features provided by the implementation
17:12:06
beach
etimmons: I can believe what the home page says, but it still seems to me that the main point would be as I guessed.
17:12:19
phoe
if Ironclad was a SRFI, which it could, then it would provide some API for accessing crypto functions, and then either SBCL would ship ironclad-performance-specific code with itself as a contrib or ironclad would carry SBCL-specific code with itself
17:13:01
random-nick
that would I guess be a CDR for library writers and not for implementation writers
17:13:10
phoe
random-nick: oh yes, and I dislike it, specifically because it has no way of conveying intent (see kmp's writeup on the topic)
17:13:57
pve
Hi, is there a Zork-like game (text-based adventure) written in CL that I could study? Zork itself was written in some other dialect of lisp.
17:14:32
EdLangley[m]
One of the things about generic equality is that it's usually possible to right a :key function that lets you use the standardized equality predicates
17:17:11
drakonis
https://medium.com/the-software-firehose/architecting-a-text-adventure-game-2e0dc4d49812
17:19:03
phoe
the code at https://github.com/shaaza/text-adventure-game would need untabification before it's readable to me
17:19:06
random-nick
phoe: right, but it makes me wonder if presentation types could be generalised a little to allow for things such as equality, hashing, serialisation, etc.
17:19:18
pve
drakonis: Thanks for the links, I'll check those out. It doesn't necessarily have to CL code, architecture is interesting too.
17:21:12
random-nick
basically, commands are defined to accept arguments of specific presentation types and all presentations have a presentation type attached
17:21:20
drakonis
the real question here is, what can be turned into a CDR that isn't already a library everyone uses?
17:22:12
random-nick
and presentation types also have defined a way of getting accepted (other than clicking on a presentation of the given type)
17:23:32
phoe
drakonis: the real real question here is, what CDRs can be turned into a library everyone uses
17:24:23
phoe
in particular, how to make something that's useful, as in, actually usable and used by people to solve real-world problems
17:25:02
phoe
I kinda guess that "notarizing" already de-facto standards into CDRs is the easy part and also the part that brings little overall benefit
17:25:35
pve
drakonis: The reason I asked (or one reason, anyway) is I'd like to find out if there are "standard" solutions to how to make creatures etc react to certain events. Say I'm in a room and drop a piece of gold. Then the greedy gnome in the same room should notice this and immediately try to grab the gold. Stuff like that.
17:25:41
random-nick
also, it would be nice if the compatibility libraries decoupled their implementation support from their main systems
17:26:26
phoe
it doesn't mean that you can use swank without an implementation-dependent piece of code, but the API is separated from the backend
17:26:35
random-nick
mezzano has to use a bunch of patched compatibility libraries because its internal interfaces aren't stable enough to upstream the patches
17:27:24
drakonis
but its not something widely loved by the CL community because they all prefer regular macros
17:29:31
random-nick
drakonis: well I think a lot of the use for hygienic macros isn't there in CL because of CL's package system
17:30:03
random-nick
where packages contain symbols instead of the scheme way of having a global symbol table and modules mapping symbols to values
17:30:17
EdLangley[m]
Especially racket's syntax-parse macros which always involve some complicated parser DSL
17:31:16
phoe
FORMAT Tilde Backspace, the quantum format directive that erases itself the moment somebody looks
17:32:19
random-nick
mit-scheme has a hygienic macros system where you write macros like with defmacro but symbols which you want to be exposed to user code (like the anaphoric IT or anything similar) you include as a "syntactic closure" instead of just as the symbol object itself
17:33:13
random-nick
such a style would be nicer imo, but still not that useful considering the package system
17:35:17
didi
Come to think about it, I would welcome a implementation extension that implemented string literals.
17:38:25
specbot
Potential Numbers as Tokens: http://www.lispworks.com/reference/HyperSpec/Body/02_caa.htm
17:39:15
phoe
continuations could be a CDR, too - I've seen a few discussions about how to solve the U-P reentrancy problem
17:39:23
random-nick
it was a feature on some old lisp I remember reading about, basically defining a lambda macro FOO would get called when you do something like ((FOO BAR) BAZ)
17:39:52
phoe
oh, so extra syntax for when an operator call argument is a list - like ((lambda ...) ...) is supported in standard CL
17:40:20
didi
phoe: If I recall correctly, schemers don't like continuations no more. Apparently "delimited continuations" are the way to go. I understand neither.
17:40:55
phoe
mfiano: https://www.reddit.com/r/Common_Lisp/comments/s98u12/portable_implementations_of_genericlabels_and/
17:41:08
EdLangley[m]
Delimited continuations have better properties because they exist within a scope
17:41:22
random-nick
delimited continuations are also reentrant, which is a no-go if there's a UNWIND-PROTECT in the delimited area of the stack
17:41:35
EdLangley[m]
I tried implementing this once and came up with something that sort of worked.
17:42:06
EdLangley[m]
random-nick: Yeah, I think there's some sort of continuation-barrier concept that helps with that
17:42:38
EdLangley[m]
I tried implementing generic lambdas once, capturing the correct lexical environment is really tricky
17:42:47
random-nick
https://github.com/froggey/Mezzano/blob/master/system/delimited-continuations.lisp
17:45:31
EdLangley[m]
But, if you don't care about the lexical environment of the lambda, this works: https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/glambda.lisp
17:47:10
mfiano
phoe: I read the code and the use of LOAD-TIME-VALUE makes me question its usefulness
17:49:49
phoe
make the GF itself a load-time-value, but initialize the GF by adding methods to it the moment control first reaches it
17:52:12
EdLangley[m]
Every time you add a method to the L-T-V generic function, the size of the generic function increases in memory
17:52:37
EdLangley[m]
If the method has an EQL specializer on a lexically-created object, the generic function will pin the method and the method will pin the object
17:54:12
EdLangley[m]
reevaluating the definition of SOMETHING-WITH-ANONYMOUS-GF only really happens during development
17:56:40
EdLangley[m]
If the generic function is created by generic-flet is created once, at load time
17:57:10
EdLangley[m]
Then it's possible to implement the (:method ...) part in a way that that EQL specializer adds a new method every time the function runs
17:58:12
EdLangley[m]
So, first of all, you'll have an indefinitely growing collection of methods attached to the l-t-v generic function
17:58:44
EdLangley[m]
And the EQL specializer of each method will keep an instance of BIG-OBJECT alive as well
18:02:39
lisp123
For some reason, every time I restart my Lisp image, I need to reset the ASDF configuration to load a recently defined pacakge
18:04:41
Bike
i've never quite understood what it would be good for, so i'd be interested in seeing usage
18:05:51
EdLangley[m]
For me, at least, it's more a nicer syntax for a typecase inside a lambda, when you're mapping over a bunch of objects of different types
18:06:48
phoe
so, like, try to compile the method functions once, and then just close over the arguments that the GF needs to close over
18:07:19
EdLangley[m]
the issue I ran into was figuring out how to capture the lexical environment correctly
18:08:28
EdLangley[m]
but, I was trying to do it through the MOP rather than using DEFGENERIC and friends
18:09:00
phoe
the main hurdle I see is COMPILE being a butt in presence of lexical bindings, if we want to be strictly compliant
18:10:40
phoe
I mean, if DEFGENERIC can properly capture the lexical environment, then the MOP must be able to as well
18:10:58
EdLangley[m]
Yeah, I couldn't figure out how to make the stuff inside COMPILE able to access the lexical enviroment
18:11:43
phoe
special opeartor FUNCTION itself must access the lexical environment; if anything, you just COMPILE whatever is the result of it
18:12:17
phoe
and you need to compile the function object that pops out when you evaluate a call to FUNCTION
18:12:40
mfiano
Can I change the displaced-index-offset of an existing displaced array object to be able to updated the displaced-to array at different locations without constructing multiple displaced arrays?
18:12:53
phoe
this, and there's the interaction with MAKE-METHOD-LAMBDA that needs to be taken into account
18:12:59
EdLangley[m]
I remember I spent a long time looking at the macroexpansion and definition of DEFMETHOD trying to figure this out
18:14:02
phoe
EdLangley[m]: I think the macroexpander needs to call MAKE-METHOD-LAMBDA and splice the result of calling it into the macroexpansion
18:15:26
EdLangley[m]
(adjust-array array (array-dimensions array) :displaced-to whatev :displaced-index-offest 4)
18:15:30
Bike
the rules for this are a large part of the definition, even, since it's kind of complicated
18:15:50
mfiano
Does asjust-array specify if a new array object is created or if the index pointer is moved?
18:16:01
Bike
also, yes, for generic-flet you'd want to go through the make-mmethod-lambda rigamarole and avoid actually calling COMPILE.
18:16:36
Bike
mfiano: a new object is only created if the array isn't "actually adjustable". you can assure an array is actually adjustable by specifying :adjustable t in make-array.
18:17:09
mfiano
Ok, and I can make the displaced array adjustable without affecting the displaced-to simple-array?
21:34:36
phoe
and if any method closes over an argument, then we're screwed, because we need to return different objects for different closures - so we cannot preallocate a single LOAD-TIME-VALUE GF, we need to create them from scratch
21:35:22
phoe
...but the good news is, we can expand GENERIC-FLET into a FLET of method functions and have these precompiled - we only need to create the method and GF metaobjects, add methods to the GF, and FBIND the GF - and we're good to go
21:36:51
phoe
and, if we can detect that the local function is DX (either via a user declaration or by code-walking, if we do not notice any FUNCTION calls referring to that free function binding) then we can use the optimized approach with a single LOAD-TIME-VALUE GF and, in case of closures via EQL specializers, adding or removing methods on entry/exit of dynamic scope
21:51:29
Bike
so generic-flet only ever makes a new function, rather than adding to an existing one?
21:52:31
phoe
even the CLtL2 GENERIC-FLET always creates new local GFs, it doesn't augment any preexisting ones
21:52:40
EdLangley[m]
Yeah, I think dynamically changing the methods of a pre-existing generic function is asking for sadness
21:53:28
phoe
because then we can preallocate a single GF along with N methods and just switch their guts around on demand
21:55:20
phoe
Bike: AFAIK it's syntax sugar + optimization chances over creating anonymous GF objects and using these
21:57:11
EdLangley[m]
On reflection, anonymous GFs aren't very useful because the reason to use a GF is to let 3rd party code interoperate with your own code
21:57:41
EdLangley[m]
But, if the GF is defined hidden inside a function, there's no way to do this.
22:03:50
phoe
so I think it should be possible to write (and even optimize) GENERIC-FLET and GENERIC-LABELS using portable CL, MOP, and a code walker to detect FUNCTION calls; GENERIC-LAMBDA is also obviously possible
22:04:47
phoe
the question is, do we have any practical reasons other than going full Cave Johnson on this
22:04:54
phoe
and by Cave Johnson, I mean, quote, "Science isn't about WHY. It's about WHY NOT. Why is so much of our science dangerous? Why not marry safe science if you love it so much."
22:06:15
phoe
I mean, you could in theory grab a local GF object via #' and then forcibly ADD-METHOD some stuff into it
22:08:25
EdLangley[m]
A lot of the generic-flet stuff could probably just be written as a fancy macro for a typecase
22:08:39
phoe
yes, and then maybe some people would enjoy the local :METHOD syntax and qualifiers for method combinations
22:13:11
phoe
you should be able to statically analyze this, especially if no qualifiers are used, and just turn this into a non-generic function with a big ole TYPECASE inside
22:15:03
phoe
and optionally fall back to standard MOP wizardry in case any unrecognized options are present, e.g. a custom metaclass
22:46:26
Bike
fbind a function of one argument for each "method". have that one parameter be #'call-next-method. the typecase calls a method appropriately
22:50:59
Bike
next-method-p is a little more involved but not much. passing no-next-method a method would be trickier
23:37:40
dbotton
Is there a convention used in code for a variable named "this" or "self" by Common Lispers?
23:38:31
Bike
i don't think so. generic functions are not strongly tied to any argument in particular.
23:45:00
phoe
I think that generating code for the user is going to be harmful if it teaches the user that there is some sort of "self" in methods
23:45:05
dbotton
however since the name of BAR can change with a configuration change it means every thing has to generated again
23:45:21
EdLangley[m]
Some things like PRINT-OBJECT use OBJECT or similar for the parameter the user is expected to specialize
23:46:23
phoe
"methods should therefore not depend on the identity of this stream." is the only thing that's mentioned
23:46:50
EdLangley[m]
but, if you can't depend on the identity of the stream, you can't rely on it being the class you expect it to be
23:48:00
phoe
dbotton: the main issue I see is, what meaning do you want to convey - argument names can be completely dumb like ARGUMENT-1 ARGUMENT-2 ARGUMENT-3 and so on, but they are meaningless
23:48:17
phoe
if you are telling the user to configure something, use the argument names to tell them what they are configuring
23:48:28
mfiano
Just name it what the most specific thing that it can be, not something generic like THIS or SELF that has a single-dispatch connatation
23:49:05
mfiano
Hell I'd use single letters over that. That would send the wrong message to a newcomer.
0:12:49
dbotton
i'll think it over, wonder if another word works better for object of event, maybe target
2:38:09
dbotton
Is there a way in common lisp to turn off a style warning for unused variables for a certain region beyond using (declare (ignore target))?
2:46:47
Bike
Not really. Maybe you can swing something with sbcl's muffle-conditions extension though
2:47:42
etimmons
Or declare them ignorable (if the problem is that it's hard for you to tell if they are actually used)
3:44:38
kathe
would you be in a position to comment on which is a good common lisp programming environment under macos?
3:45:33
kathe
i "was" going to migrate to windows and hence use lispworks, but macos is looking very impressive.