freenode/lisp - IRC Chatlog
Search
7:18:27
phoe
sure thing I would, since the original term "design pattern" attaches itself to things as petty as the Singleton and the Decorator
8:52:47
p_l
phoe: btw, have you read the original Design Patterns (I haven't, it's on The List)? I wonder how Smalltalk version matches up to the C++/Java cargo cult
9:45:43
dim
my understanding (which needs fact checking, conversations, actually reading the book, etc) is that Design Patterns are mostly useful when all you have is Single Dispatch and Single Inheritance ; when you have multiple dispatch and a way to compose methods yourself, I'm not sure you actually need many of the design patterns... you just don't have those problems they're solving...
9:47:31
beach
dim: Those are the design patters that are mostly described in the book. But that doesn't mean that those are the only useful design patterns, so there maybe others in languages that don't happen to need the ones from the book.
9:48:36
dim
(well I said only the first half, it would be more fair to say that I also agree with the other part you're adding)
9:49:43
dim
I think http://www.norvig.com/luv-slides.pdf could be understood as some kind of Lisp design patterns too
9:54:49
dim
oh ok I failed to remember that my feeling about design patterns and lisp actually come from that slide deck, thanks for the reminder ;-)
9:56:38
phoe
basically, some design patters may disappear as the underlying language becomes actually capable of supporting the concepts behind those patterns in better ways
10:18:29
ajithmk
What's the lisp way of saying var1[0] or var1[1] when var1 is pointer to an array of structs?
10:25:59
scymtym
norvig silently generalizes a bit and doesn't say this explicitly, but there is also the fact that OOP design patterns revolve around assigning responsibilities. and by that the OOP people mean assigning responsibilities to classes which doesn't make that much sense in a CL context
10:27:15
phoe
scymtym: yes, e.g. one can also assign responsibilities to methods in CL wrt :BEFORE/:AFTER/:AROUND - I think Norvig mentions that example in his slides
10:29:37
jackdaniel
(defclass irresponsible-class (standard-class) ((do-it-p :initform :usre :reader do-it-p)))
10:29:38
scymtym
phoe: sure, but i mean that the whole methodology is structured around "packages contain classes, classes contain methods". motivations such as avoiding "god classes" or controlling coupling between and cohesion within classes only make sense in that framework
10:31:30
scymtym
one could say that CL classes take on responsibilities of the "knowing something" kind, but "doing something" is often the more important kind
10:31:36
jackdaniel
one could argue, that auxiliary methods introduce unexpected processing steps to a person, who adds their own method, and in this sense they water down resposnibility
11:44:33
flip214
Can I parse an ALIST with DESTRUCTURING-BIND as well? Or some other CL function? (Yes, I know about ALEXANDRIA:ASSOC-VALUE)
11:47:19
jackdaniel
(destructuring-bind ((a . b) (c . d)) (list (cons 1 2) (cons 3 4)) (list a b c d)) ; works
11:48:15
jackdaniel
(loop for (a . b) in (list (cons 1 2) (cons 3 4)) collect a collect b) ; also works
11:48:43
phoe
d-b won't work on reordered alists though, it can't perform this sort of pattern matching
11:49:24
jackdaniel
I'm certain I said that that it does not know anything about keys or values, hence - about the order ,-)
11:50:38
jackdaniel
flip214: you may put CASE in the loop to match keys, or alx:switch if keys have a custom test
12:02:13
kinope
Do any of the Common Lisp implementations support assigning threads to run on specific cpu cores?
12:04:05
p_l
kinope: I don't think there's anything explicitly made in Lisp-side APIs, but you can easily use CFFI to call out necessary system-level functions
13:13:46
luna_is_here
Can I use the same quicklisp installation folder for two CL implementations or will this cause problems?
13:16:45
jackdaniel
clisp has bundled asdf version which is quite old, old enough to make libraries not load
13:17:21
jackdaniel
either take asdf from upstream repository and load it instead, or use one of more popular implementations, like sbcl
13:18:06
luna_is_here
I usually use SBCL. I just want something less memory hungry (and faster startup) for some small scripts.
13:18:25
jackdaniel
I know that Fare put a lot of effort into upgradability, but 1. it is still broken, 2. it obfuscates asdf beyond compare :)
13:19:21
jackdaniel
but still, it compilicates things enormously, so if you can load desired asdf version upfront - simply do it
13:20:17
jackdaniel
ccl has smaller footprint, ecl even smaller (however startup and compilation time may be too big for you)
13:21:17
jackdaniel
last time I've checked all worked fine (-eish, clisp seems to be little neglected by library developers when testing)
13:24:42
jackdaniel
the reason is because Fare considered it important -- for system which runs for long time without downtime it may be desireable to be able to upgrade asdf to load some new software
13:25:46
jackdaniel
my opinion on this matter is that a build system should not be part of the final image (like you do not bundle make with your terminal application), and should be loaded only when it is needed (and unloaded / GCed afterwards)
13:25:58
terpri
seconding clozure common lisp (formerly openmcl) as an sbcl alternative. not much experience with ecl, abcl, proprietary CLs, etc.
13:27:24
jackdaniel
otoh, when not bundling it, someone may want to maintain a loaded software registry, so that may be duplicating the effort
13:27:48
terpri
i mostly use sbcl but it is a bit slow to start up and indeed a bit resource-intensive
13:27:49
jackdaniel
dlowe: no, that's not a next thing I'm going to say, please do not put words in my mouth
13:27:59
pve
jackdaniel: if you were able to unload asdf, would that effectively give you upgradeability as well?
13:28:26
phoe
pve: kind-of-in-theory, you'd also lose all information about already loaded systems though.
13:28:31
jackdaniel
dlowe: it might be, still quite provocative / not especially polite, especially that I've explicitly marked it as my opinion, not the "right thing"
13:28:41
terpri
(and i use clisp, but only for command-line hackery, mostly because it has gnu readline built-in...which is in fact *why* clisp is free software :P)
13:30:37
phoe
except via explicit state dumping/loading, not via UPDATE-INSTANCE-FOR-REDEFINED-CLASS
13:31:40
phoe
pve: dumping state, unloading ASDF, loading ASDF, and loading state is equivalent to upgrading ASDF in-place
13:31:48
jackdaniel
and it tries hard not to drop information which was stored at the "old asdf" runtime
13:32:15
terpri
fare was also at one point working on an asdf successor(?) called xcvb, dunno what happened with that