freenode/#lisp - IRC Chatlog
Search
5:24:09
jasom
something like: (defun mmap (name &rest lists) (map (lambda (&rest args) (apply #'send name args)))
5:24:50
jasom
something like: (defun mmap (name &rest lists) (apply #'map (lambda (&rest args) (apply #'send name args) lists))
5:26:38
jasom
the one advantage send has is that name collisions are not a problem with it; short names for generic functions can collide preventing you from importing two methods
5:29:26
pillton
i.e. One set of methods for a generic function perform a task that is different to what is done by others.
5:32:52
jasom
I was thinking of semantically differing overloads in less capable object systems (most famously C++'s (ash stream "foo") for output)
5:34:29
jasom
like much of C++ I waver between admiring it's cleverness and running away in horror at it's ugliness
5:36:08
beach
jasom: You would have to give up lots of Common Lisp standard functions, or make them harder to use. Consider the :TEST and :KEY of the sequence functions. You now have to wrap them in (lambda (object) (send 'key object)) etc.
5:36:54
beach
jasom: Again, I think part of the reason for CLOS generic functions was to maintain the usefulness of existing Lisp functions like the sequence functions, the mapping functions, reduce, etc.
5:37:14
jasom
I was wondering about the motivation for CLOS as the object systems that predate it were mostly of the SEND variety
5:37:56
pillton
Where they the send variety where the processing of the "invocation" was done asynchronously?
5:45:37
pillton
I guess it boils down to subjective concepts like granularity, modularity, reusability and some others I've forgotten.
6:07:53
flip214
> there is cl-cont which works by CPS transformation, so if performance is your concern it's not ideal.
6:41:47
flip214
well, I would have guessed that compilers are smart enough to translate "CALL function; RET" into "JUMP function" anyway, and then there shouldn't be any differences
6:47:35
Bike
i mean, say you have (+ (+ a b) c). you'd rewrite that as like (cps+ a b (lambda (v) (cps+ v c k))). the compiler is maybe not smart enough to figure that v is always a number so it might put in an extra check that's obviously unneeded.
6:51:55
flip214
IIRC only calls to function that got explicitly _marked_ as "may sleep" resp. "may switch tasks away" would get transformed?!
9:18:33
ecraven
is there a library that automatically handles reading and writing xml based on clos classes or structs/records?
9:21:14
ecraven
I just looked at that (for 15 seconds), didn't see anything about directly parsing to CLOS objects
9:22:06
ecraven
aye, but I'm looking for some way to "declare" a clos class that will magically work
9:22:15
ecraven
I want something like (def-xml-class game (id attribute) (name attribute) (description element)...)
9:22:18
phoe
also, what do you mean, parsing into CLOS objects? how do you teach it how it should parse a given XML?
9:29:50
loke`
Poorly named function, but it takes a DOM node and creates an instance of the class and initialises it based ont he XPATH definitions in the defclass.
9:30:23
loke`
Here's how it's defined: https://github.com/lokedhs/status-net/blob/master/src/status-net.lisp#L75
9:34:03
loke`
ecraven: The code is a bit specialised for the Atom format (especially when it comes to names :-) ), but you can use it as a template.
9:46:18
loke`
I willing to take the risk, since I'm generally using it to temporarily comment out code.
10:44:53
easye
No CDR for package-local https://common-lisp.net/project/cdr/final.html ? This is where post-ANSI standards are currently best ratified.
10:48:06
jackdaniel
yes, ecl develop branch has package local nicknames, but it's not in any release yet
10:48:45
jackdaniel
regarding CDR, see comments under commit: https://github.com/nikodemus/SBCL/commit/3c11847d1e12db89b24a7887b18a137c45ed4661
11:12:15
jackdaniel
regarding compatibility - application using package-local-nicknames won't work on implementation not supporting it. but application using ffi won't work on implementation not supporting it either.
13:31:36
|3b|
easye, phoe: i think the consensus before it was added to sbcl was that specifying package local nicknames well enough for a proper spec/CDR was too hard for the available resources and usage experience, but the informal spec from my prototype was enough to be useful
13:33:54
|3b|
pillton: i use package local nicknames, but only in "end product" type things, not general libraries intended for other people to use
13:42:05
|3b|
ACTION 's original spec is at https://github.com/3b/package-local-nicknames/blob/master/docs.org
13:43:44
|3b|
at this point, probably would be best to just write up what SBCL does as a CDR if someone has the interest and time
13:49:01
jackdaniel
SBCL specifies some of its internal quirks (like interaction with package locks) - I think that this part should be skipped for CDR
13:50:16
|3b|
unless someone wants to write a CDR for those too, and then specify the interaction in terms of that :)
13:50:57
jackdaniel
that could hinder the adoption. for instance ECL lock slighly different set of things in packages afair, same thing may go for ABCL and CCL
13:51:24
|3b|
well, if they didn't match the description in the locking CDR, it wouldn't apply to them
13:55:15
|3b|
would be nice to see local nicknames implemented more widely though, so it would have a chance of actually solving the original problem (libs nicknamed JSON and GL)
14:49:41
fourier
i've seen here: http://cl-cookbook.sourceforge.net/os.html but just want to get some library instead of copy-pasting