4ever-clojure
4ever-clojure copied to clipboard
Can't delete outer paren when testing my own function in REPL
This is on mobile. So there is no Ctrl+-> and delete keys. Also to do character selection I need to use my finger and somehow select a single character.
So not being able to use my backspace gets in the way. Paren matching is great effort but for me it brings frustration only. For instance let's consider this case:
I'm testing my function to increase a number 5 because I don't yet want to submit the solution because it's not yet correct.
So what I would do is to wrap it into a (__ 5) so that I could test it in the REPL:
((fn [x] (inc x)) 5)
Then I would click Run, close the modal and try to see the result (when I'll find it) (that's also pretty bad).
And then when I want to clean it up (the outer invocation parens) I can't and that's especially bad on mobile. If I place my cursor here and press backspace then nothing happens and instead it moves to the left by one symbol:
((fn [x] (inc x)) 5)[CURSOR]
->
((fn [x] (inc x)) 5[CURSOR])
So um... that's not good. And then if I want to delete some forms inside I also suffer from this behavior because "unbalanced parens bad". For me this feels more like I'm forced to do it this way and it's especially bad when I really want to edit very large functions on mobile when I'll do the harder problems. IMO this hinders the use of this app as only the trivial problems will be attempted at all. Because others will be unusable.
So in that case I end up inserting identity everywhere but that's only useful for small problems. And this is not good (I did do this on original 4clojure Android app but this paren behavior would force me to use it even more).
Why not toggle this? Maybe later on people will understand that they shouldn't delete parens randomly.
Thanks this does make sense. I'd like to see if we can make it a bit less strict by default, if not then maybe think about toggling it/removing it altogether.
This is super valuable feedback though, I can see how this entire flow gets frustrating real quick!
And long time ago on 4clojure I was solving large problems on mobile too. And on mobile I was doing this:
(fn [inputs]
(letfn [my functions]
(->> inputs
fn1
fn2)))
I was opening the Android app while I was riding a bus and it didn't have any formatting effects in the input.
The only effect they had was correctly indenting the next line when I was clicking Enter. And that much of interference was actually good. I was deleting the line and then pressing Enter to reformat it correctly.
I think that instead of forcing parens I would prefer something like this highlighting (this is inside my nvim and I don't know if there is something usable for CLJS):

Also undo button wouldn't be a bad thing for mobile (I remember re-frame was bragging so hard in their documentation that this is so easy to implement... not sure about rum though).