freenode/#lisp - IRC Chatlog
Search
15:07:03
beach
Structure editing is going to be tough for Common Lisp with the presence of user-defined reader macros.
15:10:25
beach
You then kind of need to write code for the macro twice. Once for the reader and then another time for the editor.
15:11:02
beach
And if you distribute the code, you need to ship it with the editor customization as well.
15:11:39
kirtai
would medleys more image based orientation help? Since it's editing live code and not files directly
15:12:29
jackdaniel
what is the "live code" textual representation? i.e the loaded file is (list #p"/foo/"), how do you see that in the editor after loading it?
15:14:07
kirtai
jackdaniel: medley works more like a smalltalk system. Source is attached to the in memory code and is imported/exported to files
15:17:30
kirtai
if I understand you correctly, when you call up the code, the way it works is it shows you and lets you edit the in-memory version of the source.
15:19:37
beach
OK, so let's take an example. Let's say a Common Lisp programmer writes a reader macro, say ι to mimic APL vectors.
15:20:53
Nilby
My opinion is structure editors should work on post-read objects. The trouble then is is the aesthetic art of indenting, and so also semantic parsing.
15:21:07
beach
Now, the in-core version is just a vector. Is that going to be presented to the user as a vector of 100 elements, and if so, how does the programmer change it so that it is now the result of (say) ι50 instead.
15:22:16
beach
Nilby: Sure, but is that really convenient? Don't you have to stop using reader macros?
15:24:06
beach
How does the system "know" that this particular vector was the result of typing ι100?
15:26:49
shka_
beach: hey, do you recommend https://github.com/s-expressionists/Concrete-Syntax-Tree/tree/master/Lambda-list for basic lambda list parsing?
15:36:17
beach
Macros are no problem. They are represented like everything else. The main issue is reader macros.
15:40:28
phoe
so if we have (defun foo () ι100) then I suppose that the ι100 macro could be handled without much trouble
15:40:30
Nilby
I'm sure its obvious, but for example the reader macro for " turns into a keyboard macro which says let the user type a string a push it at the point. The display method (display (obj string) ...) puts quotes around it.
15:41:39
beach
Nilby: Again, the problem is not input. The problem is output. How does the system display the code in a way that allows user to edit it in a way that it was originally typed in.
15:42:18
Nilby
If you have a custom reader macro, you have to have custom display code, or you just get #(0 1 ..)
15:43:33
jackdaniel
my naive attempt at this would be preserving the textual representation and the underlying object (so reading it basically), when the programmer modifies the textual representation, then that part of the buffer should be re-read
15:43:44
beach
phoe: Yes, and I am now thinking whether that is really what is meant by "structure editing".
15:44:20
beach
jackdaniel: That is *definitely* not structure editing. And you are describing exactly what I do for Second Climacs.
15:44:49
Nilby
beach: That doesn't seem like much of a problem to me, especially given that hopefully non-standard reader macro use infrequent and close to redefining the language, e.g. zeta-c.
15:45:52
phoe
beach: I guess that you'd need to add a layer of indirection; if you have (defun foo () ι100) then you have a simple list structure under the hood, but you also could have a layer of indirection that points to that concrete list structure and also holds information about e.g. macro usage
15:46:12
phoe
so it can figure out that (make-array 100 :initial-contents '(0 1 2 ... 99)) was actually macroexpanded from ι100
15:46:46
phoe
then you'd need editable function objects to refer to this sorta-textual context information so it can be picked up by the structure editor
15:46:49
beach
phoe: Something like that would be needed, yes. Not sure about the implications of it.
15:47:24
phoe
I guess there would be none, other than for the fact that if such information is not provided then some reader macros may be expanded
15:48:22
beach
I am kind of wondering now what the original advantages of structure editing were meant to be, and how they would be preserved in such a scenario.
15:52:00
Nilby
I worked on a structre editor and my biggest problem was indendting and line filling, eg. when to + 2 3 vs. + next-line 2 next-line 3
15:55:40
Nilby
My fingers typed it, but my brain as usual has little recollection of the event. It so far hasn't made it out of the laboratory.
16:03:35
Nilby
I think I used medley a little bit a long time ago on a TI lispm. it was cool but as an emacs user, the key bindings felt awkward and would take some getting used to, probably like paredit.
16:11:44
kirtai
there's a short manual for sedit in the medley release notes at appendix b in this document: http://bitsavers.trailing-edge.com/pdf/xerox/interlisp-d/198809_Medley_1.0/400006_Lisp_Release_Notes_Medley_Release_1.0_Sep88.pdf
17:06:48
tfb
SEdit was ... well, if you haven't used SEdit it's hard to describe what it was like, but it was astonishing, or at least I remember it being so.
18:20:36
Xach
As I wrote, I'm happy to add anything and (perceived by me) quality is not a roadblock. But I do look at personal utility libraries a little harder than other stuff and would love to see if the authors are open to feedback and possible improvement.
18:36:17
shka_
Xach: btw, can you take a look and say if it displays fine? https://sirherrbatka.github.io/cl-data-structures/l_1.html#812753871995231275
20:14:09
dlowe
is there a library or implementation feature that allows for asserting that only one reference is held to a particular object?
20:16:07
Bike
dlowe: kind of hard to define, or to know that it's true given everything that happens under the hood
20:16:28
Bike
for example, if you write a defmethod, machinery is gonna keep the original arguments around for (call-next-method)
20:17:32
dlowe
if it's hard for a function, it's even harder for the poor human trying to figure it out
20:21:47
dlowe
so a gc in its reaping or copying phase comes across something that really-should-be-garbage but isn't, it can signal an error or comething
20:27:44
phoe
I don't know if I can use this tool properly though and if it does what I think it does
20:56:39
mseddon
dlowe, I appreciate your pain, and thanks for both your and phoe's insight into observing this
20:59:19
mseddon
Please do report back how complete it's coverage is. It's at least conservatively great.
21:01:46
dlowe
mseddon: I would have to manually add (garbagify <object>) calls everywhere to figure out coverage
21:05:39
phoe
an error, what do you mean? that you want to signal an error if a given object is alive?
21:06:41
phoe
a minor issue is that the SBCL GC runs in the C world, you'll need to jump back to Lisp... which will be troublesome because the world is stopped during GC
2:41:31
Alfr_
dbotton, even (defconstant foo 12) (setf foo 13) doesn't need to trigger an error. It's only undefined behavior.
2:42:33
aeth
implementations are afaik permitted to add a (declare (whatever foo)) if they wanted to
2:48:00
dbotton
is there a reason why the standard felt the need for a deconstant but not on a local basis?
2:48:11
aeth
I don't think there's a way, but (declare) is valid so if you had to do (let ((x 1)) (declare #+your-cl (immutable x)) (setq x 10)) you could still write perfectly portable code here.
2:49:22
aeth
(and I think they're supposed to ignore unrecognized forms inside of DECLARE, so I think but am not sure, that that would just be a warning if you didn't do that)
2:51:51
aeth
Anyway, that's probably my guess as to why it's not in the standard. Because they probably anticipated that they didn't create an exhaustive list of useful declarations
2:59:09
aeth
dbotton: Sorry, what I mean is I don't think there was a particular need to include this in the standard since it gave implementations the power to add it, and they probably weren't really thinkinng about this sort of thing 30 years ago.
3:00:16
aeth
dbotton: You could also, yourself, create a macro that does this without even code-walking, since DEFCONSTANT exists. Just symbol-macrolet