Re: D UFCS anti-pattern

2014-04-25 Thread Andrej Mitrovic via Digitalmars-d
On 4/25/14, Steven Schveighoffer via Digitalmars-d digitalmars-d@puremagic.com wrote: Recently, I observed a conversation happening on the github pull request system. Another case of hijacking is the std.conv.text function. I've seen two people so far that have accidentally called the global

Re: D UFCS anti-pattern

2014-04-25 Thread Brian Schott via Digitalmars-d
On Friday, 25 April 2014 at 07:52:20 UTC, Andrej Mitrovic via Digitalmars-d wrote: Another case of hijacking is the std.conv.text function. I've seen two people so far that have accidentally called the global text function by mistake, e.g.: Make that three. The ability to call non-@property

Re: D UFCS anti-pattern

2014-04-25 Thread Steven Schveighoffer via Digitalmars-d
On Fri, 25 Apr 2014 00:58:51 -0400, Jonathan M Davis via Digitalmars-d digitalmars-d@puremagic.com wrote: If it doesn't work to override a free function with a member function, I honestly don't see much point to UFCS. The whole idea behind it is to make it so that you don't have to care

Re: D UFCS anti-pattern

2014-04-25 Thread Steven Schveighoffer via Digitalmars-d
On Fri, 25 Apr 2014 03:52:09 -0400, Andrej Mitrovic via Digitalmars-d digitalmars-d@puremagic.com wrote: On 4/25/14, Steven Schveighoffer via Digitalmars-d digitalmars-d@puremagic.com wrote: Recently, I observed a conversation happening on the github pull request system. Another case of

Re: D UFCS anti-pattern

2014-04-25 Thread monarch_dodra via Digitalmars-d
On Friday, 25 April 2014 at 12:21:04 UTC, Steven Schveighoffer wrote: I think this really comes down to a poorly named function. textOf, toText, textify even, are better names that wouldn't cause this problem. -Steve Well, in this case, yes, because it's a noun. For all functions that are

D UFCS anti-pattern

2014-04-24 Thread Steven Schveighoffer via Digitalmars-d
Recently, I observed a conversation happening on the github pull request system. In phobos, we have the notion of output ranges. One is allowed to output to an output range by calling the function 'put'. Here is the implementation of put: void put(R, E)(ref R r, E e) { static

Re: D UFCS anti-pattern

2014-04-24 Thread Jonathan M Davis via Digitalmars-d
On Thu, 24 Apr 2014 22:21:32 -0400 Steven Schveighoffer via Digitalmars-d digitalmars-d@puremagic.com wrote: Recently, I observed a conversation happening on the github pull request system. In phobos, we have the notion of output ranges. One is allowed to output to an output range by

Re: D UFCS anti-pattern

2014-04-24 Thread monarch_dodra via Digitalmars-d
On Friday, 25 April 2014 at 02:21:32 UTC, Steven Schveighoffer wrote: A relevant bug report (where I actually advocate for adding more of this horrible behavior): https://issues.dlang.org/show_bug.cgi?id=12583 -Steve See also: https://issues.dlang.org/show_bug.cgi?id=9074 Appender!string x;