libera/commonlisp - IRC Chatlog
Search
11:10:18
phoe
minion: memo for Bike: I think this sort of snippet can work as some basic FBIND test, https://plaster.tymoon.eu/view/2899#2899 - Serapeum's FBIND obviously fails the identity comparison because it makes an intermediate function
11:10:44
phoe
minion: memo for Bike: I'll try to make an implementation that fulfills that test in a spare while
11:56:30
pjb
pingpongball: And there's no need to copyu the same question in all channels. The OR wasn't really an inclusive OR, but one where you select the channel best adapted to your question! http://cliki.net/IRC
15:01:18
Devon
Anybody here use SLY? ELPA [Install] hangs with the message Contacting host: elpa.nongnu.org:443
15:41:59
Guest74
I wonder if I can get any thoughts on this. https://github.com/JMC-design/surface/blob/master/surface.lisp
15:42:26
Guest74
What's missing, what shouldn't be there. some basic documentation is in documentation.lisp
15:50:59
Bike
usually for (find :linux *features*) you'd just do it at readtime, since you're probably not going to change OS at runtime
15:51:00
minion
Bike, memo from phoe: I think this sort of snippet can work as some basic FBIND test, https://plaster.tymoon.eu/view/2899#2899 - Serapeum's FBIND obviously fails the identity comparison because it makes an intermediate function
15:51:00
minion
Bike, memo from phoe: I'll try to make an implementation that fulfills that test in a spare while
15:51:48
phoe
Bike: the only issue I've ended up with is that I am puzzled by the current choice of code walkers and their abilities and state of documentation
15:52:42
Bike
though i haven't looked at how agnostic lizard works. i remember raskin saying it was supposed to deal with a lot of the issues.
15:52:50
Guest74
bike: isn't it possible you'd compile on one computer and ship the binary to someone on another computer?
15:53:18
phoe
in general a Lisp program cannot be cross-compiled, I don't know of an implemnetation that allows----
15:54:32
Guest74
Xach: the problem with that is that it uses the default for the environment when no type is supplied.
15:56:00
Bike
or you could do the two layer thing where CREATE is like there except it immediately calls CREATE-GF
15:57:40
Xach
I'm expressing a personal preference, a defun isn't wrong, but if you are making a GF protocol, I would put CREATE under its umbrella.
15:57:56
Guest74
Yeah, I just went with the simplest at this stage. The backends also have the same methods implemented as normal functions.
15:59:03
phoe
Bike: the only two options are see are code walking or implementation support, and both of them are going to be terrible to implement
15:59:12
Guest74
it just makes it easier that I can just copy/paste (the horrors) create into the backends for when people don't want to use the generic functions. But I guess I could wrap it in a GF.
16:00:41
phoe
macroexpand-dammit does not seem to have the functionalities I need, trivial-macroexpand-all is even simpler, agnostic-lizard is not really documented, and hu.dwim.walker is written in hu.dwim.common-lisp rather than CL *AND* has even less documentation than agnostic-lizard
16:01:45
phoe
and going the other way effectively requires adding a new special form to eight distinct compilers, two of which are closed-source
16:04:06
Guest74
Wondering if create should have WIDTH and HEIGHT as required parameters. Since resizing of some surfaces can be seen as expensive.
16:08:39
phoe
attila_lendvai: yes, that's a poor man's documentation - I'm trying to dig into it right now
16:08:41
attila_lendvai
and a non-trivial use in the form of hu.dwim.reiterate (which is sadly only 80% finished)
16:09:18
Guest74
Xach: do you have an example? I just tried and it told me no such class, while T worked fine.
16:09:19
phoe
my main problem is passing information in the walker's lexical environment - something that I'd solve with SYMBOL-MACROLET if I were writing macros
16:10:15
attila_lendvai
phoe, hu.dwim.walker has its own env class. it shouldn't be too hard to customize it, esecially with the use of contextl
16:11:25
phoe
how do I access that environment object? it doesn't seem like REWRITE-AST's visitor function accepts it as an argument
16:12:03
attila_lendvai
phoe, see infrastructure.lisp, sadly walk-environment is a struct for some reason, not a class. you'd need to dig into the walker's code to customize it.
16:12:49
attila_lendvai
phoe, doesn't seem to be too hard. that struct is internal to the lib, so the API wouldn't change
16:13:20
phoe
I wonder if I can do structure inheritance and somehow tell the walker to use the new class
16:13:32
Guest74
phoe: nice to know. Unfortunately both still require a nil to be supplied. I should perhaps get over my laziness.
16:14:09
phoe
...nope, it won't work, there's COPY-WALK-ENVIRONMENT and MAKE-WALK-ENVIRONMENT all over the place that won't mesh well with superstructures
16:14:54
attila_lendvai
phoe, if you decide to rewrite it to use a class instead of a struct then i'll merge the change. i have nothing against it.
16:16:23
phoe
I have no idea if I can do that easily - I'll need to learn some of that DEF magic before I become able to work with that codebase
16:18:31
attila_lendvai
phoe, def is a very trivial layer. the only magic is the char based Export/Inline/export-Accessors, etc. if you keep nagging me about it, i may give it a go myself sometime. not messing much with CL nowadays, though.
16:19:25
phoe
well - I'd like to have a portable FBIND that preserves function identity, and I'll certainly need a walker for that
16:19:59
phoe
and I want to have such a FBIND in other to put it as a recipe in a new edition of a popular Common LIsp book
16:20:13
phoe
so I hope you know what you're getting into if you give me the permission to keep on nagging you
16:22:41
attila_lendvai
phoe, heh... in that case i may end up giving you the commit bit to the hu.dwim universe... :)
16:31:52
phoe
that would be, like, the ultimate yak shave - I start with a portable FBIND implementation and end up being a hu.dwim co-maintainer
16:36:13
attila_lendvai
well, i could use a hand, it's a one bus project. if i got taken by the police then the hu.dwim codebase would inevitably bitrot...
16:36:33
phoe
attila_lendvai: truth be told, I'd change the deal a little bit - I'll accept the offer, but I'll also want to nag you with questions related to "what is this thing, what does it do, why is it there"
16:37:17
phoe
so I can fill in the blanks in that universe, such as user manual and documentation and architecture docs and examples
16:37:18
attila_lendvai
phoe, feel free to nag me whenever i'm around, or even on github issues as appropriate
16:38:52
attila_lendvai
phoe, the hu.dwim stuff is really not as much as people think. it's probably the fact that the hu.dwim.def thin syntax layer is everywhere, and it gives the impression that it's something very alien. it's just a bunch of libs that use a few extra constructs, like the def macro.
16:47:18
phoe
I'll need some general information about the walker architecture, i think I can figure the DEF on my own
16:51:26
phoe
attila_lendvai: think you can write something down regarding how the walker's data structures are frobbed during walking and how the walk-environment object is used throughout the walking process and how it can be accessed from the outside right now? I'll try to ask questions based on that
17:00:30
attila_lendvai
phoe, but are there any suprises there? hdw defines its own type for the lexenv (i.e. walk env), which is very much like the impl's lexenv, only some info is extracted from the impl-specific env into the hdw env. and this env is available through the -environment- variable inside the form handlers.
17:02:53
attila_lendvai
phoe, -foo- is naming convention for lexically bound implicit variables. and layered-method's are used for the walker methods for extra customizability.
17:27:45
attila_lendvai
phoe, layered methods are just a defmethod with an extra, implicit object, the context, to which you can add and remove classes
17:32:41
Guest74
is there some convention for conditionally defining a method depending on whether a certain system/package is available? I'd like to be able to support all the various colour format libraries out there without loading every single library on a users computer.
17:45:49
Guest74
or is it even possible? I tried a toplevel (when (find-package 'some)(defmethod something((thing some:thing))... and it barfs on package not found.
17:49:58
pjb
Guest74: At read-time: #+#.(cl:if (cl:find-package 'some) '(:and) '(:or)) (defmethod something((thing some:thing))... and)
17:50:37
pjb
Guest74: At run-time: (when (find-package 'some) (eval (read-from-string "(defmethod something ((thing some:thing))...)")))
17:50:45
Guest74
oh, i thought that was only for features, or that was the impression I got from clhs.
17:51:47
pjb
Guest74: an alternative is to also define the package in your system, and test in the method, at run-time whether the dependency is available.
17:52:26
pjb
(defpackage "SOME" (:export "THING")) (defmethod something ((thing some:thing)) (if (some-runtime-test-to-see-if-some-has-been-loaded-p) (do-something) (warn "SOME unavailable")))
17:53:24
pjb
Well, there's some implementation dependent behavior, but in general implementations do the right thing.
17:55:05
pjb
If you test at read-time, you must ensure loading it at compilation time, and at run-time.
17:55:18
Guest74
yes, i've been thinking about that. What if person loads a colour library after my drawing library.
17:55:21
pjb
If you test at run-time, you must ensure it has been loaded at run-time, BEFORE you load you system.
17:59:30
Guest74
I'd say it places more burden on the user for something that feels like it shouldn't be the users burden.
18:00:39
pjb
(when (and (find-package "SOME") (find-symbol "DOSTUFF" "SOME")) (funcall (find-symbol "DOSTUFF" "SOME") :blah))
18:01:46
Guest74
this is different in that's specializing a method on a colour class from some colour library. funcall would be easier.
18:02:03
sm2n
The issue with all the other solutions is that you can have ordering issues, or have unnecessary runtime overhead
18:02:50
sm2n
like, you have a reader conditional and someone loads your library before one of the libraries you support, then it won't work
18:03:46
phoe
is there a portable way to check at macroexpansion time if some piece of code is being compiled via COMPILE or COMPILE-FILE rather than not?
18:04:11
Guest74
I guess I can do one system per library which depends on that library and transforms each colour to a specified format so that any other surfaces get automatic support for those colours.
18:04:27
phoe
COMPILE-FILE binds *COMPILE-FILE-PATHNAME*, so that's easier, but I need to find something COMPILE
18:05:53
pjb
You can do: (let ((*when* 'compile-file)) (compile-file "foo")) (let ((*when* 'compile)) (compile nil (lambda (…) …))) or (let ((*when* 'execute)) (eval '(…)))
18:10:15
phoe
yes, but I want the inverse - to check if a macro is being expanded by a compiler or an interpreter
18:12:22
pjb
Macros can be expanded at different times, and multiple times, so it sounds like a very bad design to depend on that.
18:16:22
phoe
my main gripe is the behavior of LOAD-TIME-VALUE that can differ between evaluated and compiled code
18:16:36
phoe
and I kind of wonder if I can actually depend on this behavior to detect this behavior
18:18:25
Inline
conceptually it sounds like at compile time the compiler would have to delay the init of stuff meant to be at load-time
19:08:41
phoe
I just realized that this can work as a poor man's "was this code minimally compiled" predicate
19:10:56
EdLangley[m]
Guest74: I think the most common way to do this is just to define new systems with names like "a/b" and put the methods in the files loaded by that system.
19:20:01
EdLangley[m]
I don't really like how its internals work, but the interface is something I like: automatically load a system based on the other systems that have been loaded
20:27:35
random-nick
some implementations also add a keyword argument to make-hash-table which makes it thread safe