redex icon indicating copy to clipboard operation
redex copied to clipboard

[RFC] merge [some|all] of unstable/gui/redex into redex

Open pnwamk opened this issue 6 years ago • 8 comments

I personally constantly use the following definitions from unstable/gui/redex when using redex:

binary-rw
prefix-rw
postfix-rw
function-rw
constant-rw
bracket-rw
set-cons-rw

Is there any desire to merge some/all of unstable/gui/redex into redex proper? Or is there a different approach that should be used towards making better high-level abstractions that aid in rewriting?

pnwamk avatar Mar 17 '18 15:03 pnwamk

I like the api of all of those.

Do they actually work when there are multiple lines involved? I think getting that right is tricky, so if there is any doubt at all, I'd prefer a dynamic check that raises an error when the arguments span multiple lines (and then, in a separate pass, we can work out what to do and what new keyword arguments should be added to help control the options in those cases)

rfindler avatar Mar 17 '18 15:03 rfindler

Oops -- I left off splice-rw which is also a simple/useful one IMHO.

pnwamk avatar Mar 17 '18 15:03 pnwamk

Through some quick experimentation (i.e. I haven't checked the code) I did not seem to get any errors with multi-line input on any of those forms (but for a few, not raising an error seemed like the expected behavior to me):

Do the following error on multi-line input?
-------------------------------------------
binary-rw   - no
prefix-rw   - no (okay?)
postfix-rw  - no
function-rw - no (okay?)
constant-rw - no (okay?)
bracket-rw  - no (okay?)
set-cons-rw - no
splice-rw   - no

pnwamk avatar Mar 17 '18 15:03 pnwamk

No, that's not what I'm saying. I'm not saying that they will raise errors. I'm saying that there is no one-best right behavior for multi-line inputs and so I would prefer to not be constrained with backward-incompatible changes that fix these functions.

As for splice-rw, that one seems strange. I do not understand what the docs mean.

rfindler avatar Mar 17 '18 15:03 rfindler

I see -- that makes sense.

splice-rw drops the leading symbol and the parens from the form, e.g. if could be used to typeset (typeof Γ ⊢ e : τ) as Γ ⊢ e : τ

pnwamk avatar Mar 17 '18 15:03 pnwamk

It replaces them with ""?

rfindler avatar Mar 17 '18 15:03 rfindler

Um... I could be mistaken but it looks to me like it literally just drops them from the lw:

(define (splice-rw)
  (compound-rw 'splice-rw
    (lambda (lws)
      (drop-right (drop lws 2) 1))))

(that code from here)

pnwamk avatar Mar 17 '18 16:03 pnwamk

Oh, that's just wrong, then.

rfindler avatar Mar 17 '18 16:03 rfindler