Arc Forumnew | comments | leaders | submitlogin
1 point by aw 5469 days ago | link | parent

Say, have you ever used labels? When I wrote my first version, I said, "ah, labels, good idea, I'll put them in". Then after using it for months I noticed that I wasn't ever using the label. So I took it out on my next iteration.


2 points by rntz 5469 days ago | link

I have used them. Mostly I used them for debugging, rewriting, "code sketching" as it were. Without them, extending or reextending a function at the REPL is just annoying; if you ever make a mistake in the test function you have to reload the original function. I suppose it might make sense to have two macros - extend and extendl, maybe - one which doesn't take a label, and one which does.

-----

1 point by aw 5469 days ago | link

How about an undo, to undo the last extend you did?

Or a reextend macro, which undoes the last extend and then applies the new extend?

What I found annoying myself about the label was that I had to type it every time, even if it turned out that I didn't need to rewrite it.

-----

1 point by rntz 5469 days ago | link

Undo & reextend could easily be implemented on top of labeled extend - just store the label last used when extending a given function in a table, along with whatever information is needed to undo that extension, and have an unlabeled extension macro that uses a gensym as the label. That way we get labeled & unlabeled extend with undo & replacement.

-----