laurent.orseau
2021-1-2 10:10:06

I also constantly forget keybindings (and things in general) that I don’t use often enough, but at least with quickscript it’s easy to find out a keybinding by checking in the Script menu.


laurent.orseau
2021-1-2 10:13:15

Also, I personally find the blue boxes behaviour of following the cursor annoying because I often want to keep the signature of one function as I write the arguments, but then it switches to other things as I type. @notjack I’d need more info on what you’d like, to see if I can do something about it


notjack
2021-1-2 11:54:24

I pretty just want exactly what IntelliJ does.


laurent.orseau
2021-1-2 11:56:15

this appears at the point you type ., is that right?


notjack
2021-1-2 11:56:20

Yup


notjack
2021-1-2 11:56:44

Once I start typing the arguments, it (sometimes?) creates a second popup above what I’m writing to help me keep track of where I am in the argument list without preventing me from using autocompletion for constructing each argument expression.


laurent.orseau
2021-1-2 11:59:25

Ah, what you firstly want is to be reminded about where you are in the arg list? If I (manage to) modify the def-signature quickscript to write in bold the current argument, would that be better?


notjack
2021-1-2 12:01:13

Bolding the current argument is definitely a good idea IMO


notjack
2021-1-2 12:01:27

I’m trying to capture a screen recording of what intellij does as I type that expression


spdegabrielle
2021-1-2 12:03:46

Excel bonding the current argument


notjack
2021-1-2 12:04:06

Clever, it seems to know to only show the popup with the list of argument names for method calls where I pause to think after typing the method name but before I start typing the arguments.


notjack
2021-1-2 12:04:25

notjack
2021-1-2 12:06:58

Notice that it doesn’t change from showing the new Plan<>() constructor’s signature to the add() method’s signature while I’m typing nextAction, or to the perform() method’s signature while I’m typing predicatedState. It only changes if I pause for a second before typing the arguments.


notjack
2021-1-2 12:07:22

Which makes sense. Because if I’m pausing, it means I’m not sure what comes next :p


notjack
2021-1-2 12:11:54

Oh also, I’m just pressing tab to get the autocompletion to fill in what it thinks comes next.


laurent.orseau
2021-1-2 13:26:43

Ok thanks. Quickscript doesn’t receive keystroke events, so it might be better to modify the drcomplete plugin, or I’ll need to modify Quickscript to trigger scripts on keypresses too


spdegabrielle
2021-1-2 13:37:45

+1 adding keypress triggers to quickscript


rokitna
2021-1-2 15:19:35

changing the keywords of keyword arguments already breaks callers, right?


rokitna
2021-1-2 15:40:13

It looks like both foldl and foldr in Racket pass the accumulated state as the second argument, matching cons.

Personally, in order to visualize what’s going on in the list, I like for foldl’s accumulator to take (accumulated-state, element) since the accumulation is approaching from the beginning of the elements. Likewise, I prefer for foldr’s accumulator to take the state as the last argument since the accumulation is approaching from the end. But I’m not too concerned about whether I can pass something like cons directly to either one. I always pass a lambda expression, which I prefer because it gives me a place to set a breakpoint and because it makes it very clear how many optional arguments I’m making use of in that location.


notjack
2021-1-3 03:04:53

Yes, which is why choosing whether an argument should be a keyword argument or a positional argument is a trade-off based on how important you think the argument name is to callers. I don’t want every single argument name to be part of my exposed API surface, just the ones that are important.


rokitna
2021-1-3 05:01:27

Oh yeah, I guess “even when the function is not designed with keywords in mind” tends to be a bad idea, since a detail that wasn’t explicitly designed for may be subject to change when the designer finally gets around to giving it some attention.

In my head, I automatically understood the idea as “add a new kind of argument that can be passed in both positional and keyword-based ways.” Library authors who don’t want to expose arguments this way don’t have to.

In context of this kind of feature, there may be a subcommunity norm to design APIs so that every argument can be keyword-specified. In the worst case, this norm may lead library authors to overcommit with their name choices and end up with libraries they regret. But if library authors pay enough attention up front, they can encode their indecision about an argument’s name by using a positional-only argument. Then they can upgrade it to allow keyword use in a future release once they’ve made a decision.