libera/#commonlisp - IRC Chatlog
Search
17:04:04
mgl
Apart from the slightly related declaration DECLARATION, is there any support for user defined declarations in any implementation?
17:05:12
White_Flame
it's mostly part of the compiler infrastructure, so "support" is still going to be in the guts of things
17:08:41
mgl
Nothing concrete, just wondering whether some lisps provide user defined declarations that a macro can access through its environment object.
17:09:42
White_Flame
I haven't noticed that explicitly documented, but just adding to to the environment doesn't sound like it should be too difficult.
17:10:24
EdLangley[m]
I think all the in scope declarations are accessible in sbcl through internal APIs
17:11:48
EdLangley[m]
I also submitted an issue on Trucler about providing a portable interface to this functionality
17:29:58
mgl
Oh, wow. Looking at trivial-cltl2 it seems to cover most lisps with the notable exception of clisp.
17:32:04
phoe
hard to write a compatibility layer over something that has no implementation support and cannot have a meaningful fallback implementation
17:37:47
mgl
I've just added linking to the hyperspec to mgl-pax (https://melisgl.github.io/mgl-pax-world/mgl-pax-manual.html#x-28MGL-PAX-3A-2ADOCUMENT-LINK-TO-HYPERSPEC-2A-20VARIABLE-29) for most things. But to link to declarations, pax would need a declaration locative (roughly equivalent to namespec id). If there is actually a way for users to define
17:38:56
phoe
you want to get a list of all declarations? if yes, (trivial-cltl2:declaration-information 'declaration) will give you the custom-defined ones
17:40:08
mgl
mgl-pax terminology, sorry. Locatives specify what role of a symbol to consider. E.g. the same symbol might denote a function and compiler macro.
17:40:57
phoe
in the worst case, try calling (ignore-errors (trivial-cltl2:declaration-information symbol)) then and see what you get
17:41:52
phoe
or ask for a list of all custom declarations first via (d-i 'declaration) and check if the symbol in question is on the list first
17:57:38
mgl
For the record, while trivial-cltl2 has reader conditionals for major implementations, so far no lisp other than SBCL implements both define-declaration and declaration-information.
19:05:37
contrapunctus
I was reading demo.lisp in the Clobber repository to figure out how to use it, and I'm not sure what `clobber:define-save-info` does (other than "it defines a save-info method", from the macro definition), or why (and how) client code is supposed to use it... https://github.com/robert-strandh/Clobber/blob/master/demo.lisp#L19
19:15:10
Josh_2
Not much has changed with the bot, I upgraded it to the second version of my matrix-api library a few days ago which has resulted in 100% uptime since. Other than that I have not done anything with it for months
19:16:42
Josh_2
I have written a library that wraps all of the matrix api, the admin api and the spaces api
19:22:17
Josh_2
contrapunctus: Currently I am designing a new MOP for use in my new project, the MOP is really awesome! Its great how you can encapsulate so much behaviour behind a simple class like interface
19:27:14
rotateq
and hmm, first 2 years ago i found some cl21 ideas not bad, now i see that it violates things and you can't really rely anymore
19:31:42
rotateq
as long as it's running in 30 years still the same way. or more "i was there gandalf, 3000 years ago ..."
19:35:12
EdLangley[m]
It’s just the standard advice, right? Don’t define a method for a generic function unless you control either one of the classes in the specializers or you defined the generic function.
19:35:32
Josh_2
gabc: you can define methods at runtime but I do not know if this creates the generic for you
19:35:55
Bike
it's not. it's common for libraries/etc to define generic functions with the expectation that they'll be extended.
19:35:57
Josh_2
EdLangley[m]: but this is exactly how you extend the functionality of someones library
19:35:58
rotateq
gabc: no methods are instances of generic functions (or do i miss some terminology?)
19:36:20
moon-child
suppose module X defines generic function F and module Y defines class O. I want to pass instances of O to module X. Specialising F for O seems like the obvious thing to do
19:36:24
Bike
for a standard example, it's probably not an issue to define print-object or make-load-form for someone else's class.
19:36:31
gabc
rotateq: that's my assumption, and if you don't have the generic function explicit it's made implicitely
19:37:12
Bike
and if you use defmethod without a previous defgeneric the generic function is indeed made implicitly
19:37:13
rotateq
yes gabc, when calling first time DEFMETHOD and the protocol checks for it. but this way you can't have another method-combination (direectly)
19:39:03
random-nick
hmm, am I reading the spec wrong or does MOP not allow for you to define a new kind of specialization and use it in a method on a standard-generic-function?
19:39:29
mfiano
With the MOP, what is the way to get all of the effective slot _names_ of a finalized class?
19:40:10
Bike
random-nick: right. that part of mop is pretty weak, yeah. there was an extension proposal for it but i don't think it was implemented
19:40:43
EdLangley[m]
(Maybe partially, I forget the details here, but I’ve seen relevant commit messages in sbcl)
19:45:38
rotateq
oh nice, with scymtym as one author. he seems not being soo far from me in distance ^^
19:57:52
_death
moon-child: the problem is when someone else also defines an F method specialized on O.. then you have two possibly incompatible definitions.. so one solution is to create your own class MY-O that is a subclass of O and specialize on that and make sure to pass instances of that to F
20:17:38
EdLangley[m]
There is a valid use-case here when you want to bridge two unrelated libraries but this is still dangerous for the reasons _death mentions
20:18:30
EdLangley[m]
Another option would be to create an adapter system that’s intended to be the bridge
20:19:18
gabc
At least the definition of methods are package-local, right? So if I do them in my package they aren't global, right?
20:19:48
EdLangley[m]
Or use the client technique beach uses where the generic functions have an argument specifically intended to be used by the user to switch between sets of implementations
20:44:30
nij-
A modern webpage is similar to a interactive program hosted in the browser. If it were CL (but not JS) that dominated the web, it'd be possible to launch a slynk server from-within the webpage, and hack it through emacs. CL didn't dominate the web, but I suspect something like this is possible. Is there some script I can run from-within a webpage that effectly enables me to hack the page with CL, sly, and emacs?
20:47:03
Josh_2
If I have a list like '(a b c d) how can I compute every possible combination of those elements?
20:49:40
edgar-rft
in case of doubt there's a "Common Lisp" code example section here -> https://rosettacode.org/wiki/Permutations
20:54:52
Alfr
Josh_2, to get all (that's 2^n) subsets, you can consider the numbers 0 to 2^n-1, every number n corresponds to a selection for elements, e.g. bit i set, choose element i to be part of the n-th set.
20:55:54
nij-
EdLangley[m]: There's js+swank.. and there's parenscirpt. So I guess something like this should work.
20:57:08
mfiano
Josh_2: something like: (let ((list '(a b c d)) (result nil)) (dotimes (i (length list)) (alexandria:map-combinations (lambda (x) (when x (push x result))) list :length i)) result)
20:57:18
_death
the way clog works is by sending arbitrary js via a websocket.. you can generate that js using parenscript
20:57:49
nij-
Josh_2 just to compare the length of code.. (defun comb (list) (let ((l (length list))) (cond ((= l 0) nil) ((= l 1) (list list nil)) (t (append (mapcar (lambda (x) (cons (car list) x)) (comb (cdr list))) (comb (cdr list)))))))
20:59:37
mfiano
Josh_2: Also might want to nreverse the retval, if you want them in increasing order
21:02:18
nij-
EdLangley[m]: I understand that Parentscript can turn on a server that runs its own webpage. Do you know if it can hack a page that's already running?
21:04:18
mfiano
Fixed code: (let ((list '(a b c d)) (result nil)) (dotimes (i (length list)) (alexandria:map-combinations (lambda (x) (push x result)) list :length (1+ i))) (nreverse result))
22:12:05
masinter
(defun comb (x) (if x (let ((y (comb (cdr x)))) (mapc #'(lambda '(z) (push (cons (car x) z) y)) y)
23:04:22
rotateq
lel a friend of mine to who i talked more than one time about CL said "you need some object-oriented language like Java to get a job"
1:42:05
mfiano
Hmm regarding the about combination mapping function, what if I had a list of 3 elements, such as '(0 128 256), and I wanted to find every 4-tuple with repetitions allowed? Can alexandria (or anyone else here) help me?
2:39:15
EdLangley[m]
That way, I don't have to worry about the license of my application's dependencies and my libraries don't impose too much on their users
2:56:57
aeth
I exclusively use the MIT license because all code's reusable library code if you're clever enough.
2:57:40
aeth
My code starts specific and then generalizes until I spin it off. I probably could keep a monorepo instead and skip the last step.
2:57:52
EdLangley[m]
The great thing about not having any contributors is you can just copy it to a library :)
2:58:29
EdLangley[m]
I have a library of utilities I use in all my projects and I just move useful things there
2:58:48
aeth
But then you'd also have to consider e.g. a CLA, and people might not like a CLA that could turn AGPL into MIT
3:00:13
aeth
And I can't really blame them. Promises are kept until you're acquired by one of the 10 tech megacompanies.
3:05:50
aeth
I suppose everyone could assign their copyright to, say, the Common Lisp Foundation or something
3:58:30
ns12
aeth: Dangerous! When an evil beast takes control of the Common Lisp Foundation, they will change the license to a proprietary one! Say goodbye to all the open source Common Lisp libraries!
4:05:16
beach
contrapunctus: define-save-info specifies a list of "save entries", where a save entry is a list of two symbols, an initarg (usually for some slot) and the name of a reader that corresponds to that initarg.
4:05:20
mfiano
I don't mind using copyleft software, but developing with, especially for the purpose of making a living, is out of the question.
4:15:48
lisp123
When connecting to a remote image in SLY on your current machine, I'm experiencing a tiny amount of lag - does anybody else have this?