libera/commonlisp - IRC Chatlog
Search
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.
3:52:47
semz
kathe: Clozure CL is probably a good choice, it focuses on Macs quite a bit and I think it even has its own IDE on there (although I've never used it so I can't say anything about its quality)
3:59:38
kathe
hmnn, hemlock is very interesting, but doesn't have the wide array of modes available with 'gnu' emacs.
4:02:38
kathe
i don't have any background in common lisp nor emacs, and i'm a bit confused about how to learn both in parallel without messing up my thought process.
4:03:45
kathe
so should i first work through the emacs tutorial and manual, get well acclimatised with emacs and then start-off with common lisp?
4:05:52
kathe
i had been quite gung-ho about forth, but after my interaction with some people from it's community regarding introducing a "condition system" and an object system via a metaobject protocol were shot down, i'm going to stick with common lisp.
4:07:35
kathe
thanks EdLangley, i think i'm going to stick with ubuntu. not only does it offer better facilities for development systems but a ubuntu-based setup also costs a lot lesser than a mac.
4:09:47
White_Flame
those who don't use emacs are forging their own path, and yeah hopefully other paths get as fully supported
4:10:32
ns12
kathe: What text editor are you currently using? Perhaps your current text editor has some support for Common Lisp. This will free up more time for learning Common Lisp.
4:11:16
kathe
i cut my teeth on 'sco' openserver so i tend to lean toward vi (not vim), but i'm eager to learn emacs because of the tight integration with common lisp development routines.
4:11:17
White_Flame
after sbcl & emacs, you want to install, in order: quicklisp, quicklisp-slime-helper
4:11:42
White_Flame
you shouldn't really need to adjust any config files after following their steps
4:12:38
EdLangley[m]
https://portacle.github.io is also a good way to get a nice package of "all of the above"
4:12:52
ns12
I personally use the SBCL REPL directly (with rlwrap for readline keybindings). That's another way to defer learning Emacs.
4:13:51
White_Flame
lots of cheat sheets, if you're learning: http://pchristensen.com/wp-content/uploads/2008/02/slimecommands.pdf
4:13:58
minion
kathe: 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).
4:14:57
ns12
Here's a list: https://github.com/EbookFoundation/free-programming-books/blob/main/books/free-programming-books-langs.md#lisp
4:18:58
ns12
In the free books list, "Practical Common Lisp" and/or "Common Lisp: A Gentle Introduction to Symbolic Computation" are typically recommended to beginners.
4:19:31
kathe
I checked out slimv and vlime based setup, but i think i'll go with emacs because i can do almost everything else from within emacs (irc, email, notes, todo, etc.).
4:20:33
kathe
ns12: i've heard that the digital version of touretzky's book doesn't have corrections present in the paperback one.
4:23:12
kathe
2 things that most impress me about common lisp are the "condition system" and the "metaobject protocol" based object-system.
4:26:15
kathe
i don't remember finding the "condition system" in autolisp, nor did any of the seniors talk about it back then.
4:28:33
Bike
"The *error* function takes a single string argument, which is supplied by AutoCAD when an error is encountered during program evaluation. This string describes the error which has caused the *error* function to evaluate." doesn't sound like it has the condition system
4:30:22
kathe
i went through the sample session in phoe's "Appendix E". it's mind blowing. waiting to complete learning common lisp and buy phoe's book on the "condition system".
4:36:43
mfiano
I'd need conformal displacement for anything more than a flat row-major view of the backing storage, correct?
4:38:52
mfiano
Currently I only need a view of a pixel in a '(width height channel-count) #3a, but I was also thinking of things like a NxM kernel view for convolutions.
4:40:16
mfiano
Guess I could just derive the shape/extents from a single pixel and mutate the original directly.
5:16:04
qhong
recalling the discussion about software longevity a few days ago, what you guys think about a Nix/Guix replicate that runs in a single Lisp image a la asdf?
5:30:07
kagevf
I use guix to install nyxt since that's the only way I could figure out how to get all the right versions of nyxt, sbcl, and emacs ... necessary to connect to nyxt's swank server from slime
5:32:31
kagevf
qhong: what would the nix/guix inside CL do? find, and build CL systems? and allow easy switching between different versions? and also act as a package manager? so it would replace asdf and QL, plus add the versioning?
6:07:49
qhong
kagevf: I also think that reproducibility is a pain point of the status quo of CL eco-system. Hyrum law is real. I have no hope contemporary CL projects still work after just 20 years
6:19:18
qhong
mfiano: AFAIU CLPM is akin to a traditional package manager (ala pip, npm etc) rather than a functional pm
6:21:45
mfiano
Of course. Many existing software systems rely on stateful actions during installation. ASDF is programmable to do anything you could want.
6:22:59
lisp123w
kathe: I was trying Sly recently last week but had some pretty bad experiences so reverted to Slime
6:23:44
lisp123w
But in general Sly has some more advanced features (like stickers, which allows to mark a region to get automatic printing on the output) and a better search
6:24:09
moon-child
qhong: cl is in general ideologically aligned towards flexibility over analyzability
6:26:05
qhong
UNIX (and UNIX toolchain) allows as much flexibility (albeit much more poorly designed) on its FS state as CL (and ASDF), yet ppl eventually curse it and invented Nix/Guix
6:27:50
moon-child
mfiano: well, that is interesting, because jails encapsulate non-referentially-transparent things (such as network devices). Probably not super relevant to present discussion
6:28:26
moon-child
qhong: in particular, I can trivially calculate (and isolate) the closure of some object in unix, but not in lisp
6:28:32
qhong
As for edge cases, Nix/Guix has to deal with them manually too and it doesn't seem like too much a practical issue
6:29:08
moon-child
and I can observe all the side effects of an arbitrary operation (see ptrace, dtrace, this has been effected in practice)
6:29:08
qhong
mfiano: I understand you can certainly break it, my question is how many packages actually do it
6:30:36
moon-child
qhong: the closure of an object is the set containing that object and all the objects it points to
6:30:48
moon-child
(actually, the implementation generally gets such a closure, e.g. for fasls; but you do not)
6:31:27
qhong
moon-child: you mean one can get who-reference for arbitrary datum? damn I always want it so hard when CLing
6:31:41
lisp123w
kathe: I think Sly works better for multiple REPLs (I was doing a setup where I had SBCL / CCL / CLISP all on 1 command each), but I didn't want to spend time debugging the issues I had (lag on remote connection to an Image, some other strange bugs) so I reverted to Slime and it suited me.
6:32:35
lisp123w
kathe: However, the stickers thing in SLY is really good - so don't discount it based on my words. Its just that I was doing some bespoke setups which Sly had some issues on my machine
6:33:29
EdLangley[m]
Lispworks's delivery system can do a bunch of stuff that's unsafe if symbols are interned dynamicaly
6:34:12
kathe
lisp123w: thanks. on a different note, would you suggest that i learn to work with emacs in parallel with learning common lisp?
6:34:46
mfiano
Can you take care of dynamic runtime code that generates symbols looking for a specific package with uiop:symbol-call, alexandria:format-symbol in macro's, etc?
6:35:43
qhong
Basically, before build, all dependency are renamed to their nominal names, and after build, all dependencies plus newly created packages are renamed to their unique name
6:36:25
mfiano
I wouldn't want anything to do with such restrictions, but then again, I don't like Linux either.
6:36:49
lisp123w
kathe: Yes, it will be useful for many reasons I won't go into. The trick with Emacs is read the tutorial and guide (don't just jump in), then learn the keybindings C-h k (which lets you see what a keystroke does), C-h f (which describes function at point), C-h v (which describes variable at point), C-h b or C-h m (to see what keybindings are active in the buffer). But I'll shut up now (you can ask #emacs for more help there)
6:37:17
EdLangley[m]
And I can tell when a system uses them, because inevitably my preference of doing (setf print-case :downcase) breaks loading such systems :)
6:38:32
mfiano
ACTION is amused at the thought of #'(setf documentation) being changed when you look at it.
6:41:09
qhong
Actually I think there is an outrageous hack to make macros finding specific package at runtime still work
6:41:41
qhong
First I assume they will use keyword symbols instead of strings, then we can unintern those keywords after each build, and hack `find-package` so they recognize such keyword
6:43:14
lisp123w
EdLangley[m]: !!! Thank you for that archaic macro, very useful to protect against unintended consequences
6:47:23
EdLangley[m]
So, I think the best way (at the moment) to make building systems deterministic is to compute a dependency graph of the system you want to load and then do a depth-first postorder traversal of the graph, building each system you encounter in a subprocess