Whence came UFCS?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Jul 27 10:30:07 UTC 2018


On Friday, July 27, 2018 03:41:29 Sameer Pradhan via Digitalmars-d wrote:
> In the end I thought I might as well dump my thoughts on the D
> forum and hear straight from the horse's (or horses')
> mouth(s)---so to speak.

It evolved out of D's member function call syntax for arrays - basically,
for years before we had UFCS in D, we had UFCS for arrays. However, when and
how that was added to arrays, I don't know. I don't recall it ever not being
in the language, but I never used D1, and I don't know if it had it. At
minimum, it's been in D since early D2, if not much earlier. I'd have to do
a lot of spelunking through old releases to figure out when it was added.

Certainly, the origins of UFCS in D do not come from making it possible to
extend user-defined types with member functions. It comes from wanting
member function call syntax when using arrays (probably aimed primarily at
strings, but I don't know). It's just that later it was proposed to extend
it so that it would work with any type and thus make the member function
call syntax universal.

- Jonathan M Davis



More information about the Digitalmars-d mailing list