freenode/#lisp - IRC Chatlog
Search
18:11:42
gaze___
hey folks, I'm getting back into lisp after a long hiatus and I've hit a bit of a snag. I have a directory with a file called main.lisp and a file called foo.asd... foo.asd contains (asdf:defsystem foo ...). I open emacs, I open main.lisp, I M-x sly, and then I M-x load-system foo, and I get an ASDF/FIND-SYSTEM:MISSING-COMPONENT
18:13:58
Xach
gaze___: or there must be some way it can find the foo.asd file through its various ways
18:14:08
Acru
hey, I am having a problem with compiling a lisp program: when running it, I include "split-sequence" via (ql:quickload "split-sequence"), but when I complile it i get the error *** - READ from #<INPUT BUFFERED FILE-STREAM CHARACTER #P"/home/antono/Projects/codenchill/median.lisp" @15>: there is no package with name "SPLIT-SEQUENCE", and when I declare (asdf:load-system "split-sequence") I still get the error
18:15:35
Xach
Acru: the call to ql:quickload does not happen in time for it to make the package name available for reading in the same file.
18:16:21
Xach
katco: one way is to push the symbol 'cl:*default-pathname-defaults* to asdf:*central-registry*
18:16:46
Xach
Acru: one option is to wrap the quickload form in (eval-when (:compile-toplevel :load-toplevel :execute) ...)
18:17:01
Xach
Acru: another option is to use a system definition that sets up all the things to load before loading your code.
18:17:28
gaze___
Xach: let's suppose I add a (pushnew "~/path-to-project/root/" asdf:*central-registry* :test #'equal) to my .sbclrc... does that mean that it'll find ~/path-to-project/root/project1/project1.asd, ~/path-to-project/root/project2/project2.asd?, etc.?
18:17:40
Xach
gaze___: i use quicklisp so i usually stick projects in ~/quicklisp/local-projects/ - those are found automagically
18:18:00
katco
ACTION sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/orfeuFcrDhIHhGtpgCxpKdFb >
18:19:27
katco
Acru: https://www.common-lisp.net/project/asdf/asdf.html#Controlling-where-ASDF-searches-for-systems
18:19:53
gaze___
just to be clear, when you start new projects, you just put them in local-projects?
18:20:53
katco
gaze___: they just need to be under the root of one of the places asdf knows to search for projects. if you're using quicklisp, `local-projects` is one such place
18:21:19
katco
i used to put my projects where i liked them to reside and then symlink them to `local-projects`, but i like the conf file solution better
18:21:34
Xach
https://xach.com/tmp/quickstart.html has a self-contained simple project with a system definition.
18:28:07
jackdaniel
another kind of chart for polyclot (wip integration with cl-bench): https://files.mastodon.social/media_attachments/files/014/697/322/original/c1c1e5a45dbd4a25.png
18:29:48
jackdaniel
putting there clisp results would make two things happen: charts would be less readable and ecl would look much better in comparison ,)
19:00:41
gaze___
okay, maybe a goofy question but what's the recommended way to patch additional functionality into a library? pzmq for instance doesn't have the encryption functions implemented. Suppose I don't yet want to submit a pull request, I just sorta want to hack the functionality in place for testing and I don't want to edit pzmq itself
19:03:03
Bike
for temporary patching that kind of thing is fine. it gets dicey when you try to maintain it, though.
20:12:00
asdf_asdf_asdf
Hi. How get signature callback (function) in SBCL (Common Lisp)? I try: (* func), not working. I defined callback, it: (define-alien-callback ...).
20:14:54
gaze___
maybe a bit of a contentious question, but is there a way to strip symbol names from SBCL when doing save and die?
20:15:19
gaze___
I know it's impossible to fully stop reverse engineering, but it'd be nice to slow it down a bit.
20:15:46
gaze___
and if not with SBCL, is it possible with CCL, CMUCL, one of the more major implementations
20:18:47
asdf_asdf_asdf
gaze___, looks for it: https://koji-kojiro.github.io/sb-docs/build/html/index.html
20:20:32
Bike
https://bugs.launchpad.net/sbcl/+bug/310108 i think stripping an sbcl binary will be problematic.
20:21:58
asdf_asdf_asdf
(define-alien-type nil (struct WNDCLASS (lpfnWndProc 'WindowProc))) How pass signature function to type struct?
20:22:30
Bike
asdf_asdf_asdf: can you just use cffi, as several people have now suggested? it's more common and documented.
20:22:33
anamorphic
gaze___: maybe you can define your own perverted defun and friends to hash the friendy names
20:24:29
gaze___
I'm not entirely sure why the names have to be retained to begin with... isn't SBCL ultimately a compiler?
20:25:08
gaze___
well okay... I guess that functionality is retained so you have to go out of your way to break it.
20:25:08
whartung
…in an ostensibly interactive environment. where meta data and debug information is always valuable.
20:27:41
Bike
sbcl is public domain so you can do whatever with it, but it's common to share sources (e.g., quicklisp)
20:28:33
gaze___
ah well, employers don't always want the details of the architecture of their hardware being broadcast to the world... so if I'm developing a compiler or something
20:28:37
whartung
it would not surprise me if Franz or Harlquins lisp had more aggressive stripping utilities.
20:29:06
Bike
i'm not judging you, i'm just saying what you're doing is not how sbcl is usually used, so it's unlikely to be supported particularly, you know?
20:29:52
Bike
they do stuff like avoid distributing the compiler for the sake of their own IP, stripping doesn't seem far off from that
20:31:33
whartung
just check the pacakge of the symbol so you don’t mung CLUSER etc. That would probably be Bad.
20:32:51
grewal
Change your application design/business model so they never have the executable on a computer they own
20:34:04
whartung
Mind I’m a terrible person to talk to about this, as I don’t grok the fear management is feeling.
20:34:24
gaze___
I mean if even to keep customers from going "ooh there's a lisp interpreter in here" and introducing bugs and complaining to support
20:35:04
gaze___
I don't so much mind people having a whack at reverse engineering... it's always, always possible. A bit of friction might be good tho.
20:36:01
Bike
well, like i said, distributed lispworks programs don't have an interpreter or compiler or anything available.
20:37:50
gaze___
trying to figure out how to strip this information might not be a bad way to learn a bit about SBCL's internals... which, ya know hey, if you wanna master a language, master the compiler.
20:39:31
Bike
also, a tree shaker is kind of different, no? if anything, having a bunch of useless things in the image would make it harder to figure out.
20:39:40
whartung
I honestly off the top of my head don’t know how to lookup a symbol given the text of it.
20:41:39
Bike
eliminating certain things might be problematic. for example, sbcl uses jit compiles for make-instance, so if you're not careful removing the compiler could wreck CLOS.
20:50:39
gaze___
seems like what I wanna do is somehow deep inside sbcl/src/code/target-package.lisp
20:59:25
anamorphic
gaze___: what industry are you in where your binary needs to be scrubbed like this? (curious, if you don't mind)
21:07:58
gaze___
yeah ok, there's someone called nuke-symbol in there that could probably be used as a reference
21:10:24
whartung
symbols are, at a base level, made of two components: the package and the symbol text.
21:14:59
anamorphic
gaze___: I long time ago juho snellman (I think) posted a snippet on github gist somewhere that did a pretty good tree shake. I don't recall what it did with symbols though and I'm having trouble finding it
21:17:09
anamorphic
Huh 17 days ago though... I think there was an earlier attemp that was quite comprehensive too
21:41:41
aeth
anamorphic: Yes, that might work. I think if you operated under the assumption that in e.g. a loop it's probably going to be the same method call(s) for the same generic function, you'd probably be right more than wrong.
21:42:26
aeth
Like if you had a list-or-vector generic, it's probably going to be dispatching on the same class repeatedly.
21:43:18
aeth
But you could do proper JIT, too, which I guess would be something like inlining the probable generic function.
21:52:43
aeth
Actually, I'm curious exactly how make-instance is JITed in SBCL. I always thought CL performance kind of fits in this strange world where AOT-everything-but-CLOS makes sense, but I didn't expect an implementation to actually do it.
21:56:02
Bike
Jitting generic function calls is what beach's clos implementation strategy does. Works well in clasp
21:57:11
Bike
Sbcl jits make instance by replacing obvious calls with calls to a cached function. Since the function can know the class and initargs in advance, it skips a lot of work.
21:59:08
aeth
Is it better for performance to use initargs than your own custom keywords in an initialize-instance defmethod, then?
22:02:07
aeth
It seems fairly common to add keywords to a make-instance with something like (defmethod initialize-instance :after ((object foo) &key
22:04:27
aeth
Bike: Well, I guess I mean that some (not all) of them probably could be rewritten to have extra initargs instead of adding keys, and use those new slots with those new initargs to set the derived values of the other slots, which is what they're probably doing with the keys.
22:18:08
White_Flame
Bike_: by "JIT" do you mean the actual call site is recompiled eliminating the function call, or the callee is recompiled and dispatched through an indirecting pointer?
22:26:57
White_Flame
Bike: yeah, actual call site recompilation would be the only way to fully optimize local numeric types and inline small methods. I wonder how big of a change that would be for existing implementations, if it'd basically require a new one
22:27:04
Bike
it transforms (make-instance 'name ...initargs) into (funcall (load-time-value (ensure-ctor ...) t))
0:29:04
asdf_asdf_asdf
Hi. Which instruction in Lisp do "function pointer" - https://en.wikipedia.org/wiki/Function_pointer? E.g.: "double (*func1)(double) = cm_to_inches;" - How it do?
0:46:14
aeth
asdf_asdf_asdf: This sort of wrapping is seen as boring and is almost always automated in some way, e.g. XML/JSON spec parsing, grovel, cl-autowrap, claw, etc.
0:46:46
aeth
It's possible that the only person who knows the answer is the author of such a tool, and that author will probably say "use my tool"
0:46:48
no-defun-allowed
Um, maybe they mean they want a "pointer" to a function. How about #'foo for the function FOO?
0:47:17
aeth
no-defun-allowed: no, asdf_asdf_asdf has been for days/weeks asking in here how to manually wrap WinAPI in a SBCL-specific way
0:48:19
aeth
which is probably pretty close to asking how to manually compile by hand LLVM IR to x86-64 asm in #llvm
0:55:39
aeth
asdf_asdf_asdf: If I were you I would just take the offer from borodust from last week. <borodust> lemme know what header you need a wrapper for and i can arrange it in 15 min or smth
0:56:18
aeth
asdf_asdf_asdf: At the very least, you get to see what correct output looks like even if you don't do the whole thing automatically generated
1:16:28
asdf_asdf_asdf
Thanks, but which function is equivalent to "double (*func1)(double) = cm_to_inches;"?
1:18:09
Bike
none of those things are functions. you are asking a question that doesn't really make sense in context, like how much green weighs
1:19:38
Bike
https://common-lisp.net/project/cffi/manual/html_node/Tutorial.html#Tutorial here, read this. it explains callbacks
1:19:45
aeth
Do you mean function pointers for interfacing with C or are you asking about higher order functions or...?