Eli Barzilay <[email protected]> writes: > 9 hours ago, Jeremy Hankins wrote: >> >> I wrote a version of the position function that would work with >> circular lists, since the other one will start an infinite loop if >> you give it a circular list. > > That code is broken, as Timo points out. See correct version below.
Yes, of course. Thank you and Timo for explaining it. >> I've included the function below, but it turns out that infinite >> lists are only semi-supported -- calling length, or even evaluating >> them in sawfish-client, causes an infinite loop. According to the >> docs (where I should have looked first) only cons, car, cdr, rplaca, >> rplacd, nth, and nthcdr can be used on circular lists. > > That's a bad state. It means that doing some naive experimenting can > easily get your WM to die. (And dynamic experimenting is one of > sawfish's great advantages.) Having killed my wm several times when experimenting with this, I can certainly agree. The contra position is that few people who don't have at least some understanding of what they're doing are going to generate a circular list, but it does seem to me that where we can eliminate the possibility of crashing your wm we should. >> In short: I don't know that it's worth it to fix it elsewhere, even >> if we end up staying with rep, [...] > > The repl getting hung up is especially disturbing, and shouldn't be > hard to fix. Other functions can trip into an infinite loop but at > least they're easier to break. I say I don't know because I don't know how involved the changes to librep that would fix this would have to be. And if we are going to switch away from rep at some point it may not be worth the effort to go through and make the fixes, as well as possibly fixing bugs that crop up elsewhere as a result of the fixes -- though I wouldn't expect many of these. As I see it this is a reasonably compelling reason to switch to a lisp that's not specific to sawfish: more use-cases means more testing and fewer gotchas like this one. I've been ambivalent on the issue before, but this has made me rethink my view. [Interesting discussion of the right way to write 'position' snipped] -- Jeremy Hankins <[email protected]>
