Re: Who wore it better?

2016-04-25 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/16 6:40 AM, Nick Treleaven wrote: On Friday, 15 April 2016 at 18:46:01 UTC, Steven Schveighoffer wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) Might be nice if inout applied to template parameter types: T[] overlap(inout T)(T[] r1, T[] r2); If it wasn't for the virtual

Re: Who wore it better?

2016-04-24 Thread Nick Treleaven via Digitalmars-d
On Friday, 15 April 2016 at 18:46:01 UTC, Steven Schveighoffer wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) Might be nice if inout applied to template parameter types: T[] overlap(inout T)(T[] r1, T[] r2); If it wasn't for the virtual function issue, I wonder if inout would

Re: Who wore it better?

2016-04-18 Thread Kagamin via Digitalmars-d
On Friday, 15 April 2016 at 21:01:44 UTC, Andrei Alexandrescu wrote: Jesus. C++ has const without inout. We used to have const without inout - and we probably should again. -- Andrei What about immutability? E.g. Java gets away with immutable in a library and it just werks.

Re: Who wore it better?

2016-04-17 Thread Nick Treleaven via Digitalmars-d
On Friday, 15 April 2016 at 17:24:19 UTC, Andrei Alexandrescu wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted BTW, why is overlap undocumented - is ctfe support a good enough reason? https://github.com/dlang/phobos/blob/v2.071.0/std/array.d#L715 I've thought about

Re: Who wore it better?

2016-04-15 Thread Jonathan M Davis via Digitalmars-d
On Friday, April 15, 2016 13:46:24 Andrei Alexandrescu via Digitalmars-d wrote: > On 04/15/2016 01:31 PM, Namespace wrote: > > Since it is a template: Why these attributes: @trusted pure nothrow ? > > @trusted is not inferrable, the others are type-independent and nice for > the documentation. --

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 05:27 PM, Steven Schveighoffer wrote: On 4/15/16 5:01 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:45 PM, Steven Schveighoffer wrote: On 4/15/16 4:34 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:16 PM, Steven Schveighoffer wrote: If you find such advertisement useless,

Re: Who wore it better?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 5:01 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:45 PM, Steven Schveighoffer wrote: On 4/15/16 4:34 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:16 PM, Steven Schveighoffer wrote: If you find such advertisement useless, you of course do not need inout or const. Let's not

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
othrow if (is(typeof(r1.ptr < r2.ptr) == bool)) { import std.algorithm : min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); return b < e ? b[0 .. e - b] : null; } Who wore it better? inout(T)[] overlap(T)(inout(T)[] r1, i

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 04:45 PM, Steven Schveighoffer wrote: On 4/15/16 4:34 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:16 PM, Steven Schveighoffer wrote: If you find such advertisement useless, you of course do not need inout or const. Let's not exaggerate by putting them together. -- Andrei

Re: Who wore it better?

2016-04-15 Thread Marco Leise via Digitalmars-d
gt; if (is(typeof(r1.ptr < r2.ptr) == bool)) > >> { > >> import std.algorithm : min, max; > >> auto b = max(r1.ptr, r2.ptr); > >> auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); > >> return b < e ? b[0 .. e - b] : null; >

Re: Who wore it better?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 4:34 PM, Andrei Alexandrescu wrote: On 04/15/2016 04:16 PM, Steven Schveighoffer wrote: If you find such advertisement useless, you of course do not need inout or const. Let's not exaggerate by putting them together. -- Andrei This is not an exaggeration. inout and const have

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 04:16 PM, Steven Schveighoffer wrote: If you find such advertisement useless, you of course do not need inout or const. Let's not exaggerate by putting them together. -- Andrei

Re: Who wore it better?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 4:05 PM, Andrei Alexandrescu wrote: On 04/15/2016 03:13 PM, Steven Schveighoffer wrote: On 4/15/16 2:48 PM, Andrei Alexandrescu wrote: On 4/15/16 2:46 PM, Steven Schveighoffer wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow { import

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 03:13 PM, Steven Schveighoffer wrote: On 4/15/16 2:48 PM, Andrei Alexandrescu wrote: On 4/15/16 2:46 PM, Steven Schveighoffer wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow { import std.algorithm: min, max; auto b = max(r1.ptr, r2.ptr);

Re: Who wore it better?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
On 4/15/16 2:48 PM, Andrei Alexandrescu wrote: On 4/15/16 2:46 PM, Steven Schveighoffer wrote: inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow { import std.algorithm: min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr +

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
ll; } After: auto overlap(T, U)(T[] r1, U[] r2) @trusted pure nothrow if (is(typeof(r1.ptr < r2.ptr) == bool)) { import std.algorithm : min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); return b < e ? b[0 .. e - b] : null; } Who

Re: Who wore it better?

2016-04-15 Thread Steven Schveighoffer via Digitalmars-d
rusted pure nothrow if (is(typeof(r1.ptr < r2.ptr) == bool)) { import std.algorithm : min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); return b < e ? b[0 .. e - b] : null; } Who wore it better? inout(T)[] overlap(T)(ino

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
On 04/15/2016 01:31 PM, Namespace wrote: Since it is a template: Why these attributes: @trusted pure nothrow ? @trusted is not inferrable, the others are type-independent and nice for the documentation. -- Andrei

Re: Who wore it better?

2016-04-15 Thread Namespace via Digitalmars-d
Since it is a template: Why these attributes: @trusted pure nothrow ?

Re: Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
https://github.com/D-Programming-Language/phobos/pull/4201 -- Andrei

Who wore it better?

2016-04-15 Thread Andrei Alexandrescu via Digitalmars-d
== bool)) { import std.algorithm : min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); return b < e ? b[0 .. e - b] : null; } Who wore it better? Andrei