statnet / statnet.common

Common R Scripts and Utilities Used by the Statnet Project Software
Other
8 stars 5 forks source link

Implement super-tab-completion. #14

Closed krivit closed 3 years ago

krivit commented 3 years ago

One valuable capability that was lost with implementation of #12---that list() can be used instead of control.*()---is tab completion for the arguments of the control.*() functions. This will be even worse if #13 is implemented.

The proposal is to work around this is as follows:

  1. Specify a function name, such as sctl() (for Statnet ConTroL).
  2. Every Statnet package will define and export a function named sctl() that takes all of the arguments of all of the control.*() functions defined in the package.
  3. Hopefully, the code editors will pool the argument lists from all of the packages that export the function, so that when the user types "sctl(", they'll get a list of everything any of the current functions will accept.

Any preferences and suggestions as to the function name?

krivit commented 3 years ago

On further thought, you're right, 5 is probably a bad idea, based on proviso 4.

My favourite ones are also 8 and 11. Overall, I like the "sn" prefix better than "s" or "st".

I am increasingly liking 11 ("sncl"). It has as many characters as "list", can be remembered as either "StatNet ControL" or "StatNet Control List", and when you touch-type it, it alternates hands. (On the other hand, the first four characters of "sctrl" are all typed with the left hand.)

martinamorris commented 3 years ago

sncl works -- though if you're looking for "controls", ctrl is still the obvious abbreviation. i'm happy with either.

drh20drh20 commented 3 years ago

I also like 8 and I also prefer "snX" to "sX". 3 and 11 and even 12 seem good as well, but 12 is short enough that it might create proviso 4 problems.

sgoodreau commented 3 years ago

I'm way late to the party, but I also like snX choices over sX. But basically, of the four options that seem to still be in plan (1,3,8,11) I'm fine with any. Will test functionality on my machine now.

sgoodreau commented 3 years ago

OK, the code in https://github.com/statnet/statnet.common/issues/14#issuecomment-778678558 works for me the way I think it's supposed to. That is, when I see the sctrl help page after loading ergm, it includes a set of parameters from pacakge ergm, and then when I load ergm.ego and check the help again, it includes new entries from ergm.ego. Very cool.

I'm not sure if you want me to also be testing the actual tab-completion funcitonality, and if so, what exact syntax that should follow. At one point I know the vision was to flatten the various control function arguments and make them available up at the top level, but I lost track of this thread of work after that, and that's not what this seems to do. Is that right?

But if I type ergm(control= and then tab it fills in control after the equals. And then if I hit tab again, I get the various control functions (control.ergm, control.san, etc). Then if I fill in control.ergm( and hit tab again, I get the arguments for control.ergm. Is that the desired functionality? And is that the preferred syntax?

Once again sorry I'm so late to the party!

krivit commented 3 years ago

@sgoodreau , no worries. The way to test the functionality is to load the package, then type ergm(control=sctrl( and you should see the completion list. (The "sctrl" is subject to change to one of the above options.)

mbojan commented 3 years ago

I like ctrl suffix. So sctrl and snctrl are my favorites.

sgoodreau commented 3 years ago

Works beautifully Very elegant.

krivit commented 3 years ago

I'd suggest having all the "finalists" allowed, but it's not as simple as just assigning

sctrl <- sncontrol <- snctrl <- scnl <- function(...)

since it's not clear whether and how the changes to one will propagate to the others.

I think my favourite one is still sncl: it's shorter, and it's faster and much less typo prone than sctrl or snctrl. (Notice that when touch-typing sctrl on a QWERTY keyboard, three characters in a row ("ctr") are typed by the left index finger, none of them on the home row.) I also like that it has an alternative StatNet Control List mnemonic device.

krivit commented 3 years ago

Another candidate is snlist(), which has the appeal that the function actually does work like list(), it just has "weird" default arguments.

@mbojan , @martinamorris , @sgoodreau , @drh20drh20 , @chad-klumb , @CarterButts , @handcock, apologies for asking you all to comment again, but I want to get some finality. In the next day or two, can you please reply, ranking (from most to least preferred) our "finalists":

(I am adding snlist into the finalists since no one but me has had a chance to "second" it.) I'll see if there is a Condorcet winner.

mbojan commented 3 years ago

That's actually a good case for approval voting :)

niedz., 21 lut 2021, 23:29 użytkownik Pavel N. Krivitsky < notifications@github.com> napisał:

Another candidate is snlist(), which has the appeal that the function actually does work like list(), it just has "weird" default arguments.

@mbojan https://github.com/mbojan , @martinamorris https://github.com/martinamorris , @sgoodreau https://github.com/sgoodreau , @drh20drh20 https://github.com/drh20drh20 , @chad-klumb https://github.com/chad-klumb , @CarterButts https://github.com/CarterButts , @handcock https://github.com/handcock, apologies for asking you all to comment again, but I want to get some finality. In the next day or two, can you please reply, ranking (from most to least preferred) our "finalists":

  • snctrl
  • sctrl
  • sncl
  • sncontrol
  • snlist

(I am adding snlist into the finalists since no one but me has had a chance to "second" it.) I'll see if there is a Condorcet winner.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/statnet/statnet.common/issues/14#issuecomment-782939377, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE3NHVMHFKDNTPE5W6W3VLTAGCODANCNFSM4VO6PXOA .

krivit commented 3 years ago

That's actually a good case for approval voting :)

If you want to cast an approval vote, just give one set of names a rank of 1 and the others a rank of 2.

sgoodreau commented 3 years ago

I approve of any, so consider my approval vote to include all five. If we're ranking then:

  1. snctrl
  2. sctrl
  3. sncl
  4. sncontrol ? snlist

The order is determined by the fact that "ctrl" is the familar default abbreviation for control, as per keyboards.

I have snlist as a question mark because it's a last minute candidate and I don't fully get the implications in terms of your comment about weird defaults, and how that balances the plusses and minuses as a result.

mbojan commented 3 years ago

I vote for sctrl() and snctrl().

martinamorris commented 3 years ago

I'm with @mbojan

If you really wanted an acronym for "statnet control list" then "sclist" would have been my suggestion. But I still prefer the "ctrl" moniker: function over form.

chad-klumb commented 3 years ago

I don't have a preference.

drh20drh20 commented 3 years ago

No strong preference but since you asked: snctrl > sncontrol > snlist > sctrl > sncl

krivit commented 3 years ago

Looks like snctrl is preferred by the majority of each of the other other options, I will edit and merge.

krivit commented 3 years ago

tergm and ergm.multi also plugged in. I think that's all of them for now.