freenode/#lisp - IRC Chatlog
Search
1:19:44
save-lisp-or-die
there's a cool use for when you want to stack allocate a value http://www.sbcl.org/manual/#Dynamic_002dextent-allocation for efficiency reasons.
1:23:52
save-lisp-or-die
So if you're consing a tonne of memory in a hot loop that the garbage collector is hiccuping to free, stack allocation might be useful there.
1:31:16
no-defun-allowed
Well, allocation with a moving GC is almost comparable to stack allocation. It's sometimes useful, but I don't bother with dynamic-extent.
1:32:54
save-lisp-or-die
does ECL respect it? I could see maybe on resource constrained devices it might be useful.
1:35:08
no-defun-allowed
I am not sure if ECL is the right implementation with small resources; don't you either need a C99 compiler or bytecode interpreting?
1:37:52
no-defun-allowed
Also, see "Garbage collection can be faster than stack allocation" <ftp://ftp.cs.princeton.edu/reports/1986/045.pdf>. That should be read with heavy emphasis on "can".
1:37:59
mfiano
Additionally, implementations need only to honor NOTINLINE, and SPECIAL declarations, and conform to the safety rules for OPTIMIZE
1:39:16
no-defun-allowed
If you can free enough in one GC cycle, it eventually becomes faster to not un-bump the stack pointer.
1:40:08
no-defun-allowed
But really, the memory overhead for that to happen is ridiculous. The moral of the story is everthing is a time-space-sanity tradeoff.
1:40:57
no-defun-allowed
(And Firefox crashed after sending that. I'm not one for conspiracy theories though.)
1:41:52
no-defun-allowed
The SPECIAL declaration means that variable will use dynamic binding, instead of lexical (like you usually expect, and is default in Common Lisp). I usually prefer to write (defvar *foo*) to make *foo* a special variable though.
1:44:59
no-defun-allowed
Usually people write a program like this to demonstrate: (let ((x 3)) (defun g () x)) (defun f () (let ((x 2)) (g)))
1:45:21
no-defun-allowed
If X is lexically bound, then (F) returns 3. If X is dynamically bound, it returns 2.
1:49:09
no-defun-allowed
Dynamic binding will give you the last value bound, no matter where it's bound; and lexical binding will give you the last binding you can see where the variable is used.
1:50:18
no-defun-allowed
For example, *standard-output* is a special variable. If I evaluate (with-output-to-string (*standard-output*) (room)), it will be bound to the string output stream WITH-OUTPUT-TO-STRING makes, and ROOM will write to that.
1:52:30
lotuseater
or if you do something like (let ((*print-base* 16)) ...) or (let ((*gensym-counter* 1)) ...)
4:09:18
phantomics
A question about SICL: what kind of support will it have for ASM generation? Anything like define-vop in SBCL?
4:10:40
beach
phantomics: Since all the stages are programmable, it should be possible to customize at will.
4:10:57
phantomics
Lets you implement functions in assembly: https://pvk.ca/Blog/2014/08/16/how-to-define-new-intrinsics-in-sbcl/
4:13:21
phantomics
I'm looking into it to optimize my project; unfortunately, it will only work under SBCL and there's no ASM generation faculty that works across implementations
4:13:43
beach
phantomics: I have not thought of a similar way in SICL. However, since code generation is done with generic functions that take a CLIENT object that can be specialized to, then code generation is very easy to customize.
4:14:35
beach
phantomics: It is also easy to define new IR instruction classes, new AST classes, and new primitive operations (primops) to use at the source level. I do that all the time.
4:18:42
beach
Since SICL uses the Cleavir compiler framework, and Cleavir was designed to be implementation independent, we designed it from the start to be extremely flexible and adaptable to different implementations.
4:20:22
beach
But I haven't given enough thought to a consistent protocol for tweaking code generation within an implementation.
4:37:15
phantomics
You can see a lot of define-vop examples in this directory: https://github.com/sbcl/sbcl/tree/master/src/compiler/x86-64
4:38:27
phantomics
You can see optimized functions for handling arithmetic, arrays, etc. It's the x86-64 specific stuff, in the neighboring directories you can see implementations for ARM, Power, RISC-V, etc.
4:40:18
pillton
I need help figuring out the noun for something. Assume X is an instance of the class C. (apply #'F X args) returns Y and (funcall (apply #'F C args) X) returns Y. Is there a noun which describes the function F?
4:41:38
pillton
The closest thing I have found is lazy evaluation but I am not sure if that is correct.
4:44:29
beach
The function F is a bit strange since it can take arguments of different "meta" levels.
4:45:15
pillton
Knowledge of the class C is important. I was wondering if Cleavir would be useful for optimising the graph generated by successive compositions e.g. (funcall (optimize-computation (apply #'G (apply #'F C args) args2))).
4:48:16
pillton
No worries. I have lost track of the time and I need to pick up kids. I'll be back in a bit.
4:48:55
lotuseater
speaking of currying and nouns, did you know, another noun for it is Schönfinkeln :)
5:54:44
janislago
but im doing this just for clarity and to give myself a readily identifiable name i suppose
5:59:54
beach
You should know that #lisp is fairly strict with staying on topic. There is #lispcafe for idle chatting.
6:00:25
janislago
was just about to mention that emacs lisp is a little weird when youre adjusted to cl
6:04:39
beach
janislago: You need to be a little bit careful with that approach. Common Lisp has several implementations that behave differently, and lots of behavior is unspecified by the standard, so you may accidentally produce non-conforming code without knowing it.
6:09:05
janislago
could you relay to them that on windows 7 and probably later versions, there is an error with attempting to access files via (load) where an error signals for "the operation completed successfully." this occurs both when running as admin and running as a normal user
6:11:06
janislago
yeah its not my first choice for programming but win7 runs incredibly well even in 2020
10:41:55
beach
Wow, that was a scary bug. In SBCL I did (make-instance 'standard-generic-function :lambda-list '(x)) and initialize-instance signaled an error that the value of the :METHOD-COMBINATION initialization argument had to be a method-combination object, but that instead it was... the STANDARD method-combination object. Restarting SBCL made the problem go away.
10:43:42
beach
The combination of bugs like this (SBCL or my code, doesn't matter much) and inadequate tools for finding the problems makes the task of development less pleasant than it could be, and certainly way more time consuming.
10:50:13
ck_
Were these types of one-off mystery bugs always around like that, or do you think these situations have become more frequent?
10:52:28
ck_
Increased project size that comes with more powerful environments and more people with access to them might be a conceivable reason
10:53:23
beach
Sure. I have no hard evidence that it is a problem with SBCL. But I couldn't guess what I could have done myself to make it happen.
10:54:16
beach
My favorite reason is to blame too complex code, due to many decades of modifications.
11:58:13
flip214
Is there a macro like DESTRUCTURING-BIND that takes an alist in instead of a plist?
12:02:51
jackdaniel
otoh alists are easier to access with functions like find (thanks to the key argument)
12:05:53
flip214
jackdaniel: not matching, just (destructuring-alist (foo bar baz) (function-returning-an-alist) ....)
12:06:29
jackdaniel
could you elaborate? (destructuring-alist (foo bar baz) '((foo bar baz)) ...) ;?
12:09:11
phoe
I understand the syntax to be like (d-a (foo bar baz) '((foo . 1) (bar . 2) (quux . 42) (foo . :one) (baz . 3)) ...)