-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dedicated syntax for timeouts #333
Comments
I think you really nailed it! What you propose kills multiple birds with one stone and I would even go a bit further: On a given layer, every key can have a “regular” binding (
and by default a regular binding of each key to its own or the special layers exists (as is the case right now). Conditional bindings are only considered if they are in the topmost active layer on the stack, and if the condition is not met or in the absence of a conditional binding, a regular binding is searched in the layer stack as usual (starting at the topmost active layer). Instead of
one would now have to write
which might look more complicated at first and slightly changes functionality, but looking at the result in total it seems much more intuitive to me (as overloading is currently realized by
I would even go farther and allow the right hand side of a binding to take one of the following forms:
with the comma of course up for discussion. This is not a sneaky attempt to finally get
In total, one would thus have a very intuitive binding syntax with “condition = consequence” semantics, which, like the English language, is built up in layers (pun intended), in the sense that you can already speak with minimal knowledge of words and grammar. If you don't care about advanced features, just use Proposal for the values of EDIT: Maybe one should sacrifice brevity for even more clarity: Instead of Propsal for the values of Some examples:
would become
which is much more expressive in my opinion.
This could now be achieved via
again resulting in much more clarity.
as proposed in #277, one could now write
which is self-explanatory. I really hope that I didn't overlook some serious side-effects letting all of the above implode. |
I haven't had time to read herrsimon's post yet, but it likely won't alter my position.
Thanks for making this nice and concise :).
My problem with this is that it introduces an implicit dependency between different bindings. Specifically it's not clear how:
differs from:
at a glance. Assuming the latter is identical to 'overload2', the second binding silently changes the interrupt logic. The behaviour of This is actually quite unintuitive (imo). I think to those of us that have been steeping in the problem domain, it might at first appear simple, but in practice the user is going to have to develop an understanding of several different concepts by reading the man page. The word
The parentheses are a feature, not a bug ;). Nesting is generally a bad sign, but if the user is doing something sufficiently complex, the cost of them is minimal.
I'm not convinced this is significantly easier to understand than
I have been meaning to revisit the naming issue, but that should probably be done in another issue. Feel free to ping me on IRC if you want to iterate in person (or just post here). |
The idea of also pulling sequential overloads into the EDIT: I'm on my phone now, will reply to the rest in a bit! |
The ten seconds are just some long dummy timeout, you could as well set it to one minute or so. Shift triggers as soon as another key is pressed before the timeout (or when you hold uninterrupted for the timeout). As I said, it slightly changes functionality, but I don't see situations where this could be problematic. It could also be seen as an advantage that on tapping shift less key events are produced.
You are of course right, in this case I made an exception as everything is very connected (changes the way the overloads are achieved).
It would be nice if we could all discuss in realtime at some point. I have to get some sleep right now but for future planning: My current timezone is GMT+2. |
With apologies for the back-and-forth that I promised to save you from!
I realize this, and would have anticipated that response --- were it not for the fact that combos will also introduce this dependency, even without hold times. Also bear in mind that
This is unavoidable once you allow the user access to timeouts. It's better to give it to 'em plain. With my suggestion, the crucial question will at least be confined to a single spot, with only one clear yes-or-no (while you hold this key, would pressing another key cancel the timeout or not?), as opposed to the question being hidden in primitives that end up forcing users to either reverse-engineer the question, or blindly try stuff without understanding the manual. I suppose that you want users to pick an overload based on whether the key is often struck chorded or in sequence. But it's futile to try to hide from them that the solution is to add a timeout and queue. After all, they have to provide a timeout value! And where does this latency come from? Best to avoid mysterious primitives and instead provide short but sufficient directions in the manual.
On its own, I agree that it's not much better. But it should be easier to grok in the context of the whole manual, because it would use the same syntax every time. Anyway, I just wanted to float the idea. In the end, it's a matter of taste. Let's reopen the issue once you've also seen in your mind's eye all the squeaky clean configs that could have been ;)
No, the timeout would be cancelled. For the purpose of this issue,
+1 Footnotes
|
I know I closed the thread, but on second thought I'd make
becomes
while
becomes something like
That should cause less confusion about purpose and alleviate concerns about leaking implementation details. |
First of all, I really think that it would be much more efficient if we can all have a realtime chat about it in the next weeks. If you agree, let's collect our timezones first (again, mine is GMT+2) and then figure out a good time and date. Also, for the sake of finally being somewhat concise, I'm not going to comment on everything what was written so far (and predict that I will yet fail in my endeavour). @slakkenhuis
So please forget my proposal of removing Please also forget my proposal of introducing the comma on the right hand side of a binding for this discussion, besides of not being optimal, it is purely distracting here. The core of what we're discussing here is whether the timeout functionality should move from an action (on the right of a binding) to a trigger (on the left of a binding). First of all, let me just throw functional syntax in the ring, so that the contenders now are
where
or just the more concise wordings proposed by @slakkenhuis. Again, if the trigger condition is not met, a simple binding should be looked up in the layer stack, starting from the topmost active layer. The functional syntax has the disadvantage of not being able to specify a default, but it is more flexible regarding future extensions and bindings would be symmetrical as the right hand side is already written in a functional way. I`m slightly leaning towards @slakkenhuis's proposed syntax at the moment, as it keeps the affected key at the very left and thus associated simple and trigger bindings can be singled out more easily in the configuration file. On the other hand, the functional syntax seems to better convey the fact that something is happening to the key (and thus the simple binding) in the first argument. No matter what the syntax will be, the non-syntactical advantages would be:
Regarding @rvaiya`s criticism that the proposal creates a dependency between multiple bindings: This is true but the problem only occurs on the same layer, whose bindings typically fit in total in the editor window. So unless the user is very messy with the config, a trigger binding will typically appear in the vicinity of the simple binding it affects. If the trigger mechanism is introduced properly in the manual, I agree with @slakkenhuis that this should only be a minor issue, although the necessity of sometimes having to write the key or combo to assign to twice itches me a tiny bit. In total, I'm still in favour of @slakkenhuis's proposal. |
Extensions and syntactic variations are possible, but it was an intentional decision not to elaborate on them, because they would at this point overwhelm the question of whether splitting the timeout into multiple statements is intuitive in the first place. I strongly feel that it is, primarily because it's consistent with combo notation, with many pleasing side effects (and you've noted additional ones, which make it more attractive). But beyond that, it's mostly about gut feeling, which led me to close the issue.
That's not necessarily true. You could add a timeout to a key that inherited its mapping from another layer. I don't think that's a problem, but some way of emphasizing the dependency via
Yeah, I should finally be in the channel on my phone now, so we can chat there. |
Feel free to close this issue without comment if it doesn't feel right --- since it's primarily aesthetic, I don't think it warrants having long back-and-forths ;) That said, this suggestion could inform the decisions in #309 and #320.
@herrsimon's comment about required hold times in #320 gave me an idea: what if
timeout
s were given dedicated syntax in general?That is, instead of this:
... you'd do something like this:
The default behaviour would be that intervening events interrupt the timeout. Queueing behaviour would be achieved with a slight modification, so that you could get the proposed
f = overload2(shift, f, 200)
with something like:In my opinion, this communicates intent rather well and needs minimal reference to the manual. It's succinct and the right-hand side of the configuration stays blissfully low on parentheses and number suffixes and timeout arguments. It has other benefits:
Since the second argument of
overload2
will usually just be the 'original' key on that layer, you can often treat the binding for that end of the timeout as optional. So in the above example, you'd really only needf 200ms queue = overload(shift, f)
, or even justf 200ms queue = layer(shift)
, which keeps the configuration tidy.As mentioned, it would immediately play well with optional required hold times on combos.
Timeouts can only occur as an outer expression anyway, which is a limitation that this syntax would naturally enforce.
It skirts the issue of naming ("the real problem is that I made the mistake of naming
timeout
,timeout
"), and yet it has a fairly obvious (and extensible!) interpretation.Exact syntax could be different, of course, but I like the general idea.
The text was updated successfully, but these errors were encountered: