jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
Oladon has quit [Quit: Leaving.]
dipper has joined #commonlisp
saura has joined #commonlisp
saura has quit [Remote host closed the connection]
ym has quit [Ping timeout: 268 seconds]
random-nick has quit [Ping timeout: 260 seconds]
Madsy has quit [Quit: Leaving]
lisp123 has quit [Ping timeout: 260 seconds]
semi has joined #commonlisp
karlosz has quit [Quit: karlosz]
Oladon has joined #commonlisp
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #commonlisp
Oladon has quit [Read error: Connection reset by peer]
semi has quit [Quit: Using Circe, the loveliest of all IRC clients]
Oladon has joined #commonlisp
zyni-moe has joined #commonlisp
zyni-moe has quit [Client Quit]
terrorjack has quit [Ping timeout: 252 seconds]
terrorjack has joined #commonlisp
pve has quit [Quit: leaving]
lisp123 has joined #commonlisp
<lisp123> What are the downsides of representing a buffer as an Array of strings, one for each line?
<kakuhen> depends on what you're doing i guess... the buffers I often deal with would make that representation a very inconvenient one...
Fare has joined #commonlisp
<lisp123> kakuhen, why is that
<lisp123> is that because you are reading across lines?
<kakuhen> no, because i misunderstood what you meant by "buffer"
<kakuhen> i was thinking more generally
<lisp123> ah ok, I mean in terms of Emacs Buffer
<kakuhen> i usually deal with things like audio samples... which make that representation a bit inconvenient
<kakuhen> yeah, text buffers your idea seems alright
<mfiano> Text editors usually use moe complicated text buffers, such as ropes
<mfiano> Arrays of arrays (array of strings) cannot be made very efficient either, being an array of pointers.
<lisp123> mfiano, could you expand on that
<mfiano> Which part?
<lisp123> "cannot be made very efficient either, being an array of pointers."
<mfiano> (upgraded-array-element-type 'string) says it all
<mfiano> (see associated sections of the standard too)
<lisp123> thanks, will read
igemnace has quit [Ping timeout: 264 seconds]
<lisp123> the context of why I'm going down this route (after doing some analysis), is that an array of 'lines' lends itself to subclassing lines to various media formats - plain text, rich text, pictures, videos, etc
<lisp123> so I want to see how much the disadvantage is for a 'pure plain text' buffer
<lisp123> Although what I could do is treat each line as buffer in itself
<mfiano> I seem to recall there was a way to tell CL to invoke the debugger on printer releated errors, instead of silence and seeing <<error printing object>> (on SBCL) in the printed repr. Is that something on the CL side or SBCL side? (it's been way too long for me to remember this stuff). cc: yitzi I think it was who wrote a portable printer implementation.
<Fare> mfiano: in those cases, I had handlers or ignore-errors and validity checks in my own print-object methods
<mfiano> Ah it is cl:*break-on-signals*
lisp123 has quit [Ping timeout: 260 seconds]
thuna` has quit [Remote host closed the connection]
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #commonlisp
semi- has joined #commonlisp
semi- has quit [Remote host closed the connection]
nij- has left #commonlisp [Using Circe, the loveliest of all IRC clients]
tyson2 has quit [Remote host closed the connection]
Fare has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 264 seconds]
pjb has quit [Ping timeout: 264 seconds]
Oladon has quit [Quit: Leaving.]
Fare has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
Krystof has quit [Ping timeout: 260 seconds]
Oladon has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life_ is now known as Lord_of_Life
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
Fare has quit [Ping timeout: 260 seconds]
Oladon has quit [Quit: Leaving.]
ec_ has quit [Remote host closed the connection]
ec_ has joined #commonlisp
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
causal has quit [Quit: WeeChat 3.7.1]
dipper has quit [Remote host closed the connection]
dipper has joined #commonlisp
ec_ has quit [Remote host closed the connection]
ec_ has joined #commonlisp
causal has joined #commonlisp
<splittist> lisp123: Thanks for the warning.
<splittist> lisp123: also, have you looked at Cluffer and its use in Second-Climacs?
ec_ has quit [Remote host closed the connection]
ec_ has joined #commonlisp
enzuru has quit [Quit: ZNC 1.8.2 - https://znc.in]
rainthree has joined #commonlisp
enzuru has joined #commonlisp
genpaku has quit [Remote host closed the connection]
pve has joined #commonlisp
genpaku has joined #commonlisp
ym has joined #commonlisp
random-jellyfish has joined #commonlisp
<pve> Good morning! Continuing the theme of file-local things, I wanted to see if symbols can be made file-local. Here's an example of what I got:
<pve> But the hyperspec page for the reader algorithm says that "The reader macro function must not have any side effects other than on the input stream...", and I'm not entirely sure how to interpret that.
jackdaniel has quit [Changing host]
jackdaniel has joined #commonlisp
epony has quit [Ping timeout: 268 seconds]
<beach> What is it you are unsure about?
<pve> beach: the reader collects the file-local symbols into a table as it goes through the file, and replaces the occurrences with uninterned symbols.
epony has joined #commonlisp
<pve> I guess it's a side effect, but on the file level it doesn't seem to make a difference.
<beach> Yes, I also think it is a side effect. How does that work if the symbol ends with the special character?
<pve> do you mean how it's implemented?
<beach> Yes.
<epony> are you talking about NUL terminated strings? ;-)
<epony> (or is it about value terminated pointers)
<pve> beach: when it encounters "%FOO" for the first time it adds an "%FOO" -> #:FOO entry to a hash table, on subsequent occurrences it uses that same uninterned symbol
<beach> I was asking specifically for the case when the special character is at the end of the name. And I am asking how you program the reader to do that.
<pve> uh, I mean "%FOO" -> #:%FOO
<Nilby> pve: The standard reader macros have side effects, so the hyperspec is being a little hypocritical. It's probably good to make sure reader macros don't have _unintended_ side effects, but I think every CL allows it.
<pve> beach: oh, I use (alexandria:ends-with "%" (symbol-name sym)), if that's what you mean..
<beach> Oh, so you traverse the buffer "manually" to replace symbols?
<White_Flame> #.(setf *side-effect* :lol)
<beach> pve: Or let me ask it this way: What reader macros did you define?
<pve> beach: oh ok, with-symbol-expansion sets up the readtable that "intercepts" the standard reader for all "standard" characters
<beach> Oh, wow. I see.
<pve> so all characters point to the same reader macro function
<beach> Too bad you are not using Eclector. It would be much simpler, and you would not need to violate the restrictions of the standard.
<pve> beach: you mean specialize the method that "interns" symbols?
<beach> Yeah.
<beach> But I guess you want this thing to work with the default reader of the Common Lisp implementation.
<beach> Then let me change to "Too bad all major Common Lisp implementations are using a reader other than Eclector".
<jackdaniel> pushy
<pve> beach: If I were to use eclector, I think I would still need to intercept the standard reader for all characters to redirect to eclector at the beginning of the file. Unless some asdf voodoo can be done to change how a file is loaded (I think I would rather load with CL:LOAD).
<beach> Yes, I don't think you can change what reader CL:LOAD uses. But that would be handy if it were possible.
<jackdaniel> but you can change the readtable it uses (i.e with asdf-flv extension)
causal has quit [Read error: Connection reset by peer]
<pve> But regardless of the choice of reader, I think it's pretty neat that helper functions or special variables can be made file-local. I, at least, sometimes have trouble coming up with names for helper functions because I usually want them to be short (like with flet or labels), but at the same time they can't be too short because the (perceived) risk of clobbering other functions grow bigger. I know this
<pve> isn't *really* an issue, but the anxiety is still there :)
<beach> jackdaniel: "pushy"? I meant that just as a reiteration of my well known position, i.e., that there is a lot of duplicate effort in the Common Lisp community, and we are already short of peoplepower.
causal has joined #commonlisp
<jackdaniel> hm, let me elaborate: surely creating yet another reader reduces the the amount of duplicated effort; by pushy I mean that you reiterate your well known position (that imlementations should replace their own modules with your clearly better ones) quite frequently
<beach> Eclector is not just another reader. It can do things that no standard reader of any existing implementation can do.
causal has quit [Ping timeout: 256 seconds]
<_death> pve: I often use package-inferred-system style, where each file defines its own package.. this removes the anxiety of choosing such internal names
Krystof has joined #commonlisp
<Nilby> Eclector is actually harder to use the standard reader, and can't function as a standard reader without the "client" supplying a number of pieces. Recommending it for things the implementation's reader can do seems inappropriate.
<pve> _death: I go back and forth on package-inferred style, but I it does help with the anxiety for sure.
<beach> Nilby: I see.
<Nilby> On the other hand, the standard reader is missing one crucial feature from Lisp Machine Lisps that makes it impossible to do a number a very useful things.
<pve> Nilby: what's that?
<Nilby> pve: Customization of intern via something like *read-intern*.
causal has joined #commonlisp
<pve> ah, ok
<_death> pve: it has the added advantage that nothing out of the ordinary (for a CL programmer) is going on..
<pve> _death: yeah, true
pjb has joined #commonlisp
<Nilby> beach: I'm not trying to pick on Eclector. I think it's great to have a fully customizable reader. But it can be tricky to use, especially for replacing the implementation's version.
<pve> _death: But sometimes I feel that there's a tiny bit too much friction with the package-inferred style if I'm just exploring (like frequently changing export lists). I dunno, maybe you know what I mean, or maybe it's just me.
<pve> If the experience could be made smoother somehow (opinionated is fine), I might be all over it. But this could be a case of having my cake and eating it.
son0p has quit [Ping timeout: 260 seconds]
<pve> like sometimes I know I want to USE everything in another file, except the helper functions, and figure out the exports later.
<_death> well, in tests and experimental code I sometimes use :: until I figure it out.. I don't mind it because it's the same project
<_death> when reading the code it sticks out like a TODO
<pve> right
<_death> and when the right interface to export comes up, removing those ::s feels good.. so win-win :)
<pve> wait a minute, couldn't I just automatically export everything that's bound to something unless the symbol contains, say, "%"?
varjag has joined #commonlisp
karlosz has joined #commonlisp
<_death> to me #\% and other such nuisance chars are too distasteful to use in names.. *foo* is as far as I go
rgherdt has joined #commonlisp
azimut has joined #commonlisp
<pve> it's not pretty, no
<_death> but do continue to experiment.. I bet it's fun ;)
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
igemnace has joined #commonlisp
random-nick has joined #commonlisp
varjag has quit [Ping timeout: 264 seconds]
dra has joined #commonlisp
ec_ has quit [Ping timeout: 255 seconds]
perrierjouet has quit [Quit: WeeChat 3.7.1]
son0p has joined #commonlisp
perrierjouet has joined #commonlisp
ec_ has joined #commonlisp
random-jellyfish has quit [Quit: Client closed]
cage has joined #commonlisp
rainthree3 has joined #commonlisp
cosimone has joined #commonlisp
rainthree has quit [Ping timeout: 264 seconds]
rainthree3 has quit [Read error: Connection reset by peer]
rainthree has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.7.1]
perrierjouet has joined #commonlisp
perrierjouet has quit [Client Quit]
ym has quit [Ping timeout: 268 seconds]
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
igemnace has quit [Remote host closed the connection]
hrberg has joined #commonlisp
tyson2 has joined #commonlisp
nij- has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
irc_user has joined #commonlisp
ym has joined #commonlisp
Madsy has joined #commonlisp
varjag has joined #commonlisp
perrierjouet has joined #commonlisp
mister_m has joined #commonlisp
dipper has quit [Remote host closed the connection]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
causal has quit [Quit: WeeChat 3.7.1]
igemnace has joined #commonlisp
<jcowan> Bike: Whether consing or mutating is slower depends on the GC algorithm
pranavats has left #commonlisp [Error from remote client]
<jcowan> As for license changes: take a look at the license of Python some time. Most of it is junk DNA that is carried around by the requirement not to strip the license text.
<jcowan> beach: see the Lisp Curse article: everyone implements their own 80% solutions
<jcowan> (not to be confused with seven percent solutions)
<beach> So what do you conclude from that?
nij- has quit [Ping timeout: 260 seconds]
rgherdt has quit [Read error: Connection reset by peer]
rgherdt_ has joined #commonlisp
<jcowan> That we have so much overlap because nobody is willing to say "I will include stuff in this library for which I myself have no use"
tyson2 has quit [Remote host closed the connection]
Fare has joined #commonlisp
<Shinmera> that's not the reason, but ok
<Shinmera> or at least that reason does not correlate at all with my observations.
<Shinmera> A similar reason that I *do* see is that it often feels like getting changes into an existing project is more effort than just writing a new solution. Or in the very least, it is much less appealing to do so.
morganw has joined #commonlisp
tyson2 has joined #commonlisp
ilmu[m] has quit [Quit: You have been kicked for being idle]
shka has joined #commonlisp
parjanya has quit [Remote host closed the connection]
rpx has joined #commonlisp
rpx has left #commonlisp [#commonlisp]
asarch has joined #commonlisp
<beach> I am not sure what to do with this information.
pfd has quit [Ping timeout: 260 seconds]
thuna` has joined #commonlisp
perrierjouet has quit [Quit: WeeChat 3.7.1]
jmdaemon has quit [Ping timeout: 264 seconds]
irc_user has quit [Quit: Connection closed for inactivity]
perrierjouet has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
cosimone` has joined #commonlisp
waleee has joined #commonlisp
cosimone has quit [Ping timeout: 265 seconds]
gxt has quit [Remote host closed the connection]
azimut has joined #commonlisp
gxt has joined #commonlisp
Fare has quit [Ping timeout: 260 seconds]
Devon has joined #commonlisp
igemnace has quit [Remote host closed the connection]
random-jellyfish has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
waleee has quit [Ping timeout: 256 seconds]
Fare has joined #commonlisp
Fare has quit [Ping timeout: 256 seconds]
rgherdt_ has quit [Remote host closed the connection]
random-jellyfish has quit [Quit: Client closed]
karlosz_ has joined #commonlisp
karlosz has quit [Ping timeout: 265 seconds]
karlosz_ is now known as karlosz
Fare has joined #commonlisp
karlosz has quit [Ping timeout: 265 seconds]
grawlinson has quit [Changing host]
grawlinson has joined #commonlisp
asarch has quit [Quit: Leaving]
igemnace has joined #commonlisp
igemnace has quit [Remote host closed the connection]
cosimone` has quit [Remote host closed the connection]
Bung has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 27.1]
rainthree has quit [Ping timeout: 260 seconds]
Bung has quit [Quit: Leaving]
waleee has joined #commonlisp
lisp123 has joined #commonlisp
Bocaneri has joined #commonlisp
Bocaneri is now known as Guest7626
Sauvin has quit [Ping timeout: 260 seconds]
Guest7626 is now known as Sauvin
rangahy has quit [Ping timeout: 265 seconds]
lisp123 has quit [Read error: Connection reset by peer]
<dbotton> I am trying to understand what (declare dynamic-extent XXX) is used for
<dbotton> it seems both uses are valid, but what use is the second version?
<Bike> in both cases it's quite possibly pointless since the list is in constant memory.
<jackdaniel> I was about to say that
<Bike> in the second case it is invalid (i.e. the declaration is a lie)
<dbotton> was just typing that I don't understand point at all
<dbotton> for that reason anyways
<dbotton> so when would it be used?
<jackdaniel> when you have a somewhat large data structure that you know that it does not escape the dynamic extent
<jackdaniel> then it may be allocated on the stack (i.e it does not touch the heap)
<jackdaniel> hence is faster (i.e does not cons)
<jackdaniel> of course the compiler may ignore that declaration whatsoever and go straight to the heap with it
<dbotton> I think I am having difficult understanding then when it would be deallocated off the stack
<jackdaniel> when the stack unwinds, then it will be simply forgotten
<jackdaniel> that's the thing with the stack, you don't need to deallocate things
<dbotton> yes understand that, but which stack. of the function?
<dbotton> so this is a hit to say that nothing escapes the function
<dbotton> then if that is the case #2 should be invalid
<Nilby> Yes. Dynamic extent says the thing won't be used after the function returns. The details of the exact optimization can change
<dbotton> so dynamic extent is same as lexical scope here?
<dbotton> and if that is the case what is #2 valid
<jackdaniel> #2 is invalid (as Bike pointed out), but nothing will crash, because that data is not allocated on the stack
<jackdaniel> you have quoted it, so it is in the constant memory either way
<dbotton> ok so #2 is an invalid hint
<jackdaniel> yes
<dbotton> to the compiler - that at least with scbl is not reported
<jackdaniel> it is your promise to the compiler
<dbotton> so I am a crook :(
<dbotton> got it
<jackdaniel> some implementations may decide to ignore the declaration /unless/ they can formally prove that the value does not escape
<jackdaniel> other implementations may trust you and then gleefully have a segmentation fault
<jackdaniel> and sometimes it may depend on optimization settings
<dbotton> so why is it called dynamic extent - it is local scope
<dbotton> lexical scope - sorry
<dbotton> I may be confused in the definition here of dynamic extent
<jackdaniel> scope (dynamic or lexical) is about names, while extent is about values
<dbotton> so dynamic extent = value is in lexical scope
<jackdaniel> no
<jackdaniel> (defun xxx (a) (print a)) (defun yyy () (let ((foo (list 1 2))) (declare (dynamic-extent foo)) (xxx (list* 1 foo)))))
<jackdaniel> the list named foo in yyy is available in xxx (and xxx is invoked in the dynamic extent of yyy), but foo is not available for xxx by name
<dbotton> so lexical and dynamic or "local" - downward - indefinite = global
<jackdaniel> of course what I did is an undefined behavior, because print returns its argument, and I'm returning the result of xxx, but that's beside the point
<mfiano> is that undefined behavior there?
<mfiano> ah ok ninjad
<Nilby> I don't want to add confusion, but print could call a print-object method that steals the object too.
<jackdaniel> "steals"?
<Nilby> Allows it to escape dynamic extent.
<dbotton> so if you are hinting dynamic-extent to compiler you should tell users of your function not to "steal" your object
<dbotton> or potentially a seg fault?
<jackdaniel> you should not let escape variables with dynamic extent to escape, in other words you should not call functions that may capture the variable outside of it
<dbotton> got it, sorry had it inside out
<Nilby> e.g. like when CLIM prints an object in a listener window.
<jackdaniel> Nilby: yes, I get it now, thanks
<jackdaniel> dbotton: scopes and extents are orthogonal
Fare has quit [Ping timeout: 260 seconds]
<dbotton> are there any other things to be careful with using such a declare?
<Nilby> jackdaniel: Sorry, I know you're highly versed in CLIM. Maybe even CLOG can do something similar.
<jackdaniel> for example (block foobar (lambda () (return-from foobar))) ; -the returned function is defined in the lexical scope of the block, but escapes its dynamic extent (and invoking it will lead to a runtime error, unless you have a very peculiar implementation that travels in time)
<dbotton> thanks!
<dbotton> wonder if way to demo that graphically - should be able to show two time lines one for code and one for objects
<jackdaniel> strictly speaking the user is not allowed to write print-object methods specialized on system classes, but the point still stands about the capture if we replace a list with make-instance 'foo
<jackdaniel> good night \o
Oladon has joined #commonlisp
Fare has joined #commonlisp
jeosol has quit [Ping timeout: 260 seconds]
akoana has joined #commonlisp
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
Fare has quit [Ping timeout: 256 seconds]
jeosol has joined #commonlisp
jmdaemon has joined #commonlisp
Fare has joined #commonlisp
ym has quit [Ping timeout: 265 seconds]
random-nick has quit [Ping timeout: 265 seconds]
pve has quit [Quit: leaving]
attila_lendvai has joined #commonlisp
Oladon has quit [Quit: Leaving.]
dipper has joined #commonlisp
dra has quit [Remote host closed the connection]
aartaka has joined #commonlisp
rgherdt has joined #commonlisp
shka has quit [Ping timeout: 265 seconds]
rgherdt has quit [Remote host closed the connection]