Re: So what does (inout int = 0) do?

2016-05-02 Thread Steven Schveighoffer via Digitalmars-d
On 5/1/16 7:58 PM, Seb wrote: On Friday, 15 April 2016 at 23:05:14 UTC, Steven Schveighoffer wrote: On 4/15/16 6:31 PM, Timon Gehr wrote: [...] I'm sorry, should have put on my standard disclaimer that I am not a compiler writer :) I actually have no idea how this is done in the compiler, jus

Re: So what does (inout int = 0) do?

2016-05-01 Thread Seb via Digitalmars-d
On Friday, 15 April 2016 at 23:05:14 UTC, Steven Schveighoffer wrote: On 4/15/16 6:31 PM, Timon Gehr wrote: [...] I'm sorry, should have put on my standard disclaimer that I am not a compiler writer :) I actually have no idea how this is done in the compiler, just how a compiler should behav

Re: So what does (inout int = 0) do?

2016-04-19 Thread Kagamin via Digitalmars-d
On Monday, 18 April 2016 at 00:53:26 UTC, Temtaime wrote: shared currently is useless too tbw shared did catch bugs in phobos and user code, that would otherwise sneak in.

Re: So what does (inout int = 0) do?

2016-04-19 Thread Kagamin via Digitalmars-d
On Sunday, 17 April 2016 at 17:39:48 UTC, QAston wrote: First @property + compiler switch, now @property + deprecated switch. When should I use property? For all the getters? Should I start with property or with member access? Does it even matter because of optional parens? Why do I even need t

Re: So what does (inout int = 0) do?

2016-04-18 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 18 April 2016 at 08:53:31 UTC, Guillaume Piolat wrote: And shared and @property :) I still want to see @property fixed rather than removed - the edge case with returning a delegate is an interesting one to me (though that's ALL I want it to do, leave everything else alone)

Re: So what does (inout int = 0) do?

2016-04-18 Thread Marc Schütz via Digitalmars-d
On Saturday, 16 April 2016 at 11:49:21 UTC, Nick Treleaven wrote: On 16/04/2016 12:40, Marc Schütz wrote: What are the plans for DIP25's `return` attribute? Because with it, the compiler has enough information to know that the return value aliases `s`: const(T)[] replaceSlice(T)(const(T)[] s

Re: So what does (inout int = 0) do?

2016-04-18 Thread Guillaume Piolat via Digitalmars-d
On Monday, 18 April 2016 at 08:52:19 UTC, Guillaume Piolat wrote: Personnally I wish synchronized, comma operator, and actively harmful things would go. nothrow provides little value, but no negative value. And shared and @property :) But I guess this isn't Christmas already.

Re: So what does (inout int = 0) do?

2016-04-18 Thread Guillaume Piolat via Digitalmars-d
On Sunday, 17 April 2016 at 23:03:26 UTC, Adam D. Ruppe wrote: On Sunday, 17 April 2016 at 21:20:49 UTC, Timon Gehr wrote: On 17.04.2016 18:44, Nick Treleaven wrote: I think @property is OK. No, it isn't: Seriously, @property is one of the biggest SNAFUs of the language. I think I'll wr

Re: So what does (inout int = 0) do?

2016-04-17 Thread deadalnix via Digitalmars-d
On Sunday, 17 April 2016 at 23:03:26 UTC, Adam D. Ruppe wrote: On Sunday, 17 April 2016 at 21:20:49 UTC, Timon Gehr wrote: On 17.04.2016 18:44, Nick Treleaven wrote: I think @property is OK. No, it isn't: Seriously, @property is one of the biggest SNAFUs of the language. Today I learn

Re: So what does (inout int = 0) do?

2016-04-17 Thread Temtaime via Digitalmars-d
On Sunday, 17 April 2016 at 23:03:26 UTC, Adam D. Ruppe wrote: On Sunday, 17 April 2016 at 21:20:49 UTC, Timon Gehr wrote: On 17.04.2016 18:44, Nick Treleaven wrote: I think @property is OK. No, it isn't: Seriously, @property is one of the biggest SNAFUs of the language. I think I'll wr

Re: So what does (inout int = 0) do?

2016-04-17 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 17 April 2016 at 21:20:49 UTC, Timon Gehr wrote: On 17.04.2016 18:44, Nick Treleaven wrote: I think @property is OK. No, it isn't: Seriously, @property is one of the biggest SNAFUs of the language. I think I'll write an editorial about this stuff in TWID tonight. (I'm also very

Re: So what does (inout int = 0) do?

2016-04-17 Thread Timon Gehr via Digitalmars-d
On 17.04.2016 18:44, Nick Treleaven wrote: I think @property is OK. No, it isn't: import std.stdio; struct S{ @property int delegate() foo(){ return ()=>3; } } void main(){ S s; writeln(s.foo()); // "int delegate()" }

Re: So what does (inout int = 0) do?

2016-04-17 Thread ag0aep6g via Digitalmars-d
On 17.04.2016 19:39, QAston wrote: First @property + compiler switch, now @property + deprecated switch. When should I use property? For all the getters? Should I start with property or with member access? Does it even matter because of optional parens? Why do I even need to care about this? @p

Re: So what does (inout int = 0) do?

2016-04-17 Thread QAston via Digitalmars-d
On Sunday, 17 April 2016 at 16:44:50 UTC, Nick Treleaven wrote: The @safe troika is a good design (except @safe should be the default), the implementation is lacking though. Ideallists want to make @safe strict now, but break code sometimes even without basic workarounds for memory-safe code. P

Re: So what does (inout int = 0) do?

2016-04-17 Thread Nick Treleaven via Digitalmars-d
On Sunday, 17 April 2016 at 14:30:59 UTC, QAston wrote: You've got lucky with pure (modulo corner cases) and ctfe, much less lucky with @safe, @trusted, @system, inout, shared, scope, property. The @safe troika is a good design (except @safe should be the default), the implementation is lacki

Re: So what does (inout int = 0) do?

2016-04-17 Thread QAston via Digitalmars-d
On Friday, 15 April 2016 at 20:03:07 UTC, Andrei Alexandrescu wrote: We should really do away with the cowboy style of designing language, which sadly Walter and I have been guilty of too often in the past. The slow but sure accretion of complexity of inout is a textbook example of where that l

Re: So what does (inout int = 0) do?

2016-04-16 Thread Lass Safin via Digitalmars-d
On Saturday, 16 April 2016 at 22:06:10 UTC, Marco Leise wrote: Am Fri, 15 Apr 2016 09:44:05 -0400 schrieb Andrei Alexandrescu : inout must go. -- Andrei Ceterum censeo Carthaginem esse delendam. -- Marcus Porcius Cato :o) What does that have to do with what he said? Are you comparing him to C

Re: So what does (inout int = 0) do?

2016-04-16 Thread Marco Leise via Digitalmars-d
Am Fri, 15 Apr 2016 09:44:05 -0400 schrieb Andrei Alexandrescu : inout must go. -- Andrei Ceterum censeo Carthaginem esse delendam. -- Marcus Porcius Cato :o) -- Marco

Re: So what does (inout int = 0) do?

2016-04-16 Thread Nick Treleaven via Digitalmars-d
On 16/04/2016 12:40, Marc Schütz wrote: What are the plans for DIP25's `return` attribute? Because with it, the compiler has enough information to know that the return value aliases `s`: const(T)[] replaceSlice(T)(const(T)[] s return, in T[] slice, in T[] replacement); If the function is passed

Re: So what does (inout int = 0) do?

2016-04-16 Thread Marc Schütz via Digitalmars-d
(It seems my reply got lost somewhere, reposting...) On Friday, 15 April 2016 at 19:28:02 UTC, Andrei Alexandrescu wrote: A better support for this argument is std.array.replaceSlice at https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L2594: inout(T)[] replaceSlice(T)(

Re: So what does (inout int = 0) do?

2016-04-16 Thread Jacob Carlborg via Digitalmars-d
On 2016-04-15 07:38, Andrei Alexandrescu wrote: I think we should deprecate inout. For real. It costs way too much for what it does. For all I can tell most of D's proponents don't know how it works. -- Andrei If "inout" is only used as a way avoid code duplication, both when writing the code

Re: So what does (inout int = 0) do?

2016-04-16 Thread Nick Treleaven via Digitalmars-d
On 15/04/2016 04:10, Andrei Alexandrescu wrote: Commenting it out yields a number of unittest compilation errors, neither informative about the root of the problem and indicative as to how the parameter solves it. ... 2. There needs to be documentation for people working on the standard library

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 6:31 PM, Timon Gehr wrote: On 15.04.2016 23:56, Steven Schveighoffer wrote: Impossible or difficult to do with the current implementation? ... What I'm saying is that the check that is currently implemented is not adequate for the new case. This is not terribly important though. Th

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 23:56, Steven Schveighoffer wrote: On 4/15/16 5:17 PM, Timon Gehr wrote: On 15.04.2016 22:47, Steven Schveighoffer wrote: There's no difference between a function that declares its variables inout within its parameters or one that declares them locally. ... Yes, there is. Seman

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 5:17 PM, Timon Gehr wrote: On 15.04.2016 22:47, Steven Schveighoffer wrote: There's no difference between a function that declares its variables inout within its parameters or one that declares them locally. ... Yes, there is. Semantic analysis sees the parameter types before it se

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 23:03, Andrei Alexandrescu wrote: On 04/15/2016 04:47 PM, Steven Schveighoffer wrote: There's no difference between a function that declares its variables inout within its parameters or one that declares them locally. So now we get to things like: void fun() { inout int ohHel

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 05:17 PM, Timon Gehr wrote: Well, that is precisely the way that languages with real type systems address issues like this one. D has many others like it. Note that for type systems, complexity and expressiveness do not necessarily correlate. Nicely put on both counts. (Well "rea

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 22:47, Steven Schveighoffer wrote: On 4/15/16 4:27 PM, Timon Gehr wrote: On 15.04.2016 22:03, Steven Schveighoffer wrote: On 4/15/16 3:48 PM, Timon Gehr wrote: On 15.04.2016 17:22, Steven Schveighoffer wrote: On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://gi

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 04:47 PM, Steven Schveighoffer wrote: There's no difference between a function that declares its variables inout within its parameters or one that declares them locally. So now we get to things like: void fun() { inout int ohHello = 42; ... } How to explain such a construct?

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 4:27 PM, Timon Gehr wrote: On 15.04.2016 22:03, Steven Schveighoffer wrote: On 4/15/16 3:48 PM, Timon Gehr wrote: On 15.04.2016 17:22, Steven Schveighoffer wrote: On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 22:03, Steven Schveighoffer wrote: On 4/15/16 3:48 PM, Timon Gehr wrote: On 15.04.2016 17:22, Steven Schveighoffer wrote: On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 It wo

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 4:08 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:03 PM, Steven Schveighoffer wrote: I have a way to make this work. This is actually the most major sticking point in inout. The only correct thing is to keep is that globals/static variables cannot be typed inout. Another special

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 4:03 PM, Andrei Alexandrescu wrote: On 04/15/2016 03:44 PM, Steven Schveighoffer wrote: I assure you, these limitations were self-imposed. I insisted on them, without realizing that they would cause problems with generic code. I thought they would be good "lint" detection. https://i

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 04:03 PM, Steven Schveighoffer wrote: I have a way to make this work. This is actually the most major sticking point in inout. The only correct thing is to keep is that globals/static variables cannot be typed inout. Another special case? The only correct thing is to simplify the

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 3:48 PM, Timon Gehr wrote: On 15.04.2016 17:22, Steven Schveighoffer wrote: On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 It works around a limitation of inout that isn't necessa

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 03:44 PM, Steven Schveighoffer wrote: No, because it's not sound. you cannot cast to const through 2+ indirections. However inout works there. That is correct, a classic... thanks for getting me straight. I think the point of Kenji's argument is that inout's current limitations

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 17:22, Steven Schveighoffer wrote: On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 It works around a limitation of inout that isn't necessary (even though I thought it was being h

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 3:28 PM, Andrei Alexandrescu wrote: On 4/15/16 2:39 PM, Steven Schveighoffer wrote: On 4/15/16 1:11 PM, Andrei Alexandrescu wrote: Would it be difficult to make it work without inout? T[] dup(T)(T[] arr) this should be doable. Problem is, you get identical instantiations for each

Re: So what does (inout int = 0) do?

2016-04-15 Thread Dmitry Olshansky via Digitalmars-d
On 15-Apr-2016 08:38, Andrei Alexandrescu wrote: On 04/15/2016 12:23 AM, Jonathan M Davis via Digitalmars-d wrote: On Thursday, April 14, 2016 23:10:12 Andrei Alexandrescu via Digitalmars-d wrote: [snip] - Jonathan M Davis I think we should deprecate inout. For real. It costs way too much f

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 4/15/16 2:39 PM, Steven Schveighoffer wrote: On 4/15/16 1:11 PM, Andrei Alexandrescu wrote: On 04/15/2016 12:19 PM, Kenji Hara via Digitalmars-d wrote: Didn't you use array.dup until now? It's a good example to handle qualifiers with inout. Would it be difficult to make it work without in

Re: So what does (inout int = 0) do?

2016-04-15 Thread deadalnix via Digitalmars-d
On Friday, 15 April 2016 at 12:54:11 UTC, ixid wrote: On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: We want Phobos to be beautiful, a prime example of good D code. Admittedly, it also needs to be very general and efficient, which sometimes gets in the way. But we cannot

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 1:11 PM, Andrei Alexandrescu wrote: On 04/15/2016 12:19 PM, Kenji Hara via Digitalmars-d wrote: Didn't you use array.dup until now? It's a good example to handle qualifiers with inout. Would it be difficult to make it work without inout? T[] dup(T)(T[] arr) this should be doable

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 02:24 PM, jmh530 wrote: I had not realized that the main reason that inout was added was because of not being able to use templates as virtual functions in classes. The main reason is actually avoiding code duplication is such situations (i.e. the problem has a solution just not

Re: So what does (inout int = 0) do?

2016-04-15 Thread jmh530 via Digitalmars-d
On Friday, 15 April 2016 at 17:11:39 UTC, Andrei Alexandrescu wrote: 3. For all problems that inout is purported to solve, I know of idioms that are definitely simpler and overall almost as good if not better. So a hard question is whether the existence is justified. If it's something to be

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 12:19 PM, Kenji Hara via Digitalmars-d wrote: Didn't you use array.dup until now? It's a good example to handle qualifiers with inout. Would it be difficult to make it work without inout? It's not sensible at all, inout is already well-defined and has much power in D's type sys

Re: So what does (inout int = 0) do?

2016-04-15 Thread Kenji Hara via Digitalmars-d
2016-04-15 22:41 GMT+09:00 Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com>: > On 04/15/2016 06:50 AM, Kenji Hara via Digitalmars-d wrote: > >> >> >> You should recall the history of inout. >> http://wiki.dlang.org/DIP2 >> >> At first, It has designed to temporarily squash muta

Re: So what does (inout int = 0) do?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/14/16 11:10 PM, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 It works around a limitation of inout that isn't necessary (even though I thought it was being helpful when I suggested it). That is, functions w

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 02:15 AM, Vladimir Panteleev wrote: On Friday, 15 April 2016 at 05:38:56 UTC, Andrei Alexandrescu wrote: I think we should deprecate inout. For real. It costs way too much for what it does. For all I can tell most of D's proponents don't know how it works. -- Andrei What would re

Re: So what does (inout int = 0) do?

2016-04-15 Thread Guillaume Piolat via Digitalmars-d
On Friday, 15 April 2016 at 12:54:11 UTC, ixid wrote: Why didn't we go with all functions being able to infer const, pure etc rather than just templates? Non-templated function may not have their source code available. For consistency, non-template function have no inference.

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 02:40 AM, Shammah Chancellor wrote: I think that behavioral type checks are common enough in D that it should have it's own first-class syntax. No. -- Andrei

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 02:49 AM, Walter Bright wrote: On 4/14/2016 8:10 PM, Andrei Alexandrescu wrote: Commenting it out yields a number of unittest compilation errors, neither informative about the root of the problem and indicative as to how the parameter solves it. https://issues.dlang.org/show_bug.

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 03:42 AM, deadalnix wrote: On Friday, 15 April 2016 at 04:23:29 UTC, Jonathan M Davis wrote: IIRC, the problem has to do with ranges of inout elements working correctly, which gets really funky, because inout is a temporary thing and not a full-on type constructor/qualifier. I beli

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 06:50 AM, Kenji Hara via Digitalmars-d wrote: You should recall the history of inout. http://wiki.dlang.org/DIP2 At first, It has designed to temporarily squash mutable/const/immutable qualifiers on function argument inside function body. Therefore when inout qualifier appears in

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 05:07 AM, Timon Gehr wrote: The fundamental problem is that inout is disallows certain kinds of composition. It's a flawed language primitive. I agree. The more I try things with it the more awfully complex and useless it is. inout must go. -- Andrei

Re: So what does (inout int = 0) do?

2016-04-15 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 15 April 2016 at 09:07:27 UTC, Timon Gehr wrote: Related: Phobos should never use is(typeof(...)). Contrary to popular belief, is(typeof(...)) is not the same as __traits(compiles,...). I don't think it should be using __traits(compiles) either. I'd prefer to see built from the ot

Re: So what does (inout int = 0) do?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 4/15/16 8:59 AM, Nick Treleaven wrote: On Friday, 15 April 2016 at 04:23:29 UTC, Jonathan M Davis wrote: Certainly, there have been a few times that it's come up in D.Learn when folks ask what the heck it is, so there should be a few posts floating around with an explanation. This is the only

Re: So what does (inout int = 0) do?

2016-04-15 Thread Nick Treleaven via Digitalmars-d
On Friday, 15 April 2016 at 04:23:29 UTC, Jonathan M Davis wrote: Certainly, there have been a few times that it's come up in D.Learn when folks ask what the heck it is, so there should be a few posts floating around with an explanation. This is the only useful post that I could find in a quick

Re: So what does (inout int = 0) do?

2016-04-15 Thread QAston via Digitalmars-d
On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 There is no explanation to it in the source code, and the line blames to https://github.com/D-Programming-Language/phobos/pul

Re: So what does (inout int = 0) do?

2016-04-15 Thread ixid via Digitalmars-d
On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: We want Phobos to be beautiful, a prime example of good D code. Admittedly, it also needs to be very general and efficient, which sometimes gets in the way. But we cannot afford an accumulation of mad tricks to obscure the lar

Re: So what does (inout int = 0) do?

2016-04-15 Thread Kenji Hara via Digitalmars-d
2016-04-15 14:38 GMT+09:00 Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com>: > On 04/15/2016 12:23 AM, Jonathan M Davis via Digitalmars-d wrote: > >> On Thursday, April 14, 2016 23:10:12 Andrei Alexandrescu via Digitalmars-d >> wrote: >> >>> Consider: >>> >>> >>> https://github

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 11:07, Timon Gehr wrote: ... Most of Phobos code assumes that ranges be struct fields. Most of Phobos assumes that ranges can be The fundamental problem is that inout is disallows certain kinds of composition. ... inout disallows

Re: So what does (inout int = 0) do?

2016-04-15 Thread Timon Gehr via Digitalmars-d
On 15.04.2016 05:10, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 ... Related: Phobos should never use is(typeof(...)). Contrary to popular belief, is(typeof(...)) is not the same as __traits(compiles,...). vo

Re: So what does (inout int = 0) do?

2016-04-15 Thread Guillaume Piolat via Digitalmars-d
On Friday, 15 April 2016 at 05:38:56 UTC, Andrei Alexandrescu wrote: I think we should deprecate inout. For real. It costs way too much for what it does. For all I can tell most of D's proponents don't know how it works. -- Andrei This is the explanation I came up with, not sure if accurate.

Re: So what does (inout int = 0) do?

2016-04-15 Thread deadalnix via Digitalmars-d
On Friday, 15 April 2016 at 04:23:29 UTC, Jonathan M Davis wrote: IIRC, the problem has to do with ranges of inout elements working correctly, which gets really funky, because inout is a temporary thing and not a full-on type constructor/qualifier. I believe that Kenji is the one that implement

Re: So what does (inout int = 0) do?

2016-04-15 Thread w0rp via Digitalmars-d
On Friday, 15 April 2016 at 07:33:42 UTC, w0rp wrote: I think it has something to do with making the function, in this case a lambda, inout, so that it can accept inout types. Then the typeof bit is a weird way to writing something like __traits(compiles, ...) , because functions which have no

Re: So what does (inout int = 0) do?

2016-04-15 Thread w0rp via Digitalmars-d
I think it has something to do with making the function, in this case a lambda, inout, so that it can accept inout types. Then the typeof bit is a weird way to writing something like __traits(compiles, ...) , because functions which have no type result in void, and that fails the typeof check.

Re: So what does (inout int = 0) do?

2016-04-14 Thread Walter Bright via Digitalmars-d
On 4/14/2016 8:10 PM, Andrei Alexandrescu wrote: Commenting it out yields a number of unittest compilation errors, neither informative about the root of the problem and indicative as to how the parameter solves it. https://issues.dlang.org/show_bug.cgi?id=15926

Re: So what does (inout int = 0) do?

2016-04-14 Thread Shammah Chancellor via Digitalmars-d
On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 There is no explanation to it in the source code, and the line blames to https://github.com/D-Programming-Language/phobos/pul

Re: So what does (inout int = 0) do?

2016-04-14 Thread Vladimir Panteleev via Digitalmars-d
On Friday, 15 April 2016 at 05:38:56 UTC, Andrei Alexandrescu wrote: I think we should deprecate inout. For real. It costs way too much for what it does. For all I can tell most of D's proponents don't know how it works. -- Andrei What would replace it in the case of classes, where you can't

Re: So what does (inout int = 0) do?

2016-04-14 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 12:23 AM, Jonathan M Davis via Digitalmars-d wrote: On Thursday, April 14, 2016 23:10:12 Andrei Alexandrescu via Digitalmars-d wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primi tives.d#L152 There is no explanation to it in the source co

Re: So what does (inout int = 0) do?

2016-04-14 Thread Jonathan M Davis via Digitalmars-d
On Thursday, April 14, 2016 23:10:12 Andrei Alexandrescu via Digitalmars-d wrote: > Consider: > > https://github.com/D-Programming-Language/phobos/blob/master/std/range/primi > tives.d#L152 > > There is no explanation to it in the source code, and the line blames to > https://github.com/D-Programm

Re: So what does (inout int = 0) do?

2016-04-14 Thread Vladimir Panteleev via Digitalmars-d
On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: Consider: https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152 There is no explanation to it in the source code, and the line blames to https://github.com/D-Programming-Language/phobos/pul