freenode/#lisp - IRC Chatlog
Search
14:51:32
LdBeth
paule32: u add ":reader what-ever-name" after ":initarg :name" and call "(what-ever-name powerFuraCell-AAA)" to access the name slot
15:40:11
szmer
is there a way to get in SLIME/SBCL the version of a definition with purposes of variables like #:G8 visible? I already have optimize debug 3 declaimed, macroexpands don't do this
16:14:34
beach
szmer: I don't know the internals of SBCL, but that's the kind of thing that a typical compiler would generate for intermediate results that are not explicit in the source code.
16:16:13
beach
szmer: ... like if you have (f (g x)), the compiler may generate code such as (setq #:G234 (g x)) (setq #:G345 (f #:G234))
16:25:44
szmer
beach: but this http://www.sbcl.org/manual/#The-Processing-Path suggests that some representation like this should exists somewhere
16:38:00
another-user
where can i find list of all functions operating on trees like subst? iirc clhs had something like this but can't find it now
16:40:16
jcowan
FWIW, I don't avoid the use of `list` as a local variable in Scheme, as there is absolutely no need to do so unless I am going to call the standard `list` procedure within the lexical scope of the variable. That said, outside list libraries, it's usually better to call something foo-list to indicate that it has foos in it.
16:40:50
jcowan
This supposed advantage of Lisp-2s is really not much of an advantage. (There are others.)
16:42:00
edgar-rft
another-user: you probably are looking for Chapter 14.2 The Conses Dictionary, e.g. here http://www.lispworks.com/documentation/lw50/CLHS/Body/c_conses.htm
16:43:04
aeth
jcowan: I think you might underestimate how often this shows up in CL because you're used to Scheme. Separate class/type namespace is arguably as important as the other two, e.g. (check-type list list)
16:44:32
aeth
jcowan: And (check-type list list) is a bad example because a list often isn't a good name for a list. But foo is often a good name for a foo.
16:45:18
jcowan
Since types are not standardized, there are various approaches to naming them. As I noted on #scheme, I write <foo> for a record-type, reserving foo for the constructor of immutable records and make-foo for the constructor of mutable ones.
16:51:33
aeth
(In anticipation of being pinged 5 hours from now, yes, you can technically have a class named |Foo| in CL. No, you shouldn't do that and I think anyone who reviews pull requests on Github/Gitlab/etc. would fail such code.)
16:52:10
aeth
(Unless it's some really niche case that's interacting with foreign code or a database or something.)
17:47:39
mgsk
I have some slot that has :TYPE SIMPLE-VECTOR. On SBCL, if I try to initialize that slot with (make-array 0 :adjustable t :fill-point 0) (i.e. *not* simple), it works fine. On CCL however it does not, raising a type error. Is this behaviour (by the standard) implementation dependent? Obviously I should reconsider whether my type should by SIMPLE-VECTOR, but that's not my question.
17:50:07
mgsk
phoe: Can you elaborate on why SBCL does this? Also does the standard not require that type info is respected?
17:55:16
aeth
mgsk: It's a terrible antifeature and other implementations might behave similarly. To get around this, you have to use the metaobject protocol. I do so here: https://gitlab.com/zombie-raptor/zombie-raptor/blob/85c0f38945d44dd0f6984a5db53ca8dbfbd875ff/util/metaobject.lisp
17:56:33
mgsk
aeth: which part is a terrible antifeature? That SBCL does or doesn't always respect :type?
17:56:38
aeth
You could also wrap the defclass in a (debug 3) declaration, but that could have other effects, and it wouldn't fix this behavior on other implementations that might behave differently and never check :type
17:57:16
aeth
mgsk: It's terrible that it has the capability to check type in a defclass slot, but doesn't normally do it. Especially since it's the most reliable implementation for defstruct typechecking.
17:58:33
mgsk
aeth: I'm guessing it chooses not to typecheck for efficiency's sake? i.e. if you want type checking, you have to opt-in to the run-time slow down?
18:00:23
aeth
SBCL singlehandedly makes people reimplement a(n apparently optional) part of the standard because the default settings on the most popular implementation (SBCL) don't respect :type
18:02:18
aeth
SBCL is normally the implementation to use if you want type information to be respected in a reasonable way, like in structs, declarations, etc. Pretty much everywhere except defclass
18:02:47
aeth
But it focuses on types-for-efficiency, which is why they probably don't care with defclass slots
18:04:25
phoe
but also why some things simply cannot be optimized away into simple pointer lookups and such
18:08:38
aeth
defstruct is often implemented like defclass, but with redefinition restrictions so things like slot access via accessors can be inlined. The catch is that this means that in some implementations you can't redefine defstruct, which hurts the typical CL interactive workflow. You also can't afaik fix things via the MOP, like you can do with defclass.
18:09:37
aeth
define-condition also exists, for the condition system. So CL kind of has three class systems afaik.
18:17:39
aeth
position could also work, but that's trickier since it might conflict with the standard function POSITION
18:20:06
phoe
but then again, if you just allocate an artificial chunk of raw memory, then you effectively have pointers
18:20:27
aeth
shka_: It's only acting like a pointer if it's an array that has an element-type whose upgraded-array-element-type isn't T
18:30:04
phoe
paule32: instead of setting a global variable CDRAHT, use a local variable, and return the object.
18:33:19
phoe
I don't know how to help you. After all these months, you still to seem not to even try to write idiomatic Lisp.
18:36:01
paule32
ah ii understand - may be, (return-from draht-Cu1600 1) is direct context of the methode
19:47:16
ck_
Oh, ok. I didn't realize when we last talked that the secret to getting a response is to not address you directly.
19:49:44
paule32
ck_: don't be worry, my mother language is not english, so i have translate it when read + write, and so missunderstandings go on...
19:55:15
mgsk
Any ideas as to why (bt:destroy-thread *thread*) (print (bt:thread-alive-p *thread*)) => T ?
20:10:51
mgsk
I don't understand. *thread* is something returned by bt:make-thread. Why wouldn't bt:destroy-thread accept that (and also do what its name suggests)?
20:18:54
pjb
in ccl, (defparameter *thread* (bt:make-thread (lambda () (sleep 100000) 42))) (bt:destroy-thread *thread*) (bt:thread-alive-p *thread*) -> NIL
20:34:23
mgsk
pjb: I think I'm starting to understand what is happening. (bt:destroy-thread *thread*) (loop :while (bt:thread-alive-p *thread)) (print (bt:thread-alive-p *thread*)) => NIL
23:32:53
no-defun-allowed
In CL-WHO, it's printed if you give the WHO macro :prologue t from memory, maybe there is something like that?
0:35:49
moldybits
in CLOS, i have a class that no methods specialize on, but i want to handle any attempt of applying any method to it. (defmethod whatever ((x number)) x) (defclass foo () ()) (whatever (make-instance 'foo)) ; instead of erroring i want to intercept this
0:37:24
moldybits
my goal is to have an object that defers every method application and slot-value to another object seamlessly, except for chosen methods/slots that i want to override
0:37:43
no-defun-allowed
(defmethod no-applicable-method :around (gf &rest arguments) (if (find-if (lambda (x) (typep x 'anti-social-class)) arguments) do-something-else (call-next-method))) might work
0:39:31
oni-on-ion
wasn't someone in here looking for something like this recently ? https://github.com/plops/cl-cpp-generator