issue with completion for S4 objects

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Jan 25 12:09:38 GMT 2019


Hi,

On Tue, 22 Jan 2019 15:32:05 +0100
meik michalke <meik.michalke at uni-duesseldorf.de> wrote:
> > - You can configure some aspects of the object name completion, e.g.
> >   using "$" as list access operator.  
> 
> nice. IMO the old behavior should remain the default, because it's
> much more secure; the "$" operator does automatching of shortened
> element names (like with shortened function arguments), which can
> produce unexpected results. for instance:
> 
>  x <- list(yz=2)
>  x[["y"]]
> 
> returns NULL, whereas
> 
>  x$y
> 
> still returns 2.
> 
> i ran into this issue in one of my packages once and it was hell to
> find out what went wrong and why...

I had forgotten all about that. You're probably right about going back
to [[ by default, then.
 
> >   For the moment this is in the
> >   script editor, only, but I do plan to do the same for the console,
> >   after your feedback. Any other settings that would make sense to
> > you?  
> 
> personally, i'd generally prefer
> 
>  slot(x, "y")
> 
> over
> 
>  x at y
> 
> in my code.

Ok, should be no problem to add.
 
> > Should the completion in the console be changed to use the same
> > pop-up as in the script editor? In addition to / as a replacement
> > for the text-based tab-completion behavior?  
> 
> you mean for object names, not for tab completion in general, right?

Actually, both. But yes, it should retain the ability to complete file
names _and_ that should be added to the script editor as well.

> i'd find that helpful, because the current tab completion of object
> names has it's limits when there are several objects with similar
> names. i'm often unable	 to get it to complete to the next
> unambiguous character, it then simply repeats all available options,
> and it spoils the console history.

So, if I understand you right, you vote is for the pop-up solution,
replacing the "inline" solution. But you'd also like to get partial
completions when pressing Tab (*). Does that sum it up?

(*) Which is mostly broken, indeed. The code is smart enough to
understand that e.g. "qui" could match rkward::quit or base::quit, but
not smart enough to understand that "quit" would be the common base to
complete in any case... Of course that problem would also be less
pronounced in a popup-solution.

> what i'd find even more exciting is if tab completion would become
> possible for function arguments as well. there's currently only code
> hinting, but you still have to type all yourself, which for long
> options like "stringsAsFactors" is kind of annoying. if
> formals(data.frame) would be triggered by a tab inside data.frame(),
> couldn't autocompletion be offered here as well?

I'm currently trying to understand how that could be implemented.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20190125/9719530b/attachment.sig>


More information about the rkward-devel mailing list