freenode/#lisp - IRC Chatlog
Search
16:13:14
flip214
any alexandria maintainers around to take a look at https://gitlab.common-lisp.net/alexandria/alexandria/merge_requests/7, please?
16:39:56
anamorphic
Do I need to wrap a defparameter in some kind of eval-when in order for it's binding to be seen from within a macro?
16:40:59
pjb
anamorphic: clhs defparameter says: If a defvar or defparameter form appears as a top level form, the compiler must recognize that the name has been proclaimed special. However, it must neither evaluate the initial-value form nor assign the dynamic variable named name at compile time.
16:44:16
anamorphic
Ah OK. So (eval-when (:load-toplevel :compile-toplevel? I'm not sure if I need :execute
16:46:20
pjb
But if you define it at compilation-time, compute the value at compilation time, perhaps it cannot work if you load only the source? Or perhaps you can also compute the value when just loading the source. Depends on your program.
16:47:12
pjb
For example, when you define functions to be used by macro, you usually don't need them at run-time (unless you plan to use the macro at the REPL, say). In that case, you can skip the :load-toplevel situation.
16:47:34
pjb
So the compilation-time function don't take space at run-time (unless you load the source of course).
16:47:57
pfdietz
If you use the macro in another file those functions better have been loaded, though.
16:49:34
pjb
It's true, that an implementation could fork a different compilation environment for each compile-file that is not within the same with-compilation-unit. Ie it could throw away compilation-time definitions :-)
16:50:02
pjb
In that case, loading the compiled files between compile-file would be essential, and you'd have to include :load-toplevel for those functions.
16:55:03
|3b|
if you skip loading the files you use in macros, you will probably eventually be annoyed when you try to fix something interactively that uses it :)
16:57:11
HighMemoryDaemon
Does a pathname (ex. #p"~/Documents") offer any benefits over a regular string? In Quickproject's make-project function, I noticed that regular strings work too.
16:59:33
|3b|
main place i can think of it would matter is things that try to guess intent from types, for example something that would interpret a string as input, and a pathname as name of file containing input
17:22:00
|3b|
: is just part of the symbol syntax in the reader, with no real name. #p and #' are reader macros
17:22:37
emaczen
What happens with the memory management of pointers (with CFFI) and multiple threads (with bordeaux-threads)?
17:22:45
|3b|
(specifically # is a dispatching reader macro, with p and ' being specific instances of that particular dispatching reader macro)
17:23:03
emaczen
For example, If I create a pointer on a thread, then use it in the main thread, where does it need to be freed?
17:24:31
|3b|
symbols (including the : or :: ) and numbers are built into the reader syntax though, so you can't really change how those are read without just parsing everything yourself
17:25:56
emaczen
anamorphic: but it doesn't explain why I seem to leak more memory with multiple threads then not
17:25:57
|3b|
scymtym: thanks, thought there probably was actually a name after i wrote that, but forgot to go look it up
17:28:12
|3b|
(and to clarify for original asker, #\ is another dispatching reader macro on # that reads a character, so #\: reads as the character : and in general that's how we'd talk about characters when talking about CL. i skipped them previously to try to simplify the answers)
17:33:38
pjb
That said, we could as well talk about the character "a": (character "a") #| --> #\a |# ;-)
18:13:11
HighMemoryDaemon
In my projectname.asd file, is there a good way to use a system that is in a folder of my project? Ex. 'pathnames-lib/pathnames.asd'. I could symlink it to my ~/common-lisp folder but I'd prefer not to.
18:25:26
HighMemoryDaemon
This is what I ended up going with. https://hastebin.com/mukebifepo.lisphttps://hastebin.com/mukebifepo.lisp . Of course I would have to follow the second half of that article if I end up needing to do something similar in a .lisp source file.
18:35:49
flip214
shka_: I guess you'll need a new slot metaclass.... or you re-use eg. the documentation slot (urgh)
18:37:59
Bike
https://github.com/clasp-developers/cl-jupyter-widgets-old/blob/master/src/iwidgets/widgets/traitlets.lisp here's one i wrote that adds observers and stuff. needs... direct/effective-slot-definition-class, compute-effective-slot-definition
21:41:48
phoe
flip214: thanks for the review! The typesetting isn't final at all, I'll still be moving things around
21:42:08
phoe
I mostly wanted a review of the content; I didn't specify that clearly, so sorry about that
0:03:22
emaczen
Is CFFI just a portability library using the FFI of whatever CL implementation is being used?
0:04:15
luis
CFFI-SYS is a portability layer. And then CFFI implements a bunch of features on top of that.
0:07:41
void_pointer
emaczen: if you want to see how cffi-sys uses the features of whatever implementation it is on (out of a particular list), take a look at the different implementation specific files in https://github.com/cffi/cffi/tree/master/src
0:08:45
void_pointer
emaczen: for example, if you look in the SBCL one (https://github.com/cffi/cffi/blob/master/src/cffi-sbcl.lisp), you will see heavy use of the sb-sys package that is builtin to SBCL
0:09:49
void_pointer
emaczen: there are probably some uses of it there too. Just, sb-sys was what stood out to me just a minute ago.
0:11:46
void_pointer
most of the time one doesn't need to access it directly, and just use cffi which uses it in the background
1:32:24
emaczen
How do cffi:defcvar cffi:defcfun and cffi:defcstruct work and how does C expose variables, functions and structs so that we can interface?
2:20:41
p_l
emaczen: usually whatever the operating environment has for dynamic symbol resolution, which gives back pointer, which is wrapper appropriately for the Lisp code