<jkordani>
so I'm wondering. How would I go about making a package in such a way that certain parts of them could be made optional. For example, I'm having trouble installing packages that depend on hdf5-cffi for example. It got me thinking, is there a way that I could make a package that can conditionally include dependencies?
<sm2n>
jkordani: Use a subsystem. i.e write code without the dependency in mysystem and then have a mysystem/somedep system people can optionally choose to load
<jkordani>
I'm not sure I'm asking the right question, but I spent a few hours last night trying to get hdf5-cffi from both the official repo, and the fork used in cl-ana, to work on my machine. It got me thinking about how this would work with asdf and packages, and quicklisp to a degree. In the autotools/configure world, support can be provided to the
<jkordani>
software builder to include certain functionality and libraries. I really haven't heard the same thing being talked about
<jkordani>
sm2n: I guess I have to read more on asdf then
Oladon has quit [Quit: Leaving.]
masinter has quit [Ping timeout: 256 seconds]
EsoAlgo has joined #commonlisp
<jkordani>
sm2n: so how would the interface between the two work? generic functions which the subpackage provides?
mon_aaraj has quit [Ping timeout: 250 seconds]
<jkordani>
*provides implementations of?
<Xach>
Hmm, some cheap copies of ANSI Common Lisp and PAIP on US ebay today.
<jkordani>
like a generic file reader/writer/plotter class. file format specific subsystems can be made. General smarts live in the parent project, but have to provide an interface of some kind. a user of the class would have to require all of the subsystems they want. Or I suppose "meta" systems could be defined for common subsets, like foo bar baz
<jkordani>
subsystems of file-lib-base, and then a file-lib-full which requires foo bar baz and base, but doesn't provide any functionality itself
lisp123 has quit [Ping timeout: 256 seconds]
mon_aaraj has quit [Ping timeout: 240 seconds]
<jkordani>
I've never written a large system before so I'm sure there are things that I'm missing. Like for instance, lets say that I load the hdf5 subsystem. I want to provide the user with a read function passing a filename. They presumably know the type but I'd like to let the library handle it. Somewhere, some code opens the file and determines
<jkordani>
that it is an hdf file and the hdf functions are called to pull the data out. But where does the dispatch on the file occur? At some point the file gets opened. Somewhere there has to be smarts to determine what kind of file this is, but if those are in the hdf5 system, how can the base system use them to access the file? Or, the base lib
<jkordani>
has enough smarts to determine that its an hdf5 file, but the rest of the implementation for reading the file is in the hdf5 subsystem. If the base lib doesn't have any references to hdf5 subsystem functions/methods/symbols, how does it dispatch at all?
mon_aaraj has joined #commonlisp
<jkordani>
I ran into this chicken and egg problem before and I used the symbol-name dispatch type on methods to do this, but it felt hacky. I am not sure another way to do it though
Fare has quit [Ping timeout: 256 seconds]
pmwals09 has joined #commonlisp
molson_ has joined #commonlisp
molson has quit [Ping timeout: 250 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
<jkordani>
so I removed a subsystem from the parent system's depends line, but when loading the system the subsystem is still being brought in
<jkordani>
is there a way to find "reverse dependencies" for a package?
random-nick has quit [Ping timeout: 256 seconds]
mon_aaraj has joined #commonlisp
s-liao has joined #commonlisp
<jkordani>
oh holy cow I can just pull things in from cl-ana piecemeal
<jkordani>
still not sure how the functionality that I want to exclude it being pulled in. the subsystem hdf5-cffi grovel op is running even though I can't find any system that depends on it outside of cl-ana.asd, which I removed it from
sloanr has joined #commonlisp
<jkordani>
nm
random-nick has joined #commonlisp
Bike has quit [Quit: Lost terminal]
random-nick has quit [Ping timeout: 256 seconds]
<jkordani>
yea this is really strange. I suppose I shouldn't look a gift horse in the mouth, but I finally removed all hdf subsystem dependencies and package :use-package lines. When I load the parent project I get no compile errors, which I don't expect, I expect that I would get "symbols not found" in systems that claim to depend on hdf subsystems
Guest3959 has quit [Quit: QUIT]
epony has joined #commonlisp
Catie has quit [Quit: heading home]
Bike has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
masinter has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.4]
jkordani has quit [Quit: Client closed]
perrierjouet has joined #commonlisp
akoana has quit [Quit: leaving]
dre has quit [Remote host closed the connection]
perrierjouet has quit [Quit: WeeChat 3.4]
patrice has joined #commonlisp
dre has joined #commonlisp
perrierjouet has joined #commonlisp
patrice has quit [Client Quit]
silasfox has quit [Ping timeout: 245 seconds]
silasfox has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #commonlisp
NotThatRPG has quit [Read error: Connection reset by peer]
NotThatRPG has joined #commonlisp
<beach>
Good morning everyone!
perrierjouet has quit [Quit: WeeChat 3.4]
occ has joined #commonlisp
perrierjouet has joined #commonlisp
parjanya has quit [Read error: Connection reset by peer]
mon_aaraj has quit [Remote host closed the connection]
mon_aaraj has joined #commonlisp
jeosol has quit [Ping timeout: 256 seconds]
mon_aaraj has quit [Ping timeout: 240 seconds]
rotateq has quit [Quit: ERC (IRC client for Emacs 27.2)]
mon_aaraj has joined #commonlisp
mon_aaraj has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 250 seconds]
sloanr has quit [Remote host closed the connection]
mon_aaraj has joined #commonlisp
semz_ has joined #commonlisp
semz has quit [Ping timeout: 250 seconds]
Bike has quit [Quit: Connection closed]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 256 seconds]
igemnace has quit [Ping timeout: 252 seconds]
pmwals09 has quit [Remote host closed the connection]
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
theBlackDragon has quit [Ping timeout: 268 seconds]
theBlackDragon has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
domovod has joined #commonlisp
jealousmonk has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 27.1)]
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
domovod has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 250 seconds]
domovod has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
notzmv has joined #commonlisp
taiju has joined #commonlisp
artchad has joined #commonlisp
mon_aaraj has quit [Ping timeout: 256 seconds]
MetaYan has quit [Quit: Lost terminal]
rain3 has joined #commonlisp
artchad has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
wacki has joined #commonlisp
attila_lendvai has joined #commonlisp
karlosz has joined #commonlisp
lisp123 has joined #commonlisp
Cymew has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
Jing has joined #commonlisp
aartaka has quit [Ping timeout: 256 seconds]
<mfiano>
Good morning
<mfiano>
I think I need a bit of help with CLOS initialization arguments.
<mfiano>
I am hoping the solution isn't to define 1 initialize-instance auxiliary method per RGB variant class.
Algernon69 has joined #commonlisp
<mfiano>
I really don't want to hide this away behind a macro and there will be many of them.
<flip214>
mfiano: I don't understand the problem or what you're trying to do, sorry.
stylewarning has quit [*.net *.split]
yottabyte has quit [*.net *.split]
santiagopim has quit [*.net *.split]
amb007 has quit [*.net *.split]
jackdaniel has quit [*.net *.split]
ullbeking_ has quit [*.net *.split]
Posterdati has quit [*.net *.split]
utis has quit [*.net *.split]
Alfr has quit [*.net *.split]
Colleen has quit [*.net *.split]
Devon has quit [*.net *.split]
dbotton has quit [*.net *.split]
alvaro121 has quit [*.net *.split]
froggey has quit [*.net *.split]
mgxm_ has quit [*.net *.split]
stack1 has quit [*.net *.split]
contrapunctus has quit [*.net *.split]
cross_ has quit [*.net *.split]
danieli has quit [*.net *.split]
Shinmera has quit [*.net *.split]
z3t0 has quit [*.net *.split]
jmpeax has quit [*.net *.split]
amk has quit [*.net *.split]
russe has quit [*.net *.split]
gjvc has quit [*.net *.split]
hineios has quit [*.net *.split]
mason has quit [*.net *.split]
les_ has quit [*.net *.split]
TMA has quit [*.net *.split]
hubvu_ has quit [*.net *.split]
materialfuture has quit [*.net *.split]
skyl4rk has quit [*.net *.split]
<mfiano>
The comments and the code should explain that, but no worries.
santiagopim has joined #commonlisp
amb007 has joined #commonlisp
mason has joined #commonlisp
jackdaniel has joined #commonlisp
Posterdati has joined #commonlisp
ullbeking_ has joined #commonlisp
utis has joined #commonlisp
Devon has joined #commonlisp
Alfr has joined #commonlisp
Colleen has joined #commonlisp
mgxm_ has joined #commonlisp
gjvc has joined #commonlisp
froggey has joined #commonlisp
contrapunctus has joined #commonlisp
alvaro121 has joined #commonlisp
danieli has joined #commonlisp
Shinmera has joined #commonlisp
stack1 has joined #commonlisp
jmpeax has joined #commonlisp
z3t0 has joined #commonlisp
russe has joined #commonlisp
les_ has joined #commonlisp
amk has joined #commonlisp
hineios has joined #commonlisp
dbotton has joined #commonlisp
cross_ has joined #commonlisp
hubvu_ has joined #commonlisp
materialfuture has joined #commonlisp
stylewarning has joined #commonlisp
TMA has joined #commonlisp
skyl4rk has joined #commonlisp
yottabyte has joined #commonlisp
mon_aaraj has joined #commonlisp
Algernon91 has joined #commonlisp
domovod has quit [Ping timeout: 240 seconds]
Algernon69 has quit [Ping timeout: 250 seconds]
snits has quit [Ping timeout: 240 seconds]
MajorBiscuit has joined #commonlisp
mon_aaraj has quit [Ping timeout: 256 seconds]
mon_aaraj has joined #commonlisp
snits has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 256 seconds]
MajorBiscuit has joined #commonlisp
<White_Flame>
mfiano: is this a general question about how not to pass keyword arguments if not given to the current function?
<White_Flame>
eg, if :standard-illuminant is not passed to the RGB function, you don't want that key passed to MAKE-INSTANCE either and let its default occur?
<phoe>
where ARGLIST is then passed to MAKE-INSTANCE
<White_Flame>
via APPLY presumably?
<phoe>
yes
<phoe>
no other way to do that
<mfiano>
Cooking, be back in a few to read these suggestions
rgherdt_ has joined #commonlisp
<phoe>
...although that whole thing might be superfluous now that I look at it
<phoe>
I can replace it with &REST
<phoe>
because the only thing that DESTRUCTURING-BIND does is checking if the plist keys match
<phoe>
so it's not a good example actually but unnecessary code :D
mon_aaraj has quit [Ping timeout: 240 seconds]
* phoe
makes an issue
mon_aaraj has joined #commonlisp
<phoe>
it would be another case if the keyword arguments were meant to be somehow transformed or canonicalized
<phoe>
but here they're passed as-is, only DOCUMENTATION is split off
karlosz has quit [Quit: karlosz]
<mfiano>
White_Flame: Yes, I think so, to answer your question.
<White_Flame>
ok, and as phoe mentions, it's not a convenient issue to solve. &rest + plist operations + apply is generally the course taken
<White_Flame>
using the supplied-p flags aren't generally that useful for passing things on
<mfiano>
I discovered that the hard way. Nothing I have tried is convenient.
<mfiano>
(or works)
<phoe>
mfiano: "I would like each RGB variant class to have its own default value for STANDARD-ILLUMINANT"
<flip214>
mfiano: if you have similar code in multiple (> 3) places, why not generate it via a macro?
<phoe>
sounds like a class-allocated slot?
<phoe>
(DEFAULT-STANDARD-ILLUMINANT :ALLOCATION :CLASS ...) or something
<flip214>
and a class can have a per-class slot, that could be used in a initialize-instance function.... oh, phoe
<phoe>
:D
rgherdt__ has joined #commonlisp
<mfiano>
I do not want the constructor to alter the slot value of pre-existing instances, unless I misunderstand.
<phoe>
what slot value
pve has joined #commonlisp
<mfiano>
the value of the class allocated slot
<phoe>
you don't write to that slot
<phoe>
you read from that slot
<mfiano>
How, if I don't have an instance?
<phoe>
if you want to have one default illuminant per class, then you only write to that slot in each class's :default-initargs
<phoe>
either that, or you write to its class prototype
<phoe>
or you provide an initform
rgherdt_ has quit [Ping timeout: 250 seconds]
<flip214>
initform would be the right thing, and reading from the prototype, IIRC
<mfiano>
I think you are losing me. :DEFAULT-INITARGS is out because I want the default to be overridden with a make-instance initarg.
shka has joined #commonlisp
<phoe>
what do you mean by a make-instance initarg?
<mfiano>
CLHS says DEFAULT-INITARGS only takes effect if that initarg is not supplied to make instance
<phoe>
yes - why do you need to provide it in the constructor if it's meant to be per-class?
<mfiano>
Sigh
<mfiano>
It's not meant to be per class. The DEFAULT is meant to be per class, but the constructor is making an instance of any one of a variety of classes (given as another initarg)
<phoe>
OK, so :ALLOCATION :CLASS is not the right thing
<mfiano>
See the rgb constructor in my gist
mon_aaraj has quit [Ping timeout: 240 seconds]
<mfiano>
and see what is passed to make-instance's first argument
<phoe>
then I guess it's a variant of my code - grab the argument list, transform it some way (e.g. via calling MAKE-INSTANCE on some keyword arguments), and then APPLY it further
amb007 has quit [Ping timeout: 256 seconds]
<mfiano>
I'll read your code then.
mon_aaraj has joined #commonlisp
amb007 has joined #commonlisp
aartaka has joined #commonlisp
<mfiano>
So my solution is to add :default-initargs to each class, and have the constructor do (apply #'make-instance working-space (when standard-illuminant-p `(:standard-illuminant ,standard-illuminant)))
<mfiano>
I'm not sure how good that is, but it seems to work
<phoe>
yes, that'll work
<mfiano>
Thanks for the help
* phoe
adds an idea for a CLR recipe
pranavats has left #commonlisp [Error from remote client]
lisp123 has joined #commonlisp
s-liao has joined #commonlisp
lisp123 has quit [Ping timeout: 256 seconds]
s-liao has quit [Quit: Client closed]
Dynom has joined #commonlisp
lewisje has quit [Quit: Leaving]
perrierjouet has quit [Quit: WeeChat 3.4]
JeromeLon has joined #commonlisp
s-liao has joined #commonlisp
aartaka has quit [Ping timeout: 240 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
wyrd has quit [Ping timeout: 276 seconds]
wyrd has joined #commonlisp
jackdaniel has quit [Changing host]
jackdaniel has joined #commonlisp
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
s-liao has quit [Ping timeout: 256 seconds]
OlCe has joined #commonlisp
s-liao has joined #commonlisp
rgherdt__ has quit [Ping timeout: 256 seconds]
rotateq has joined #commonlisp
Jing has joined #commonlisp
perrierjouet has joined #commonlisp
taiju has quit [Ping timeout: 240 seconds]
JeromeLon has quit [Quit: WeeChat 3.3]
s-liao has quit [Ping timeout: 256 seconds]
wyrd has quit [Remote host closed the connection]
pranavats has joined #commonlisp
patrice has joined #commonlisp
wyrd has joined #commonlisp
kevingal has joined #commonlisp
kevingal has quit [Ping timeout: 240 seconds]
kevingal has joined #commonlisp
lisp123 has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
lisp123 has quit [Ping timeout: 256 seconds]
Lord_of_Life_ is now known as Lord_of_Life
rgherdt has joined #commonlisp
s-liao has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 256 seconds]
amb007 has quit [Ping timeout: 256 seconds]
jkordani has joined #commonlisp
amb007 has joined #commonlisp
<jkordani>
good morning lispers
<minion>
jkordani, memo from pjb: start by fetching ccl from github, compile it, and then select an open issue.
rgherdt__ has joined #commonlisp
OlCe has quit [Ping timeout: 256 seconds]
rgherdt_ has quit [Ping timeout: 256 seconds]
s-liao has quit [Ping timeout: 256 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
z3t0 has quit [Read error: Connection reset by peer]
z3t0 has joined #commonlisp
mixfix41 has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt__ has quit [Ping timeout: 256 seconds]
random-nick has joined #commonlisp
<jkordani>
its been a minute since I've been in the lisp world. Seems that if functions are evaluated that call undefined functions, you don't run into compile time errors... so if you are missing a subsystem, you can successfully load the whole system but will get undefined function errors when you to to *use* parts depending on the subsystems you didn't
<jkordani>
install. The new Steve Vai album is clearing my head
<beach>
What do you mean by "functions [being] evaluated"?
<Shinmera>
typically this is not a problem because other systems use their own packages, and the reader will error if you try to use a symbol from an inexistent package.
OlCe has joined #commonlisp
<jkordani>
after say (ql:quickload 'package) or if I send the form to be evaluated over slime
<phoe>
jkordani: (defun foo () (bar))) - if you never call FOO, then you'll never get an error about BAR being an undefined function
tyson2 has joined #commonlisp
<jkordani>
phoe: yea... its been a minute
<phoe>
oh, you want to get compilation-time warnings from Quicklisp
<beach>
jkordani: If a form is evaluated that calls a function that is not defined, then you will get an error.
<jkordani>
no I don't. I was erroneously expecting them
<phoe>
oh - quicklisp is usually silent about compiler output
dlowe has joined #commonlisp
domovod has joined #commonlisp
<jkordani>
beach: I'm not seeing that. slime is giving me a warning that a function it calls it undefined, but there's no outright error, I'm not landing in the debugger
<rotateq>
As it's a warning and not a signaled condition.
<phoe>
yes, compiling (defun foo () (bar)) will give you just a warning that BAR is undefined
<beach>
jkordani: Then you are not evaluating a form that calls a function. perhaps you are compiling that form?
<phoe>
rotateq: wat
<phoe>
a warning is a signaled condition
<rotateq>
not phoe?
<phoe>
every condition that is signaled is a signaled condition
<phoe>
a warning is not an error, if that is what you meant
<rotateq>
Ok then I learned something new now. Okay right, superclass of warning is condition.
<rotateq>
Yes more specifically.
snits has quit [Ping timeout: 256 seconds]
<rotateq>
then better "no error gets signaled" aka not landing in the debugger
snits has joined #commonlisp
<jkordani>
beach: Oh. Yes, I guess I am compiling the function. Man... its been too long. Nothing to see here.
perrierjouet has quit [Ping timeout: 240 seconds]
<rotateq>
jkordani: You're welcome.
<jkordani>
so basically I was experimenting with ripping out hdf5 support from cl-ana so I could load the whole thing (before I realized I could get away with loading only parts) and I was surprised that it didn't break the way I expected
Bike has joined #commonlisp
Algernon91 has quit [Ping timeout: 250 seconds]
snits has quit [Ping timeout: 240 seconds]
<jkordani>
Shinmera: maybe this was what I was expecting. While (foo () (bar)) will compile with a warning if bar doesn't exist, (foo () (mypackage:symbol-does-not-exist)) will error on read due to symbol not being found.
<phoe>
yes
s-liao has joined #commonlisp
Algernon91 has joined #commonlisp
taiju has joined #commonlisp
perrierjouet has joined #commonlisp
<jkordani>
so I guess that was what I was trying to figure out how to work around. So what I'm looking at is a parent package that uses (in the package sense) a sub package. The sub package exports functions that the parent package calls. When I compile parent files that call the exported functions
<jkordani>
I get a warning about undefined functions. So unless I'm mistaken about what I'm seeing, using symbols from other packages that haven't been brought into your package with a "use" declaration, aka by calling subpackage:sub-func, incur a lookup that will fail if the symbol isn't found?
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
OlCe has quit [Ping timeout: 256 seconds]
silasfox has quit [Ping timeout: 250 seconds]
silasfox has joined #commonlisp
<beach>
jkordani: We need to work on your terminology.
cage has joined #commonlisp
<jkordani>
yup
<jkordani>
I understand that in a defpackage form, there is a :use form that lists packages who's exported symbols get brought into that package's symbol table. is this right so far?
rgherdt_ has quit [Ping timeout: 240 seconds]
lisp123 has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
<beach>
There may not be such a :USE, and it is not a "form", it is an "option".
<beach>
And functions are not exported. Only symbols are.
lisp123 has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
<dlowe>
There's also a number of options and functions to import symbols into packages, so :use isn't the only way it happens.
<dlowe>
I have a strong preference for using :local-nicknames over :use
<beach>
Definitely!
<dlowe>
typically the only thing I :use in a package is #:cl
Bike has quit [Quit: Connection closed]
Bike has joined #commonlisp
patrice has quit [Quit: Leaving]
rgherdt has joined #commonlisp
rgherdt_ has joined #commonlisp
patrice has joined #commonlisp
_patrice has joined #commonlisp
_patrice has quit [Remote host closed the connection]
rgherdt has quit [Ping timeout: 250 seconds]
s-liao has quit [Ping timeout: 256 seconds]
rgherdt__ has joined #commonlisp
s-liao has joined #commonlisp
rgherdt_ has quit [Ping timeout: 250 seconds]
<jkordani>
so I decided to restart lisp and reload cl-ana, and I'm getting errors I expect now, with symbols not being defined at read/compile time
<jkordani>
so obviously there is a difference from compiling a function that calls an undefined function (so assuming its a function attached to a symbol, has a value for symbol-function), the reader is happy with that and you get a warning, vs compiling a function that refers to a symbol by its package name
<phoe>
the latter doesn't even reach compilation stage
<jkordani>
I see
<phoe>
the reader signals an error before any read Lisp code reaches the compiler
<jkordani>
so I guess the issue I'm running into is that somehow when a project that depends on hdf5-cffi gets loaded, the cffi grovel step for hdf5-cffi gets triggered which fails for me, and I want to avoid that. I removed dependencies on the hdf5 packages from asdf depenencies and defpackage use options, and when I reload the lisp process and try to
<jkordani>
require cl-ana, I get what I expect at read time for missing symbols from those packages referred to in other places by the packagename:symbol syntax
<jkordani>
so, since any package can be compiled that calls undefined functions (symbols without a value for symbol-function), one way to build a system of systems where dependencies can be optionally included (by hacking out the package names in asdf dependencies or package use options) could be to expect symbols to be exported from the dependent packages,
<jkordani>
so that at read time there will only be warnings, allowing all the rest of the parts of the system to be loaded and usable, minus the runtime surprises about missing those symbols?
<jkordani>
amend the first sentence to say "the reader can handle reading symbols not yet defined, but cannot read symbols declared as belonging to a package that don't exist at the time of the read"
<jkordani>
is this all accurately described? It seems to hold from my experimentation
<phoe>
more or less; if package FOO already exists but does not export the symbol BAR, the reader will nonetheless yell at you if you try to refer to FOO:BAR
<mfiano>
symbols aren't defined. they are interned. and that is what the reader does when it sees a symbol for the first time.
<jkordani>
also, when quicklisp:register-local-projects is called, asd files in subdirectories of the main system are registered. So you can optionally load the subsystems without having to load the toplevel system?
s-liao has quit [Ping timeout: 256 seconds]
<jkordani>
that also seems to bear out through experimentation
pranavats has left #commonlisp [Error from remote client]
<jkordani>
So, big question I suppose, is there a way to design a system that when it gets loaded with asdf that a pre-load check can be performed that would detect, say, lack of support for the system (such as foreign libraries being missing) that will allow dependent packages to asdf depend on them, but detect that the specific functionality is missing at
<jkordani>
runtime? It must hold that dependent packages can not refer to symbols that would have been brought in by the dependency, but instead rely on them to be exported to the dependent pacakge and define a condition handler for calling them, or else provide generic functions which the dependency can specialize, and still define a condition handler when
<jkordani>
a specialized method can't be found?
<phoe>
usually ASDF dependencies are hardcoded into an ASDF system
<phoe>
there is a concept of "weakly depends on" in ASDF, but I don't think it's very popular
<phoe>
and you're conflating a ton of stuff into your question, like ASDF systems and their dependencies, foreign libraries, specialized methods, condition handlers - it's hard to untangle this
<White_Flame>
there's also #+ #- and the *features* list, but again I don't think that's necessarily the best idea
<Alfr>
jkordani, or just dump the idea of automagic configuration, make a foo-bar system!
<phoe>
White_Flame: ASDF has the :feature-if
<Bike>
"We do NOT recommend you use [weakly-depends-on]. If you are tempted to write a system foo that weakly-depends-on a system bar, we recommend that you should instead write system foo in a parametric way, and offer some special variable and/or some hook to specialize its behaviour; then you should write a system foo+bar that does the hooking of things together. "
<Bike>
says the asdf manual.
OlCe has joined #commonlisp
<phoe>
Bike: yes
<Bike>
just elaborating on "not very popular"
<phoe>
yes, that's what I meant, I just failed to use proper words for that
<phoe>
thanks
lisp123 has joined #commonlisp
<jkordani>
so with that, there has to be enough functionality such that foo attempts to use foo+bar for specialized activity. I'm trying to think of how to, for instance, make a generic function in foo that foo+bar specializes. but somehow foo must know that it needs to dispatch to something in foo+bar. For instance, an open-file method in foo can be
<jkordani>
called that is passed a filename. foo doesn't know what filetype this is and is relying on the available methods to figure out which should be used. I don't see how this can work.
aeth has quit [Ping timeout: 240 seconds]
<phoe>
dispatch? why
<phoe>
in FOO, (defgeneric frob (thing))
<phoe>
in FOO+BAR, (defmethod frob ((thing foo+bar:my-thing)) ...)
<phoe>
this separates the interface/protocol from the implementation
lisp123 has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
<jkordani>
doesn't thing have to be specialized ahead of time, so that the dispatch machinery chooses foo+bar frob?
<phoe>
of course it doesn't
<phoe>
CLOS allows you to add or redefine or remove methods at more or less any time
<jkordani>
right
Brucio-92 has quit [Read error: Connection reset by peer]
<phoe>
you aren't doing a TYPECASE where you need to define your types ahead of time so FOO can use them
<jkordani>
I guess I mis spoke, at run time, whatever thing is needs to have enough information in it for the foo+bar frob method to be chosen, right?
<phoe>
the method to be chosen depends on the methods available
<phoe>
if a method is added to a GF, then CLOS is smart enough to recompute that GF's applicable methods
kevingal has quit [Ping timeout: 256 seconds]
kevingal has joined #commonlisp
lisp123 has joined #commonlisp
<jkordani>
well I've run into this before and I'm not sure how I could have solved it better. I wrote a serialization class for a tag-value bitstream. I made a read-stream GF that returned deserialized objects, but I can't know which read-stream method would need to be called to determine which class parser should be used (I couldn't think of a better way
<jkordani>
to write the parser than to write ser/deser functions for each value based on a specification for that value) I had to make a parser for the tag part of the stream that read in a flag, and pass the flag and the bitstream into the GF signature so that the right value ser/deser function could be called
lisp123 has quit [Remote host closed the connection]
<phoe>
what do you mean, "which read-stream method would need to be called"
<phoe>
you don't call methods in CL
<phoe>
your generic function does that for you
<phoe>
you call a generic function, and it chooses the most applicable method and calls it - and it can call the next method if/when it wants to
<jkordani>
per your paste, thing has a type associated with it, and the most specialized method will be called on that type
<phoe>
it has a *class* associated with it
<phoe>
CLOS works on classes rather than types, and the two are a bit separate
<phoe>
e.g. KEYWORD is a type, you can't specialize methods on it
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
taiju has quit [Ping timeout: 240 seconds]
<Bike>
is the issue here that the read-stream GF only gets the stream, so it doesn't know what kind of object it's deserializing until it starts reading, so you can't have different methods for each kind of thing to deserialize?
<phoe>
there needs to be some way to figure that out - e.g. a JSON parser also doesn't know what it is about to deserialize, until it actually starts reading from the stream
<phoe>
if anything, it can try to peek at the first element of that stream without removing it from the stream and decide based on that
<jkordani>
right. I used eql specialization, where my "read tag value" function returned an object with a keyword symbol for the value type, and then wrote another generic function that took a bytestream and the keyword symbol, where the specialization for that keyword symbol would get chosen and the right class deserialization function would be called
Brucio-61 has joined #commonlisp
<phoe>
so, (defun stream-element-object-type (stream-element) ...) that returns e.g. :FOO, and then call something like (defgeneric deserialize-object (object-type stream)) with methods like (defmethod deserialize-object ((object (eql :foo)) stream) ...)
<phoe>
yes
<Bike>
and now the issue is you want to add this optional system that maybe expands what stream-element-object-type can return?
<phoe>
and the STREAM-ELEMENT-OBJECT-TYPE function does the actual mapping between the "type tag" of the serialized representation and the keyword that will get passed into DESERIALIZE-OBJECT
Brucio-61 has quit [Client Quit]
<jkordani>
so for example, if there is a file type for which the bar package specialized to read a file format, and a read-file GF defined in foo+bar, foo must know enough about the file to allow for the foo+bar method to be selected
<phoe>
I think the question is what is the thing that is being extended here - do we want to add more type tags into STREAM-ELEMENT-OBJECT-TYPE, or do we want to call a "more efficient" method to DESERIALIZE-OBJECT that
<jkordani>
bike: yes
<phoe>
OK, so the former
<phoe>
I'd just get a hash table that FOO+BAR sets new value in
<jkordani>
phoe: that is what I wrote before, yes
<phoe>
and then S-E-O-T can consult the hash table and return the new keyword
<Bike>
so what is the issue.
<hineios>
Hello! I'm having trouble padding with #\FULL_STOP. I'm not really sure why, but using this format control "~80,1,0,.A[Done]" yields a format error for an unknown directive... doesn't ~a support for arguments?
<hineios>
*four arguments
<Bike>
does ~80,1,0,'.A[Done] work
<hineios>
uh
<hineios>
it does
<Bike>
ok great.
<Bike>
you need to quote character arguments.
<Bike>
this is to enable using a comma or other otherwise reserved character
<jkordani>
in the case of hdf5 for example, the hdf5-cffi grovel process fails. I'm trying to find a way to shield the user from this failure such that the rest of the system can load. But if the foo+hdf5 system can be set up, then it will tie in in some way to foo that will allow foo to make use of it. But in the way I wrote it before, foo needed
<jkordani>
knowledge of the underlying stream to determine which deserialize function to use. In this case, if the hdf5-cffi won't load, I don't know the class of the object being passed in. Even in the case of the way I wrote it before, given a bytestream to a function in order to discover what file type it is depends on being able to read that
<jkordani>
specialized file. after which the right deserialization method can be selected.
<phoe>
if FOO+BAR fails to load, then the machinery in FOO still works
<phoe>
and other systems like FOO+QUUX can set up their own implementations and tie them into the system used by the main entry point, DESERIALIZE
igemnace has joined #commonlisp
<jkordani>
phoe: thank you! I like that hash table approach very much. The crux of the problem for me is that I don't know how to figure out the equivalent for peek-char for a binary format I can't use without loading FOO+BAR's functionality. I have to hand roll enough out of band smarts to figure out what the tag is, at least I think I do. Or in the
<jkordani>
case of a file I can shell out to the file command and hope there's a magic byte for the file type. So it seems like there's no way around it, FOO must be able to determine what "type" is being passed in to the deserialization generic function
Fare has joined #commonlisp
<jkordani>
in the case of a file, the unix file command can be used to differentiate file types
<phoe>
jkordani: FOO+BAR's functionality?
<phoe>
PEEK-CHAR is only used in FOO, not FOO+BAR
<phoe>
oh, you mean you don't know how to recognize if you can deserialize a file
<phoe>
in that case you can try something else
<jkordani>
yes, peek char assumes knowledge about the bytestream
<phoe>
you want a collection of functions that try to understand a file format
<jkordani>
if I don't have that knowledge ahead of time, I can't do it this way
<phoe>
systems like FOO+BAR can PUSHNEW symbols into that list
<phoe>
and when you encounter a file, you call every function from that list until one of them returns something true
<phoe>
when such a function returns true, you know which concrete deserializer to use
<phoe>
if none return true, then you know you can't recognize that file
<jkordani>
ok that's what I see. FOO must have enough knowlege about the object being passed in for method dispatch to choose the right method, there's no way around that
<phoe>
not really to choose the right method, but the right keyword to call DESERIALIZE-OBJECT with
<jkordani>
I guess thats the question, is there a way around it. Yes that is a better way to say that
<phoe>
so, you need a mechanism that will accept such a byte stream, and will return such a keyword
<phoe>
and you need that mechanism to be extensible
<phoe>
(defvar *recognizers* '()) + (pushnew 'foo+bar:bar-recognizer foo:*recognizers*) sounds like it can do the job
<etimmons>
It's a gray stream that lets you peek at an arbitrary number of elements
<etimmons>
I use it to read enough bytes to determine if a stream has the gzip magic bytes and if so, pass it off to chipz for decompression
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<phoe>
etimmons: can I borrow that for a CLR recipe?
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<etimmons>
Sure! Just be sure to let me know if you find any bugs or improvements that could be made :)
<phoe>
yes, I'll borrow the test suite too :D
<phoe>
(and/or expand on it)
<etimmons>
hmmm... Now you're making me realize I don't test that in isolation
<etimmons>
I can add a few tests
<phoe>
yes, I am making you realize that
mon_aaraj has joined #commonlisp
<etimmons>
:)
<phoe>
:D
<etimmons>
There's also a "blocked-stream" in the same repo (that does have tests, because it was a pain to write!)
<etimmons>
It reads multiples of some block size from the stream at a time
<etimmons>
Not sure if it's useful for anything other than tar files, though
OlCe has quit [Remote host closed the connection]
waleee has joined #commonlisp
kevingal has quit [Ping timeout: 256 seconds]
domovod has quit [Ping timeout: 240 seconds]
domovod has joined #commonlisp
artchad has joined #commonlisp
lisp123 has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
lisp123 has quit [Ping timeout: 256 seconds]
NotThatRPG has quit [Read error: Connection reset by peer]
NotThatRPG has joined #commonlisp
lisp123 has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
OlCe has joined #commonlisp
mon_aaraj has joined #commonlisp
domovod has quit [Ping timeout: 256 seconds]
domovod has joined #commonlisp
kevingal has joined #commonlisp
Grauwolf has quit [Quit: WeeChat 3.3]
rain3 has quit [Ping timeout: 256 seconds]
sepanko has quit [Quit: You have been kicked for being idle]
<NotThatRPG>
Xach: ping?
tyson2 has joined #commonlisp
rotateq has quit [Ping timeout: 256 seconds]
lisp123 has quit [Remote host closed the connection]
NotThatRPG has quit [Read error: Connection reset by peer]
NotThatRPG has joined #commonlisp
rotateq has joined #commonlisp
<Xach>
NotThatRPG: hello
Guest7457 has joined #commonlisp
<NotThatRPG>
Hi. I have a bugfix in the current main for ASDF, and I would like to test the topic branch against QL before merging. I'm afraid I've lost track of how to do that.
<Xach>
NotThatRPG: what does it mean to test against QL to you?
<NotThatRPG>
I was thinking of whatever you do. Do you just build everything, or do you also run `test-operation` where it's available?
<NotThatRPG>
The problem is that there seems to be a mild bug in UIOP:DEFINE-PACKAGE, and it's hard for me to guess if it's something we need to be bug-compatible with
wheelsucker has joined #commonlisp
<NotThatRPG>
It seems like a simple oversight, and also something that would be hard to be depending on, but...
anticomputer_ has joined #commonlisp
anticomputer has quit [Quit: quit]
<Xach>
NotThatRPG: I can't really recommend doing what I do, as it requires a lot of manual setup (that should be, but is not, automated). but if it works for you, i can run the test in my system for you and report the results. i would have something to report later today.
<NotThatRPG>
Oh, that would be great. Should I give you the topic branch pointer for ASDF?
<Xach>
NotThatRPG: sure
<Xach>
NotThatRPG: if you wanted to test locally, the "qlmapper" project on github is probably a better option than what i do
sloanr has joined #commonlisp
<NotThatRPG>
I'll have a look at that, but I may not have the computational resources configured RN. When I look at "checkout branch" on gitlab, they give me: `git checkout -b 'uiop-docstring' 'origin/uiop-docstring'` (after a fetch, of course) if you have an ASDF clone.
Guest7457 has quit [Quit: Connection closed]
<NotThatRPG>
I'll try to be around all day, but might be better to send me an email when you are done. Meanwhile I will check our server and see if I can make qlmapper work there.
azimut_ has joined #commonlisp
Guest7471 has joined #commonlisp
alejandrozf has joined #commonlisp
azimut has quit [Ping timeout: 276 seconds]
<jackdaniel>
NotThatRPG: cl-test-grid perhaps?
<NotThatRPG>
Now I have to go back to zooming all day long.
<jackdaniel>
that's what I use to compare ecl between releases (or between different build options)
<NotThatRPG>
@jackdaniel: I wasn't sure what the status of that was these days. Haven't used it in a long time
<NotThatRPG>
@jackdaniel: Reading over the cl-test-grid docs, I'm not sure how I would submit a job for this, but I probably need to carefully read docs for the agent
OlCe has quit [Ping timeout: 256 seconds]
<jackdaniel>
there are some examples too and avodonosov is very responsive and helpful; but sure, docs are probably the right thing to read
<NotThatRPG>
Looks like I would have to have a locally configured system able to run all the tests, and then I would have to push them to cl-test-grid so I could make a comparison.
<jackdaniel>
sounds about right, yes
<NotThatRPG>
Unfortunately, very likely something I can't get done right away because of pressure of paid work, but I will try.
<NotThatRPG>
Thought: it might be nice to have the CL foundation set up an agent runner. They might be able to do the tests with the commercial lisps like Allegro and LispWorks on their end and post results to the grid, since they wouldn't have to expose their license secrets.
<jackdaniel>
afair files run-agent.sh.sample and run-agent.sample.lisp are self-descriptive enough to start from there
mister_m has joined #commonlisp
Catie has joined #commonlisp
rotateq has quit [Ping timeout: 256 seconds]
mon_aaraj has quit [Ping timeout: 240 seconds]
lisp123 has joined #commonlisp
<jackdaniel>
phantomics: congrats for the new release of april
<phantomics>
Thanks jackdaniel
lisp123 has quit [Ping timeout: 256 seconds]
<Josh_2>
phantomics: Does April make use of compiler macros?
<phantomics>
Josh_2: yes, very many
<phantomics>
jackdaniel: any update on acos? Heard you've been sick, hope you're better now
<jackdaniel>
yes, I still need to stay at home , but I've brought my workstation here. I'm feeling much better now, thanks
<Bike>
glad to hear it
<phantomics>
Good news
<jackdaniel>
:)
<jackdaniel>
re acos, was that about complex float results and signed 0?
<jackdaniel>
(and I'm OK with this rationale, the only remarks I had were about documentation, I still need to re-review it)
<phantomics>
In my case, I was just giving it (acos 2), I guess the +0.0i part is inferred
OlCe has joined #commonlisp
<jackdaniel>
yes, that is the case
<phantomics>
The other thing is that your fallback function works in the opposite way, which can be confusing
<jackdaniel>
yes, I believe that the pull request fixes that inconsistency (in favor of the declared behavior)
<phantomics>
Ok, I suppose the rationale of following C99 makes sense for ECL. Unfortunate that languages can't agree on a standard. One of my questions about branch cuts in Dyalog APL actually resulted in a Usenet response from the guy who wrote the paper suggesting that branch cut
alejandr` has joined #commonlisp
<jackdaniel>
I think that common lisp is more underspecified than disagreeing on that subject
attila_lendvai has quit [Ping timeout: 256 seconds]
alejandrozf has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
<phantomics>
The only other thing to resolve ECL and ABCL is (rationalize), I'll see if I can get in touch with Bruno Haible about his algo from SBCL
<jackdaniel>
right, I don't think that we've did anything about that yet
<jackdaniel>
(or, to be more precise, I'm not aware of such doing)
<jackdaniel>
but but, I need to catch up with other things too, see you later :) congrats again
<phantomics>
Having rationalize is necessary for complex floor, leading to GCD/LCM of complex numbers
<phantomics>
Appreciate it, glad you're on the mend
<phantomics>
Btw, April now includes a fun ncurses demo application using croatoan which demonstrates the use of convolution kernels for computer graphics, it's in the april/demos/ncurses directory
<phoe>
phantomics: is there a video of it available and/or recordable? asking for YouTube purposes
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phantomics>
I could record one
mon_aaraj has quit [Ping timeout: 256 seconds]
<phoe>
please do! (I'll accept a brief explanation of what's happening under the hood for an OLM video too :D)
<phoe>
there's a playlist with all OLM videos so far
<jkordani>
etimmons: thanks!
<jkordani>
:phoe are you talking about making a new CLR book? or the website
<phoe>
jkordani: the book
<phoe>
or rather, a new edition of it
<jkordani>
sweet!
snits has joined #commonlisp
alejandr` has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
ldb has joined #commonlisp
domovod has quit [Quit: WeeChat 3.4]
<Guest7471>
I'm trying to settle on a config format for window-manager workspaces. any thoughts on https://pastebin.com/09y1TAJH
attila_lendvai has joined #commonlisp
<Guest7471>
First element is name of the workspace followed by keyword parameters that match the structure.
<Guest7471>
maybe :windows should be :classes? As it goes by ewmh class and window names can be different?
ns12 has quit [Quit: bye]
ns12 has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 250 seconds]
Algernon666 has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
Algernon91 has quit [Ping timeout: 250 seconds]
[w] has quit [Quit: nyaa~]
edgar-rft has quit [Quit: Leaving]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
_73 has joined #commonlisp
rgherdt has joined #commonlisp
rgherdt_ has joined #commonlisp
<_73>
Do you guys have personal libraries where you store your own macros, etc and if so how do you deal with integrating your personal library into your projects?
<Guest7471>
same was everything, prefix with package name or local package name.
<Guest7471>
s/was/way as/
rgherdt has quit [Ping timeout: 240 seconds]
<_73>
what do you call the library?
<jackdaniel>
_73: if they are not available in published libraries I put them in a file utilities.lisp
<Guest7471>
usually use a nickame of u:
<Guest7471>
library is myname-utils.
<Catie>
I do the same as jackdaniel, add them piecemeal to the project as I start using them
<_73>
jackdaniel: And you publish this file to github so other people can still build your project?
<Guest7471>
or what jd: said, especially if i'm using 1 or 2 things.
<jackdaniel>
yes, that file is part of the project
silasfox has quit [Ping timeout: 256 seconds]
rgherdt__ has joined #commonlisp
<_73>
ah so you don't put it in its own repository but rather each project has its own utilities.lisp file
<jackdaniel>
exactly
<Guest7471>
i tend to not like that for things that get read a lot or are not obvious. reading code without package prefixes is horrible for me.
silasfox has joined #commonlisp
<_73>
That makes sense because different projects will need different utilities and you can easily just copy paste ones from old projects when they make sense. Thanks.
<jackdaniel>
sure
rgherdt has joined #commonlisp
rgherdt_ has quit [Ping timeout: 240 seconds]
rgherdt__ has quit [Ping timeout: 256 seconds]
rgherdt_ has joined #commonlisp
<Xach>
one option is to take over maintenance of a really popular project and then make it depend on your personal utilities. then your utilities will be everywhere.
rgherdt__ has joined #commonlisp
rgherdt has quit [Ping timeout: 256 seconds]
rgherdt_ has quit [Ping timeout: 256 seconds]
rgherdt__ has quit [Ping timeout: 250 seconds]
kevingal has quit [Remote host closed the connection]
Algernon666 has quit [Ping timeout: 250 seconds]
<Fare>
I plead guilty to kind of doing that with ASDF and UIOP.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Oladon has quit [Quit: Leaving.]
<Fare>
(except that UIOP didn't exist beforehand but grew strictly out of functions needed by ASDF itself, except for a couple like delete-directory-tree that were only needed by ASDF's test system but were general purpose and completed the functionality to supersede CL-FAD)
jkordani has quit [Quit: Client closed]
lisp123 has joined #commonlisp
<dlowe>
UIOP was fine except for the name :p
<dlowe>
I do feel like it filled a valuable hole, and ASDF needed that stuff anyway
<jackdaniel>
good it is not BNM, ; the comma would be problematic
lisp123 has quit [Ping timeout: 256 seconds]
OlCe has quit [Ping timeout: 256 seconds]
<Guest7471>
i think JKL; would be more consistent.
<Fare>
I am French, so it'd be JKLM. AZERTY!!!
<Guest7471>
interesting. 'French' keyboards here are still pretty much qwerty.
<Guest7471>
here being Quebec.
<Fare>
That means the language police still has more work to do.
<Catie>
GCRL for the Dvorak users in the audience
<Guest7471>
offtopic but language police is the stupidest idea ever. Having a decent french education would do more to protect the language, but french education is subpar to any english schooling in the province. Those who attend english school usually speak better french than anybody educated in french schools.
Fare has quit [Ping timeout: 256 seconds]
gaqwas has joined #commonlisp
ebrasca has joined #commonlisp
Guest7471 has quit [Quit: Connection closed]
aartaka has joined #commonlisp
ldb has quit [Quit: ERC (IRC client for Emacs 27.2)]
gaqwas has quit [Remote host closed the connection]
<sveit_>
do people have tricks to check in macros if certain information is available at compile time? for example, (length (make-array 3))
<sveit_>
of course I know that this is a vague notion, but I am looking for something just a /bit/ more powerful than constantp
lisp123 has quit [Ping timeout: 256 seconds]
jealousmonk has joined #commonlisp
aartaka has quit [Ping timeout: 256 seconds]
<phoe>
a bit more powerful like that?
<phoe>
I mean, like what?
<jackdaniel>
I've liked the former better
<phoe>
:D
gaqwas has quit [Remote host closed the connection]
<ebrasca>
Hi phoe!
<phoe>
hey ebrasca
<ebrasca>
How are you doing?
<phoe>
alive; #lispcafe might be better for a longer explanation
Dynom has quit [Quit: WeeChat 3.4]
<ebrasca>
ok
<sveit_>
one simple example is (constantp '(make-array 3 :initial-element 0) env) is always nil, for example, but (constantp '#(0 0 0) env) is t. to start, i'd like to know if people have techniques to establish that the former can be inspected at compile time
wacki has quit [Quit: Leaving.]
hineios has joined #commonlisp
<phoe>
well, CONSTANTP returns false since the form doesn't really evaluate to a constant - but you can try to do a few things at macroexpansion time
<phoe>
first, try to macroexpand that form just in case it's a global or local macro
tyson2 has quit [Remote host closed the connection]
<phoe>
second, check if it's a call to CL:MAKE-ARRAY like (make-array ...) or (funcall 'make-array ...) or (apply 'make-array ...) or (funcall #'make-array ...) or (apply #'make-array ...)
<phoe>
and once you got this, check if the arguments in that call are CONSTANTP - it'll be a bit more troublesome for APPLY because the arguments themselves might be elsewhere
<sveit_>
phoe: yes, I guess essentially what I would like is some code-walker that completely macroexpands a form, then checks if every function argument is constantp. I figured that (a) there might be some more elegant solution and (b) regardless, people had established solutions for this type of thing
<sveit_>
and every binding, etc. (and say that all the functions are cl:... which it's undefined behaviour to rebind)
<phoe>
why?
<phoe>
I mean, your compiler should be smart enough to do that for you
<phoe>
(in most cases)
<sveit_>
I may (do :)) want to optimize some generated code in case certain information can be established at compile time
<phoe>
well, forms like (make-array 3) are naturally not CONSTANTP
<sveit_>
phoe: I can see why (make-array 3) is not constantp, but why not (make-array 3 :initial-contents 0)?
<phoe>
because it isn't constantp either
<sveit_>
sorry (make-array 3 :initial-element 0)
<Bike>
cos if you do that twice you'll get two distinct arrays.
<phoe>
literal (quoted) lists, arrays, vectors, strings, and so on are constant data in CL
<phoe>
so #(0 0 0) is constant by definition
<Bike>
(eql #(0 0 0) #(0 0 0)) is actually allowed to be t, also.
<phoe>
and if you dare mutate it, it's your fault
<phoe>
oh right, if the compiler does enough constant-folding
tyson2 has joined #commonlisp
<sveit_>
anyway, whether something is constantp is actually a bit of a diversion here, I was just trying to give a sensible starting point for what I'm after by relating to constantp. of course it would be a tool (for example, one might expand code enough and check that the first argument to make-array is constantp to infer the length, etc)
<phoe>
yes, that's actually understandable
<Bike>
generally, determining interesting information is a huge pain in the ass to do on the actual source code. compilers usually transform into some IR before doing any solid analyses.
<phoe>
if you can precompute the array length then you can generate code that doesn't check for length at runtime and so on
<Bike>
at which point macroexpanders have all completed.
<Bike>
sbcl is smart enough to collapse (length (make-array 4)) to 4, looks like, as long as the array isn't also adjustable.
<sveit_>
i'm just surprised that this isn't some common enough thing for lispers to want/do that there isn't some (as I have said necessarily partial) solution people have developed
<Bike>
the usual solution is a compiler.
<Bike>
user compiler extensions are an interesting thing that i would like to make more available, but working out the details is pretty involved.
<phoe>
usually not worth the effort, array length checks are damn cheap
<phoe>
unless you want to get more and more details out of your code, at which point things become troublesome
<phoe>
better to write your own subcompiler then, via a macro or a compiler macro
<sveit_>
Bike: yes, but in my case I'd like to not throw away SBCL/CL just to expand to a different macro if the length of an array can be proven to be 1 or 2 :)
<NotThatRPG>
sveit_: We have this problem in the ITERATE macro: its code-walker can't handle MACROLET
<sveit_>
phoe: actually I have been wondering exactly about this, are there canonical examples of large macro-based subcompilers one can look at to learn? whenever I have any complexity my macros tend to explode and I code myself into a corner with a bunch of unmaintainable special cases
<Bike>
loop and iterate are pretty huge, if you mean that kind of thing.
<Bike>
(loop is part of the standard, of course, but it's generally implemented similarly to a user macro)
<phoe>
also cl:formatter which is a good entry point into FORMAT
<Bike>
does ppcre do complicated macro stuff?
<phoe>
I don't think it does, but it *is* a compiler in a way
<phoe>
at least when it comes to turning regexes into code
<sveit_>
thanks! actually I always wondered how iterate did portable code-walking, I guess the answer is it doesn't :)
<phoe>
oh, the topic of portable code walking
<phoe>
NotThatRPG: why/how cannot it handle macrolet though?
<Bike>
cos there's no standard way to get a macroexpander function in an arbitrary lexical environment, probably?
<NotThatRPG>
@phoe: Not sure why not, but presumably because macrolet can depend on arbitrary context. It's probably not computable to walk it without evaluating it in context, which isn't available at macro expansion time
pjb has quit [Remote host closed the connection]
<Bike>
could use cltl2:enclose, perhaps, but not every implementation has that
<phoe>
hmm - a macroexpander function, yes, but isn't a macroexpansion enough? you can grab the &environment object and call MACROEXPAND-1 with it as the second parameter
<Bike>
if you're walking the code the macro function does not actually exist
<phoe>
or do you specifically need the function?
attila_lendvai has quit [Ping timeout: 240 seconds]
<Bike>
so macroexpand-1 will not work
<phoe>
oh wait, you mean a macrolet *inside* ITERATE
<phoe>
not outside it
<Bike>
i assume so.
<phoe>
yes, I understand now
Fare has joined #commonlisp
Algernon666 has joined #commonlisp
<NotThatRPG>
phoe: Yes, that's right. ITERATE needs to code walk to find iterate clauses and translate them.
<phoe>
NotThatRPG: OK
<NotThatRPG>
just recently found that at least one compiler introduces its own MACROLETs, potentially breaking ITERATE in odd places.
<Bike>
oh, really? which one is that?
<NotThatRPG>
Bike: I *think* both CCL and Allegro do this on some occasions.
<Bike>
interesting. when you say introduces, do you just mean a standard macro that expands into a macrolet, or something else? (because e.g. with-hash-table-iterator is going to do that anywhere, i would imagine)
<NotThatRPG>
Actually no, sorry -- it was COMPILER-LET.
<NotThatRPG>
... and we found a work-around, which was just to not try to walk the bindings. I *think* that's fine.
<Bike>
oh, that weird one
<NotThatRPG>
Should make a bug-fix release, but I'm so busy with stuff....
<Bike>
i still don't quite understand what it is supposed to do
<NotThatRPG>
Bike: I think this was in ASSERT, IIRC
<NotThatRPG>
But I'm getting senile.
Algernon91 has joined #commonlisp
yottabyte has quit [Quit: Connection closed for inactivity]
Algernon666 has quit [Ping timeout: 250 seconds]
<phoe>
hah, CCL has a COMPILER-LET inside their DEFMETHOD macroexpansion
<phoe>
I don't think one usually goes DEFMETHOD inside ITERATE, but who knows
patrice has quit [Quit: Leaving]
<phoe>
also all the COMPILER-LET bindings CCL makes are benign so ITERATE can rather safely treat all of these like just PROGNs
<phoe>
I can't tell anything about ACL though because I obviously cannot look into the sources
artchad has quit [Read error: Connection reset by peer]
patrice has joined #commonlisp
dec0d3r has joined #commonlisp
rgherdt has quit [Ping timeout: 240 seconds]
[w] has joined #commonlisp
akoana has joined #commonlisp
<NotThatRPG>
phoe: Yes, we just tell iterate to code walk the CDDR of COMPILER-LET and that seems to have fixed things.
azimut_ has quit [Remote host closed the connection]
azimut has joined #commonlisp
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 276 seconds]
Josh_2 has quit [Remote host closed the connection]
igemnace has joined #commonlisp
Algernon91 has quit [Read error: Network is unreachable]
Algernon91 has joined #commonlisp
Algernon91 has quit [Ping timeout: 250 seconds]
wyrd has joined #commonlisp
kevingal has joined #commonlisp
shka has quit [Ping timeout: 240 seconds]
patrice has quit [Ping timeout: 256 seconds]
masinter has joined #commonlisp
taiju has joined #commonlisp
morganw has quit [Remote host closed the connection]
ecomcon has joined #commonlisp
dlowe has quit [Remote host closed the connection]