UFCS vs auto-completion support

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 9 08:00:51 PST 2016


On Saturday, 9 January 2016 at 15:50:33 UTC, Jay Norwood wrote:
> I'm reading Jack Stouffer's documentation:
> http://jackstouffer.com/blog/nd_slice.html
>
> considering the UFCS example below and how it would impact 
> auto-completion support.
>
> auto slice = sliced(iota(1000), 5, 5, 40);
>
> auto slice = 1000.iota.sliced(5, 5, 40);
>
> Seems like auto-complete support for the second form would be 
> complicated.  Do any of the auto-completion implementations 
> even attempt to support that second form?

I may be very naive but how is the second form more complicated 
than the first? To me when typing "sliceā€¦" the autocomplete 
engine has to choose from all structures, classes, basic types, 
functions and keywords accessible from the top namespace but also 
all types and functions defined in the local namespace.

In the ".slice" case it only has to choose from struct/classe 
methods if it's called on a defined type and all functions in top 
namespace.

It seems way easier to me although you first have to identify the 
return type of the previous element to be accurate.


More information about the Digitalmars-d-learn mailing list