DIP 1030--Named Arguments--Community Review Round 1 Discussion

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 6 17:31:33 UTC 2020


On Thu, Feb 06, 2020 at 05:03:06PM +0000, Andrea Fontana via Digitalmars-d wrote:
> On Thursday, 6 February 2020 at 15:30:40 UTC, Steven Schveighoffer wrote:
> > On 2/6/20 4:39 AM, Andrea Fontana wrote:
> > Might be a good point to add UFCS discussion to the DIP.
[...]
> I wonder whether or not "(c: 3).doStuff(3,4);" could be useful...
> Probably it just adds some noise.

IMO it not only adds noise, it opens the door for expanding UFCS far
beyond its original charter. Because now, nothing stops you from doing
this:

	struct A {}
	struct B {}
	struct C {}

	auto fun(A a, B b, C c) { ... }

	A a;
	B b;
	C c;

	(a: a).fun(b: b, c: c);
	(b: b).fun(a: a, c: c);
	(c: c).fun(a: a, b: b);

IOW, you can now pull out any arbitrary parameter from any function and
do UFCS on it.  I honestly don't think this is a good idea, as it will
open up whole cans o' worms esp. once it starts interacting with IFTI.


T

-- 
We are in class, we are supposed to be learning, we have a teacher... Is it too much that I expect him to teach me??? -- RL


More information about the Digitalmars-d mailing list