I believe Concepts lite in C++ works around this by allowing a
syntax like this:
void foo(InputRange{T} range1, InputRange{T2} range2)
vs.
void foo(InputRange range1, InputRange range2)
If they are the same type.
I believe the objection is that the proposed syntax can't tell
the
differen
On Wed, May 07, 2014 at 08:09:34PM +, w0rp via Digitalmars-d wrote:
> On Wednesday, 7 May 2014 at 14:49:17 UTC, Orvid King via Digitalmars-d
> wrote:
> >On 5/7/14, w0rp via Digitalmars-d wrote:
> >>void foo(InputRange range);
> >
> >How to make it accept multiple types? Simple, we already have
On Wednesday, 7 May 2014 at 14:49:17 UTC, Orvid King via
Digitalmars-d wrote:
On 5/7/14, w0rp via Digitalmars-d
wrote:
void foo(InputRange range);
How to make it accept multiple types? Simple, we already have
template
constraints, so this would be how to do it, where T is the
element
type
Ahh, it seems this syntax is currently accepted by DMD. Should
it be?
Correction:
Ahh, it seems this syntax is currently *not* accepted by DMD.
Should
it be?
On Wednesday, 7 May 2014 at 16:04:39 UTC, Nordlöw wrote:
void foo(T)(InputRange!T range);
Update:
Ahh, it seems this syntax is currently accepted by DMD. Should
it be?
Original function:
import std.range: isInputRange;
bool allEqual(R)(R range) @safe pure nothrow if (isInputRange!R)
{
void foo(T)(InputRange!T range);
Update:
Ahh, it seems this syntax is currently accepted by DMD. Should it
be?
Original function:
import std.range: isInputRange;
bool allEqual(R)(R range) @safe pure nothrow if (isInputRange!R)
{
import std.algorithm: findAdjacent;
import std.range
void foo(T)(InputRange!T range);
Clever. Shouldn't we all, including Phobos, use this shorter
syntax instead?
Further, we could always do
alias R = InputRange!T;
or
alias R = typeof(range);
inside the body if needed.
On 5/7/14, w0rp via Digitalmars-d wrote:
> void foo(InputRange range);
How to make it accept multiple types? Simple, we already have template
constraints, so this would be how to do it, where T is the element
type of the input range:
void foo(T)(InputRange!T range);
On Wednesday, 7 May 2014 at 12:47:29 UTC, Sergei Nosov wrote:
void foo(InputRange range1, InputRange range2); // how to
specify that InputRange should be exactly the same type? or
possibly distinct types?
One thing to consider would be that InputRange wouldn't be a type
itself, but range1 and
Sergei Nosov:
void foo(InputRange range1, InputRange range2); // how to
specify that InputRange should be exactly the same type? or
possibly distinct types?
I think the Concepts lite proposal faces this problem too. Take a
look.
But so far Andrei was against the idea of having lite concept
On Wednesday, 7 May 2014 at 11:57:51 UTC, w0rp wrote:
Here is a question, is it possible for D, or any future
language, to eventually take something like this...
void foo(InputRange)(InputRange range)
if(isInputRange!InputRange);
...and to instead be able to write it like this?
void foo(Inp
On Wednesday, 7 May 2014 at 11:57:51 UTC, w0rp wrote:
Here is a question, is it possible for D, or any future
language, to eventually take something like this...
void foo(InputRange)(InputRange range)
if(isInputRange!InputRange);
...and to instead be able to write it like this?
void foo(Inp
On Wednesday, 7 May 2014 at 11:57:51 UTC, w0rp wrote:
Here is a question, is it possible for D, or any future
language, to eventually take something like this...
void foo(InputRange)(InputRange range)
if(isInputRange!InputRange);
...and to instead be able to write it like this?
void foo(Inp
Here is a question, is it possible for D, or any future language,
to eventually take something like this...
void foo(InputRange)(InputRange range)
if(isInputRange!InputRange);
...and to instead be able to write it like this?
void foo(InputRange range);
Where the latter expands into somethin
14 matches
Mail list logo