Re: Should formattedWrite take the outputrange by ref?

2014-09-04 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 4 September 2014 at 17:06:00 UTC, Márcio Martins wrote: On Wednesday, 3 September 2014 at 07:43:20 UTC, Guillaume Chatelet wrote: +1 I've been bitten by this also. Same here, +1 It's still on my radar, but it's actually not that trivial of a change, especially if we want to avo

Re: Should formattedWrite take the outputrange by ref?

2014-09-04 Thread via Digitalmars-d-learn
On Wednesday, 3 September 2014 at 07:43:20 UTC, Guillaume Chatelet wrote: +1 I've been bitten by this also. Same here, +1

Re: Should formattedWrite take the outputrange by ref?

2014-09-03 Thread Guillaume Chatelet via Digitalmars-d-learn
+1 I've been bitten by this also.

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread monarch_dodra
On Sunday, 19 January 2014 at 15:28:04 UTC, Tobias Pankrath wrote: On Sunday, 19 January 2014 at 15:12:07 UTC, Tobias Pankrath wrote: On Sunday, 19 January 2014 at 15:03:13 UTC, monarch_dodra wrote: So, my conclusion, "*" might be a workable solution. But simply taking by ref would be cleaner

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread Tobias Pankrath
On Sunday, 19 January 2014 at 15:12:07 UTC, Tobias Pankrath wrote: On Sunday, 19 January 2014 at 15:03:13 UTC, monarch_dodra wrote: So, my conclusion, "*" might be a workable solution. But simply taking by ref would be cleaner, and make more sense as a whole. Or a special template constraint

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread monarch_dodra
On Saturday, 18 January 2014 at 23:06:42 UTC, Tobias Pankrath wrote: I actually didn't think that a ptr (to output range) would work. This way we can have best of both worlds and I'm happy with it. A fun fact is that since "." notation works with pointers, more often than not, if "T" verifies

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread Tobias Pankrath
On Sunday, 19 January 2014 at 15:03:13 UTC, monarch_dodra wrote: So, my conclusion, "*" might be a workable solution. But simply taking by ref would be cleaner, and make more sense as a whole. Or a special template constraint path for T*. foo(T)(T t) if (is(T = Q*)) && manyOtherChecks!(Q) foo

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread anonymous
On Saturday, 18 January 2014 at 21:55:54 UTC, Tobias Pankrath wrote: I want to print a tree structure and need to keep track of the indention for different parts of the tree. My idea was to write a generic wrapper for an output range that outputs tabs when it encounters a newline. This wrapper

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread Tobias Pankrath
On Saturday, 18 January 2014 at 22:58:59 UTC, bearophile wrote: monarch_dodra: *I* think it should. File a report, and I'll see what I can do about it. The problem with these kinds of things though might be breaking existing code... Given the frequency of bugs caused by such functions that

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread monarch_dodra
On Saturday, 18 January 2014 at 21:55:54 UTC, Tobias Pankrath wrote: I want to print a tree structure and need to keep track of the indention for different parts of the tree. My idea was to write a generic wrapper for an output range that outputs tabs when it encounters a newline. This wrapper

Re: Should formattedWrite take the outputrange by ref?

2014-01-19 Thread bearophile
monarch_dodra: *I* think it should. File a report, and I'll see what I can do about it. The problem with these kinds of things though might be breaking existing code... Given the frequency of bugs caused by such functions that require a pointer to the data, I think that a breaking change is

Should formattedWrite take the outputrange by ref?

2014-01-19 Thread Tobias Pankrath
I want to print a tree structure and need to keep track of the indention for different parts of the tree. My idea was to write a generic wrapper for an output range that outputs tabs when it encounters a newline. This wrapper has internal state and if I want to use formattedWrite with this wrap