tibfulv has quit [Remote host closed the connection]
tibfulv has joined #commonlisp
X-Scale has quit [Quit: Client closed]
bilegeek has joined #commonlisp
zaymington has joined #commonlisp
czy has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 255 seconds]
Lord_of_Life has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
ldb has joined #commonlisp
tyson2 has joined #commonlisp
dcb has quit [Quit: MSN Messenger 4.1.0]
yitzi has quit [Remote host closed the connection]
dinomug has joined #commonlisp
habamax has quit [Ping timeout: 260 seconds]
bubblegum has joined #commonlisp
Pirx has quit [Ping timeout: 255 seconds]
tyson2 has quit [Remote host closed the connection]
alphacentauri has quit [Quit: WeeChat 4.0.5]
X-Scale has joined #commonlisp
alphacentauri has joined #commonlisp
azimut has quit [Ping timeout: 252 seconds]
waleee has quit [Ping timeout: 245 seconds]
alphacentauri has quit [Quit: WeeChat 4.1.0]
alphacentauri has joined #commonlisp
alphacentauri has quit [Client Quit]
alphacentauri has joined #commonlisp
alphacentauri has quit [Client Quit]
alphacentauri has joined #commonlisp
ldb has quit [Remote host closed the connection]
triffid has quit [Read error: Connection reset by peer]
triffid has joined #commonlisp
alexsotodev has joined #commonlisp
alphacentauri has quit [Quit: WeeChat 4.1.0]
Pixel_Outlaw has quit [Remote host closed the connection]
habamax has joined #commonlisp
bilegeek has quit [Quit: Leaving]
random-jellyfish has joined #commonlisp
doyougnu has quit [Ping timeout: 260 seconds]
doyougnu has joined #commonlisp
bubblegum has quit [Quit: Client closed]
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
danse-nr3 has quit [Ping timeout: 255 seconds]
danse-nr3 has joined #commonlisp
bilegeek has joined #commonlisp
pranavats has joined #commonlisp
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ronald has quit [Ping timeout: 255 seconds]
ronald has joined #commonlisp
rtypo has joined #commonlisp
SR-71 has joined #commonlisp
alphacentauri has joined #commonlisp
villageidiot has joined #commonlisp
pve has joined #commonlisp
notzmv has quit [Ping timeout: 264 seconds]
rgherdt has joined #commonlisp
son0p has quit [Ping timeout: 248 seconds]
shka has joined #commonlisp
ronald has quit [Ping timeout: 248 seconds]
ronald_ has quit [Ping timeout: 255 seconds]
villageidiot has quit [Quit: Client closed]
chomwitt has joined #commonlisp
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
Cymew has joined #commonlisp
bilegeek has quit [Quit: Leaving]
X-Scale has quit [Quit: Client closed]
msavoritias has joined #commonlisp
igemnace has joined #commonlisp
danse-nr3_ has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
snits has quit [Ping timeout: 240 seconds]
danse-nr3 has quit [Ping timeout: 255 seconds]
snits has joined #commonlisp
dinomug has quit [Remote host closed the connection]
danse-nr3_ has quit [Ping timeout: 246 seconds]
SR-71 has quit [Remote host closed the connection]
contrapunctus has joined #commonlisp
varjag has joined #commonlisp
Gleefre has quit [Ping timeout: 245 seconds]
Inline has joined #commonlisp
dino_tutter has joined #commonlisp
bendersteed has joined #commonlisp
dim` has joined #commonlisp
dim has quit [Ping timeout: 255 seconds]
dim` is now known as dim
czy has quit [Ping timeout: 264 seconds]
notzmv has joined #commonlisp
habamax has joined #commonlisp
attila_lendvai has quit [Remote host closed the connection]
attila_lendvai_ has joined #commonlisp
son0p has joined #commonlisp
donleo has joined #commonlisp
danse-nr3_ has joined #commonlisp
azimut has joined #commonlisp
dtman34 has quit [Ping timeout: 255 seconds]
attila_lendvai_ has quit [Quit: Leaving]
dtman34 has joined #commonlisp
liminality has quit [Read error: Connection reset by peer]
jonatack has quit [Ping timeout: 258 seconds]
liminality has joined #commonlisp
mgl has joined #commonlisp
anticrisis has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
Pirx has joined #commonlisp
limiduality has joined #commonlisp
liminality has quit [Ping timeout: 240 seconds]
azimut has quit [Ping timeout: 252 seconds]
Inline has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
kstuart has joined #commonlisp
random-nick has joined #commonlisp
White_Flame has quit [Ping timeout: 245 seconds]
White_Flame has joined #commonlisp
liminality has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
Inline has joined #commonlisp
limiduality has quit [Ping timeout: 258 seconds]
liminality has quit [Ping timeout: 240 seconds]
liminality has joined #commonlisp
amb007 has quit [Ping timeout: 258 seconds]
amb007 has joined #commonlisp
danse-nr3_ has quit [Read error: Connection reset by peer]
limiduality has joined #commonlisp
chomwitt has quit [Ping timeout: 258 seconds]
liminality has quit [Read error: Connection reset by peer]
rgherdt_ has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
rgherdt has quit [Ping timeout: 245 seconds]
Gleefre has joined #commonlisp
yitzi has joined #commonlisp
alphacentauri has quit [Ping timeout: 248 seconds]
rgherdt_ is now known as rgherdt
alphacentauri has joined #commonlisp
easye has quit [Ping timeout: 260 seconds]
childlikempress has quit [Quit: !]
moon-child has joined #commonlisp
danse-nr3_ has joined #commonlisp
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
semarie has quit [Quit: WeeChat 4.0.4]
semarie has joined #commonlisp
ronald has joined #commonlisp
danse-nr3_ has quit [Ping timeout: 260 seconds]
easye has joined #commonlisp
NotThatRPG has joined #commonlisp
random-nick has quit [Ping timeout: 245 seconds]
easye has quit [Ping timeout: 255 seconds]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
gnoo has quit [Ping timeout: 240 seconds]
easye has joined #commonlisp
danse-nr3_ has joined #commonlisp
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1.50)]
gnoo has joined #commonlisp
<Gleefre>
It is kind of sad that macros (including reader macros) can't use multiple values to return multiple forms.
<Gleefre>
Is (progn <form-1> <form-2> <form-3>) at toplevel equivalent to <form-1> <form-2> <form-3> at toplevel?
<Gleefre>
Seems like it "If progn appears as a top level form, then all forms within that progn are considered by the compiler to be top level forms. "
<bike>
yES
<bike>
caps
<bike>
a reader macro can similarly return a progn form.
igemnace has quit [Read error: Connection reset by peer]
igemnace has joined #commonlisp
<Gleefre>
Hm, CLHS 3.2.2.1.3 says that "a compiler macro definition must not be applied ... [if] The function name has been declared or proclaimed notinline"
<bike>
yep.
azimut has joined #commonlisp
<Gleefre>
Would that mean that COMPILER-MACRO-FUNCTION should return nil if the function with that name is declaimed notinline?
<Gleefre>
Or it should return the compiler-macro when it exists in either case?
<bike>
i don't think that's specifically defined. a job for wscl, maybe.
<Gleefre>
Well, it would seem like COMPILER-MACRO-FUNCTION is defined to return compiler-macro definition in the given lexical environment
<Gleefre>
And CLHS 3.2.2.1.3 says that the compiler macro should not be applied, but doesn't says anything about it becoming "nonexistent"
<Gleefre>
[ btw, reason I'm asking - on CMUCL it does always return nil if the function was declaimed notinline ]
<bike>
i think returning nil is sensible, but i don't think the standard really says either way
<Gleefre>
Oh, one more question: does `(locally (declare ...) ...)` introduce a new lexical environment?..
<Gleefre>
Ah, yes, seems like that: " Sequentially evaluates a body of forms in a lexical environment where the given declarations have effect. "
<bike>
Probably, but why are you asking? There's not really a way to discern that lexical environments are distinct.
<Gleefre>
Well, I was trying to get the compiler macro by doing (declare (inline foo) (compiler-macro-function 'foo))
<Gleefre>
And it was failing
<Gleefre>
I figured it was becasue of the lexical environment
<bike>
well you're not specifying the environment to compiler-macro-function there anyway.
<bike>
so it doesn't know about the locally or whatever.
<bike>
assuming you mean you wrote (locally (declare (inline foo)) (compiler-macro-function 'foo)), since as you wrote it compiler-macro-function is part of the declaration which makes no sense
<Gleefre>
Oh, yeah, missing paren x.x
<Gleefre>
Yeah, but that would be the case only if the locally did introduce a new lexical environment
<Gleefre>
So it does do that
<Gleefre>
One more weird thing: CMUCL doesn't call the compiler-macro if the function is declared inline even if it wasn't declaimed notinline
<Gleefre>
I guess it's time to open an issue :I
<bike>
that's technically allowed, i guess, if annoying
<bike>
what i mean is that if you do (compiler-macro-function 'foo), the lexical environment that call is in is irrelevant and has no influence on what compiler-macro-function does
<bike>
it'll just consult the global environment.
<Gleefre>
Ah, wait, I think I understand why (declare (inline foo)) doesn't call the compiler macro - because it inlines the function call instead
<Gleefre>
Ok, so CMUCL does have a consistent behavior at least
<Gleefre>
[ also tested that (locally (declare (inline bar)) (with-lexenv (env) (compiler-macro-function 'bar env))) does return the compiler macro function ]
<Gleefre>
So the only issue would be that compiler-macro-function doesn't return the existing compiler-macro if that function was declaimed / declared notinline, which does seem to be a conformance issue
kenran has joined #commonlisp
<bike>
i really don't think the standard specifically says that compiler-macro-function has to return the compiler macro function if it's given an environment with the name declared notinline.
kenran has quit [Remote host closed the connection]
<Gleefre>
The standard doesn't says otherwise however
<Gleefre>
A few passages from hyperspec:
<Gleefre>
CLHS 3.2.2.1: "That is, it is possible for a function name to name both a function and a compiler macro."
<Gleefre>
"A function name names a compiler macro if compiler-macro-function is true of the function name in the lexical environment in which it appears."
<bike>
yeah that's what i said. the standard isn't specific.
<Gleefre>
And CLHS entry for declaration NOTINLINE: "a notinline declaration prevents that compiler macro from being used"
<bike>
uhhuh.
<bike>
i know all this.
<Gleefre>
Note that it doesn't says anything about compiler macro being **shadowed**, as it does here:
<Gleefre>
"Creating a lexical binding for the function name not only creates a new local function or macro definition, but also shadows[2] the compiler macro. "
<bike>
none of this stuff says what compiler-macro-function returns or doesn't return.
<Gleefre>
It says that if compiler-macro-function returns NIL that means that the function name doesn't name a compiler macro
<Gleefre>
On the page for COMPILER-MACRO-FUNCTION: " A value of nil denotes the absence of a compiler macro function named name. "
<Gleefre>
And " Accesses the compiler macro function named name, if any, in the environment. "
<bike>
sure.
ronald_ has joined #commonlisp
ronald__ has joined #commonlisp
ronald has quit [Ping timeout: 252 seconds]
<phantomics>
What's the best way to import function symbols from one package to another -outside- of the (defpackage) form? I'm creating a system that acts as an extension of a package so I can't use (defpackage) since the package was already defined
<yitzi>
import function?
<phantomics>
Import just imports symbols afaik
<beach>
phantomics: There is no such thing as a "function symbol".
<yitzi>
Which is that `:import` does in defpackage.
<yitzi>
"what"
<phantomics>
For example: if I do (import '(func) 'package) #'func, I get an undefined function error
<beach>
phantomics: Packages do not contain functions.
<beach>
phantomics: A package is a basically a mapping from names (that are strings) to symbols.
<phantomics>
They contain symbol tables that reference functions correct?
<bike>
import is definitely how you import symbols.
<phantomics>
Then after doing (import '(func) 'package), why is #'func not available in the current package?
<yitzi>
You may need to prefix func with the external package
<beach>
phantomics: Symbols can, among other things, be used to name functions.
<yitzi>
(import '(ext-pkg:func) 'my-pkg)
<phantomics>
Ok, looks like that does it, thanks
<yitzi>
np
jonatack has joined #commonlisp
bendersteed has quit [Quit: bendersteed]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
alphacentauri has quit [Quit: WeeChat 4.1.0]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
alphacentauri has joined #commonlisp
<Gleefre>
How can I test that a form doesn't emit a style-warning when it is compiled?
<Gleefre>
Seems like I need to use handler-bind with warning as condition type, and there is not "simple" way like using compile
<jdz>
It is the compiler that emits warnings, not forms.
<jdz>
So you are already using the compiler.
<jdz>
And you should check the documentation for the function COMPILE.
<jdz>
But yes, for specific kinds of conditions you have to handle them manually.
<jdz>
Condition types, to be precise.
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alphacentauri has quit [Quit: WeeChat 4.1.0]
prokhor has quit [Remote host closed the connection]
alphacentauri has joined #commonlisp
danse-nr3_ has quit [Ping timeout: 255 seconds]
<bike>
call compile, make sure the second value is nil. the compiler may or may not actually propagate style warning signals outside of itself.
<Gleefre>
Shinmera: Interesting, but looks a bit too complicated... Why are you using trivial-custom-debugger:with-debugger instead of something like handler-case?
<Gleefre>
Also it would seem like WARN-P will always be NIL as you muffle all warnings :/
<bike>
"this whole rigamarole is to intercept compilation errors"
qhong has joined #commonlisp
<Gleefre>
Yes, but I don't understand why handler-case wouldn't work
<Gleefre>
[ or handler-bind ]
<bike>
since, again, it is not guaranteeed that errors within the compiler are actually signaled outside of the compiler
<Shinmera>
Gleefre: did you really somehow think I'd make things this annoying just for fun or something
NotThatRPG has joined #commonlisp
alphacentauri has joined #commonlisp
limiduality has quit [Ping timeout: 255 seconds]
dino_tutter has quit [Ping timeout: 255 seconds]
liminality has joined #commonlisp
Perflosopher has quit [Read error: Connection reset by peer]
Perflosopher has joined #commonlisp
<Shinmera>
I don't remember why I muffle all warnings, but I probably had a reason for it
tyson2 has joined #commonlisp
<Gleefre>
Of course I didn't, I just wanted to know why you did things like that, if it seems/looks like it could be made easier. Sorry that I phrased it bad :/
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
ldb has joined #commonlisp
<Gleefre>
Although I'm still not convinced you want to intercept errors / warnings from the compiler
qhong has quit [Ping timeout: 240 seconds]
<Gleefre>
Consider this lambda: (lambda (x) (if x 1 (/ 1 0)))
<Gleefre>
It is valid and can be easily compiled, but sbcl will signal an error inside the compiler because it will try to fold constant (/ 1 0)
random-jellyfish has quit [Ping timeout: 255 seconds]
<Shinmera>
I do want to, to catch macro expansion failures and so on
<Shinmera>
being able to check that a compilation succeeds is a valid test case.
<Shinmera>
or that the compilation will trip a specific condition
<Shinmera>
whether and how you want to use try-compile is up to you man, it's for the user
<Shinmera>
if you don't care about the failure, don't use it?
<Shinmera>
this is a testing framework
<Gleefre>
Sure. Especially since it doesn't seem to be an external function at all :)
<Gleefre>
[ so I don't even know what exactly you want to achieve with it ]
<Shinmera>
it's exposed via the fail-compile macro, come on
<bike>
for example, you could have a compiler macro definition you want to test. if the compiler macro signals an error, sbcl will (i believe) only end up signaling a style warning, and compilation succeeds. but you still want to test that the compiler macro doesn't signal an error.
<Gleefre>
IMHO if you want to test a compiler macro definition you need to use funcall + compiler-macro-function + [maybe] eval
<Gleefre>
As no implementation is required to even call them at any point
<Gleefre>
*as implementation is not required ...
<bike>
it was an example.
<Shinmera>
IMHO if your implementation doesn't use compiler macros it's not worth testing on
<ldb>
imaging C++ compiler that won't expand template, lol
<Gleefre>
Maybe. But if you want for your test to be reliable you should not depend on unspecified behaviour.
<Shinmera>
that's, like, your opinion man
<Gleefre>
Sure, it is my opinion
<bike>
you can also use fail-compile to test regular macros, in a more natural way than manually calling macro functions.
<Gleefre>
*As well as most statements are someone's opinion; pure facts are not a very common thing.
<Shinmera>
the point of me saying it's your opinion is to say I disagree with it
<Shinmera>
but thanks for playing anyway
<ldb>
A clever enough compiler could deduced from (lambda (x) (if x 1 (/ 1 0))) that (eq (and x t) t) and optimize the form into (lambda (_) 1), lol
<ldb>
and rewrite surrounding forms using (eq (and x t) t)
danse-nr3_ has quit [Ping timeout: 240 seconds]
<Gleefre>
Interesting fact: CLASP produces weird results with fail-compile
<ldb>
I think that's because the translated C++ code is undefined behavior
<Gleefre>
[ but (compile nil '(lambda (x) (if x 1 (/ 1 0)))) is fine ]
<bike>
it's because unix signal handling is terrible to deal with.
danse-nr3_ has joined #commonlisp
<ldb>
bike: you mean trapping floating point exception
danse-nr3_ has quit [Remote host closed the connection]
<ldb>
yes C++/C are terriable on that
danse-nr3_ has joined #commonlisp
<Gleefre>
ldb: or a not clever enough compiler could not try folding the constant [ for example ABCL ]
<bike>
that just delays the problem, if (/ 1 0) is broken
<Gleefre>
Maybe you have a handler-case for the division-by-zero error
random-jellyfish has joined #commonlisp
<Gleefre>
Also, note that unlike signalling it at runtime, not all implementation will signal the "right" error
<bike>
the brokenness here is how division by zero signaling works.
<Gleefre>
For example Allegro CL signals #<SIMPLE-BREAK @ #x10007a06922> instead
<Gleefre>
*rather returns from fail-compile
<Gleefre>
Which probably indicates that Allegro CL uses condition system in its compiler for something else, and fail-compile might catch "internal" conditions :/ [ I think ]
<bike>
sure, that's pretty much how its going to go with *break-on-signals*
dinomug has quit [Remote host closed the connection]
liminality has quit [Ping timeout: 255 seconds]
<Shinmera>
bike: sorry for inadvertently creating more work for you
<Gleefre>
[ and sorry if I'm being annoying here :/ ]
<bike>
you kind of are, yes. fail-compile works well enough in practice.
<bike>
you're acting like it's supposed to have some kind of vaguely defined reasonable behavior on all possible bad code, but that's not how it's actually used.
mgl has quit [Ping timeout: 240 seconds]
<bike>
also, shinmera posted this in the first place to give you a hint as to how you could deal with the problem you were having (detecting compiler style warnings), so it's kind of rude to turn around and critique the use of this thing for totally unrelated purposes.
<Gleefre>
I see, sorry that it looks like that :/ I was just intersted to see how that works on various cases (and edge-cases), as that's what I always do when solving some kind of problem in the first place.
<Gleefre>
By posting these example I didn't want to critique fail-compile - I'm sure it does have a reason to intercept all signals as well as that it does have its use-cases - but rather to see what limitations it has.
<bike>
in american law there's a concept called "ripeness", where a court will drop a case if it doesn't apply to some real issue that's currently happening and needs some resolution. i think it is useful to apply this to language lawyering
msavoritias has quit [Remote host closed the connection]
liminality has joined #commonlisp
igemnace has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 264 seconds]
azimut has quit [Ping timeout: 252 seconds]
tyson2 has quit [Remote host closed the connection]
rgherdt_ has quit [Ping timeout: 240 seconds]
amb007 has quit [Ping timeout: 264 seconds]
amb007 has joined #commonlisp
_cymew_ has joined #commonlisp
cage has joined #commonlisp
waleee has joined #commonlisp
rgherdt has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
dcb has joined #commonlisp
tok has joined #commonlisp
random-jellyfish has quit [Ping timeout: 255 seconds]
danse-nr3_ has quit [Ping timeout: 255 seconds]
contrapunctus has left #commonlisp [#commonlisp]
yitzi has quit [Remote host closed the connection]
X-Scale has quit [Ping timeout: 245 seconds]
<Gleefre>
How does '(satisfies foo) interacts with function redefinitions? All implementations I was able to test it on respect the redefinition.
contrapunctus has joined #commonlisp
<Gleefre>
Would that mean that all calls to subtypep that have '(satisfies foo) as one of its arguments must return NIL, NIL ?
<Gleefre>
[ where foo is user-defined ]
dino_tutter has joined #commonlisp
<Gleefre>
Ah, that's not necesseraly true if both arguments have '(satisfies foo) somewhere inside
<Gleefre>
Oh, and if the first argument is 'nil / the second argument is 't...
<bike>
i don't think it's defined. a lot to do with redefinitions is not defined.
<bike>
that said, 3.2.2.3 does imply at least that a conforming program can't redefine a function used in satisfies in compiled code, i think
<bike>
it's also technically possible that an implementation could have like (subtypep '(satisfies consp) 'integer) => NIL T, but i don't think any of them bother. maybe for keywordp
<Gleefre>
SBCL does that :o
<bike>
well there we go then
<Gleefre>
One more thing I'm wondering about is example from the spec: (subtypep '(satisfies dummy) nil) => false, implementation-dependent
<Gleefre>
Why can it be NIL, T? What if dummy is a function that always return nil?
Oladon has joined #commonlisp
random-nick has joined #commonlisp
<ldb>
By fiat or magic
<bike>
hypothetically, dummy could be compiled in the same compilation unit as the subtypep form, and thus the compiler is guaranteed that dummy will not be redefined. so it can analyze it to determine whether it ever returns true.
<bike>
oh, if you mean that it can return true, yes. the example must be wrong.
mgl has joined #commonlisp
_cymew_ has quit [Ping timeout: 240 seconds]
<ldb>
I think the CLHS assumes dummy is undefined
easye has quit [Remote host closed the connection]
easye has joined #commonlisp
tyson2 has joined #commonlisp
d4ryus has quit [Ping timeout: 240 seconds]
d4ryus has joined #commonlisp
_cymew_ has joined #commonlisp
nemo_ has joined #commonlisp
nemo_ has quit [Client Quit]
_cymew_ has quit [Ping timeout: 255 seconds]
thuna` has joined #commonlisp
random-jellyfish has joined #commonlisp
danza has joined #commonlisp
Pirx has quit [Ping timeout: 255 seconds]
Jach has quit [Ping timeout: 258 seconds]
Pirx has joined #commonlisp
ldb has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
<tok>
Working on a compiler for own quiet enjoyment and got me wondering. Currently while parsing I get a list of structs (tokens/ast), assuming SBCL, which one would be preferred, using built-in list for appending structs to some list or using some struct with NEXT slot? I can achieve the same thing with both. Anything I should know about the under-the-hood stuff or someplace where I could read upon on it?
<bike>
generally speaking, you'll have a more flexible program if you use actual data structures and not just pretending lists are actual data structures. that applies to pretty much any kind of program, including compilers.
<bike>
and don't just pretend*
<bike>
i don't know what you mean about under the hood and sbcl. are you asking about performance characteristics?
<tok>
Yeah performance and maybe if there is something to know about how GC would handle those, just spitballing
Patternmaster has quit [Quit: leaving]
<bike>
sbcl will generally inline structure accessors, and if nothing else will have constant time random access into their slots, which you won't get with lists. GC handles either one fine.
mgl has quit [Ping timeout: 255 seconds]
<bike>
this said, in my experience it is unlikely that accessing data structures will be the main performance bottleneck in your compiler. making them, maybe, but that's more down to how much stuff you allocate rather than what you allocate.
jonatack has joined #commonlisp
Jach has joined #commonlisp
glaucon has joined #commonlisp
<Shinmera>
but SBCL also reserves a word for every structure slot unconditionally, so you can't tightly pack data :(
Oladon has quit [Quit: Leaving.]
<bike>
really? okay, i guess that's a GC relative characteristic then. i guess that could be vaguely relevant to a compiler if you had a small bitfield or somethin
<Shinmera>
I whined about it in #sbcl one time and Stas looked into it briefly but gave up for some reason he didn't elaborate on
<Shinmera>
It's one of the many things I would like improved
<Shinmera>
I assume at least one of the reasons it's not straightforward is that now slots need an offset table rather than just an index
danza has quit [Read error: Connection reset by peer]
danza has joined #commonlisp
<bike>
yeah, i think - don't quote me on this - sbcl structure objects have a bitmap to tell the GC which words in the object need to be scanned. if you had sub word fields you'd need to do something else there, or at least toss the sub words to the end
notzmv has joined #commonlisp
<White_Flame>
Shinmera: but with packed objects, you need key or class descriptors added in as well
<White_Flame>
to specify which slots are included
<Shinmera>
"but"?
<White_Flame>
for structs with, say, less than 8 slots, I could see the packed version taking more space with key/value pairs, and much more complexity with shadow-class style descriptors
<White_Flame>
(with big "YMMV" stickers plastered on, of course)
<bike>
what are you talking about?
<Shinmera>
? why would instances take up more space
<Shinmera>
sure the class would, but that's not replicated with instances
<bike>
if you mean the descriptions of what types the slots have, that's part of the structure class, not the instance
<White_Flame>
"<Shinmera> but SBCL also reserves a word for every structure slot unconditionally, so you can't tightly pack data :("
<bike>
other than the bitfield
<Shinmera>
yeah I know what I said thank you
<White_Flame>
for bike
<Shinmera>
I think he knows that context
<bike>
i also know what shinmera said, and i don't see what it has to do with what you said.
dustinm` has quit [Read error: Connection reset by peer]
<White_Flame>
I don't think smaller structs have the problem he's describing
<bike>
if i am not mistaken, shinmera is talking about something like (defstruct foo (s1 0 :type (unsigned-byte 32)) (s2 0 :type (unsigned-byte 32))). in SBCL, s1 takes up one word and s2 takes up one word, instead of them both being packed into one word.
<White_Flame>
vs alternatives to them
<Shinmera>
White_Flame: who's descibing?
<White_Flame>
oh, you mean sub-word packing, as opposed to eliding unused words?
<Shinmera>
yes
<White_Flame>
ah, ok
<Shinmera>
also if you were talking about me, that's *she
<White_Flame>
oh, sorry again
danza has quit [Ping timeout: 272 seconds]
<Shinmera>
anyway, the primary reason I want tighter packing is for better C interop, so I can hand lisp structs to C without having to realloc and repack.
<White_Flame>
if you do field packing into words, then does it matter whether it's a struct or not?
<Shinmera>
yes yes I know about compiler dependent packing in C, don't @ me
<Shinmera>
White_Flame: what do you mean?
<White_Flame>
if you're manually packing less than machine-word width fields into CL slots, then does it matter if it's a struct vs vector vs some other carrier?
<Shinmera>
I'm not manually packing things
<Shinmera>
I want the implementation to tightly pack things in memory if I declare the slot types to make that possible
<Shinmera>
and vectors can't carry mixed types like ub32/single-float/etc
<White_Flame>
ok, I guess I was going more off of tok's context than a C interop context
<White_Flame>
*tok's compiler context
<Shinmera>
Ah, sorry, yeah, my comment is unrelated to that.
<bike>
can't you control C packing with... alignas or something? but maybe you don't control the c library
<Shinmera>
you can and usually the compilers agree on the packing rules
<Shinmera>
so it's pretty stable
<Shinmera>
it's just one of those language lawyers things of ☝️🤓 well akshully the C standard does not guarantee packing
<Shinmera>
as if anyone ever wrote a piece of C that didn't rely on undefined behaviour
<bike>
sure, sure, like how maybe the program is running on a Setun and CHAR_BIT is -11
<White_Flame>
I'm pretty sure even default hello world programs get into UB
<Shinmera>
yes
<Shinmera>
anyhow, it's not that important, just one of those things where I thought "oh hey I can save some copying by passing the struct" and being slightly miffed to find out the data isn't packed like I thought it'd be.
<Shinmera>
having actual struct-by-value in sb-alien would be more valuable to start off with
zxcvz has joined #commonlisp
mgl has joined #commonlisp
<White_Flame>
yeah, I've certainly considered having a struct-like definition which generates accessors that LDB across fixnum array buffers or bitstreams
<Shinmera>
I have thought about that so much
<Shinmera>
and I still don't have a solution that doesn't suuuuck
<White_Flame>
*bit strings
<Shinmera>
(and that's why that part of binary-structures is not yet complete)
* White_Flame
makes a note not to get on IRC while not feeling well :-P
<Shinmera>
Oh dear, please take care of yourself!
dustinm` has joined #commonlisp
<White_Flame>
I have a pretty decent prototype spec for reading binary files. It can do things like read entire java .class files with things like auto-resolving constant pool pointers etc
<White_Flame>
but that manifests nested CL values instead of generating direct accessors into a binary blob
<Shinmera>
I can do stream reading with binary-structures to a satisfactory degree, too, but what I can't do yet is "thin parsing" wherein I don't copy into memory, but rather generate thin representations that index into a seekable stream or memory region.
<Shinmera>
I keep hitting a wall when I try to think about how to do it
<White_Flame>
I really hit a lot of that sort of stuff with going through the sqlite source and seeing if I could make a native lisp version. There's no good way to use mmap with the lisp heap
<Shinmera>
I *mostly* want this for my Simple File Format Family, since they're designed to be memory-mappable
<White_Flame>
except having a proxy object for each element in the mmap I guess
<Shinmera>
*the formats
<Shinmera>
White_Flame: yeah, I reaaaaally wish I could have a lisp vector point into some random memory region, etc
<Shinmera>
rather than only having the inverse
<Shinmera>
and yes I know about that project that I think _death wrote?
yitzi has joined #commonlisp
zxcvz has quit [Quit: zxcvz]
<White_Flame>
here's my java class file spec, I have another one just for the opcode portion: https://termbin.com/8eom
<White_Flame>
certainly very similar vein to your project
<Shinmera>
neato
<White_Flame>
I made sure that things like the length of a vector of objects in the file can be defined by fields that came before it dynamically
* White_Flame
quietly places a door mat into that 3d world
<White_Flame>
also, nice
<Shinmera>
well, with how painted this is gonna get once I get around to more sfx I don't think a doormat is gonna be enough :)
<Shinmera>
*vfx
contrapunctus has left #commonlisp [#commonlisp]
glaucon has quit [Quit: WeeChat 3.5]
cage has quit [Quit: rcirc on GNU Emacs 29.1]
tyson2 has quit [Read error: Connection reset by peer]
mgl has joined #commonlisp
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
rtypo has quit [Ping timeout: 240 seconds]
bubblegum has joined #commonlisp
Algernon69 has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
triffid has quit [Remote host closed the connection]
attila_lendvai has quit [Ping timeout: 245 seconds]
shka has quit [Ping timeout: 255 seconds]
zaymington has quit [Ping timeout: 258 seconds]
tok has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
bubblegum has quit [Ping timeout: 245 seconds]
anticrisis has joined #commonlisp
habamax has joined #commonlisp
azimut has joined #commonlisp
mgl has quit [Ping timeout: 240 seconds]
Algernon69 has quit [Ping timeout: 264 seconds]
pve has quit [Quit: leaving]
random-nick has quit [Ping timeout: 260 seconds]
Pirx has quit [Ping timeout: 240 seconds]
Pirx has joined #commonlisp
waleee has quit [Ping timeout: 248 seconds]
waleee has joined #commonlisp
dino_tutter has quit [Ping timeout: 246 seconds]
dom2 has quit [Ping timeout: 245 seconds]
liminality has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 272 seconds]
rgherdt has quit [Quit: Leaving]
<Gleefre>
I wrote a tiny library so that you can do something like this: (defun/capture foo () (declare (capture :variable x)) x) (let ((x 10)) (foo)) ; => 10
<Gleefre>
Is there some kind of existing analogue?
splatt9990 has joined #commonlisp
<mfiano>
dynamic lambdas ala Let Over Lambda. More specifically the plambda variant (pandoric macros)
<Gleefre>
I'll take one more look at it then, thanks!
liminality has joined #commonlisp
<mfiano>
It fakes it with symbol macros. Don't take anything in that book as the way to do things. On the other hand, it avoids the CLtL2 environment extension requirement
habamax has quit [Ping timeout: 258 seconds]
donleo has quit [Ping timeout: 258 seconds]
habamax has joined #commonlisp
edgar-rft has quit [Ping timeout: 252 seconds]
<Gleefre>
Hm, honestly it doesn't seem related.
<bike>
how does this macro work, exactly?
<Gleefre>
defun/capture defines the function with a (gensym) as a name and a macro named foo that passes "captured" elements of the lexical environment
<bike>
oh i see now. okay.
<Gleefre>
So plambda seems to work in other direction - it allows to "export" lexical variables, while "captures" allow to grab a value from caller's lexical environment
<bike>
i have no idea why you would want this. how are you using it?
<mfiano>
It's called defun/capture but you cannot funcall it?
<Gleefre>
Yes, you can't :/
<mfiano>
That is a bit misleading
<Gleefre>
Well, it kind of obvious from what the functionality is that it can't be funcalled - plus I do plan to add it to documentation when/if I write it
chomwitt has quit [Ping timeout: 264 seconds]
<Gleefre>
But if you have a better name I'd be glad to use it instead :)
<Gleefre>
bike: I'm implementing another macro using it - "wrap-if"
<bike>
is that different from (defmacro wrap-if (form wrapper &body body) (let ((fsym (gensym))) `(flet ((,fsym () ,@body)) (if ,form ,(append wrapper `((,fsym))) (,fsym)))))
<bike>
like i don't understand why the capture matters, if the body is right there anyway?
anticomputer has joined #commonlisp
<Gleefre>
Yes, the "pure flet" variant won't "capture" newly created variable
anticomputer_ has quit [Ping timeout: 252 seconds]
<Gleefre>
As it is in lexical environment of the call to (,fsym), but not of its definition
<bike>
what newly created variable?
<Gleefre>
By the wraper, for example (with-input-from-file (in in))
Oladon has joined #commonlisp
eddof13 has joined #commonlisp
<bike>
but... how would that work in the branch when the form is false?
<bike>
where IN isn't bound
eddof13 has quit [Client Quit]
eddof13 has joined #commonlisp
<Gleefre>
But you can rebound a variable, as (with-input-from-file (in in)) does
<bike>
in any case you could just swap out flet for macrolet and there you go
<bike>
and a progn i guess
<Gleefre>
That would make the macro double the code
<Gleefre>
Which can be dangerous
<bike>
does your macro not double the code? how could it not? each branch is referring to a different lexical variable
<Gleefre>
It doesn't double the body, but just a single call
<bike>
how does that work, exactly? what does wrap-if expand into?
<Gleefre>
It expands into (flet/capture (func () <body>) (if <test> <wrapped-call-to (func)> (func)))
<Gleefre>
And flet/capture is (flet ((g!func (<args>) ...)) (macrolet ((func () (g!func <call-args>))) ...)
<Gleefre>
So a constant overhead is added (flet, macrolet, if and two calls) instead of doubling the amount of code.
<bike>
you know the other day you were aghast at me using macroexpand because it seemed like writing a code walker, and then you pull out whatever this is...? it seems like a lot of effort for a pretty rare thing to want to do
<bike>
like i guess this is sort of slightly better for this one thing, maybe
<bike>
if you don't mind introducing a macro and your own declaration syntax
<Gleefre>
I mean, I got something working with help from @tuntap from discord half a year ago, and then I needed it again and again so I decided to polish it.
<Gleefre>
Then I thought that I want it to be extensible (like passing functions instead of variables, or places, or user-defined namepsaces)
<Gleefre>
And then I separated captures & flet part
<Gleefre>
And so on
<bike>
i mean if it works for you that's cool, but i don't think i've ever needed something like this, and it's a bit hard to read
<Gleefre>
About macroexpand... Well, I do have my own fears :/ Sorry if that offended you.