On Tuesday, 22 November 2016 at 16:05:35 UTC, Satoshi wrote:
Sorry, but D seems to be worse and worse day by day. This
should be resolved by language and not doing it by template
function.
Same thing should be applied for maybe monad and tuples.
I'm reminded of trying to follow the rules
On Tuesday, 22 November 2016 at 22:03:14 UTC, Satoshi wrote:
or I have simple class
class View {
this(Rectangle frame) {...}
this(float, float, float, float) { ... }
this(Point, Size) { ... }
}
then struct Point, Size and Rectangle (Point, Size)
now I need to write 2 overloads for View class
cast(const) x[];
cast(immutable) x[];
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
mixin template RvalueRef()// <-- DOES NOT TAKE A PARAMETER
ANY MORE
{
alias T = typeof(this);
static assert (is(T == struct));
@nogc @safe
ref const(T) byRef() const pure nothrow return
Why do you need to
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
Let me know if it's not the equivalent of the original.
Ali
Nice. What about putting this in a druntime or phobos PR, making
it standardized?
On Tuesday, 22 November 2016 at 13:29:47 UTC, RazvanN wrote:
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it
prints false and I noticed that if
Is there a way to get a template function return type with
instantiating it? The return type is independent of the template
arguments.
I'm asking because there's potentially recursive template
instantiation if I do try to instantiate it.
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it
prints false and I noticed that if Range is char[], wchar[],
dchar[], string, wstring, dstring
On Tuesday, 22 November 2016 at 13:06:27 UTC, Nordlöw wrote:
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
mixin template RvalueRef()// <-- DOES NOT TAKE A PARAMETER
ANY MORE
{
alias T = typeof(this);
static assert (is(T == struct));
@nogc @safe
ref
On 11/22/2016 05:06 AM, Nordlöw wrote:
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
mixin template RvalueRef()// <-- DOES NOT TAKE A PARAMETER ANY MORE
{
alias T = typeof(this);
static assert (is(T == struct));
@nogc @safe
ref const(T) byRef() const pure
Dne 22.11.2016 v 14:29 RazvanN via Digitalmars-d-learn napsal(a):
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it prints
false and I noticed that
Dne 22.11.2016 v 14:29 RazvanN via Digitalmars-d-learn napsal(a):
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it prints
false and I noticed that
On Tuesday, 22 November 2016 at 12:21:18 UTC, Yuxuan Shui wrote:
Is there a way to get a template function return type with
instantiating it? The return type is independent of the
template arguments.
I'm asking because there's potentially recursive template
instantiation if I do try to
On Tuesday, 22 November 2016 at 12:21:18 UTC, Yuxuan Shui wrote:
Is there a way to get a template function return type with
instantiating it? The return type is independent of the
template arguments.
I'm asking because there's potentially recursive template
instantiation if I do try to
On Tuesday, November 22, 2016 12:21:18 Yuxuan Shui via Digitalmars-d-learn
wrote:
> Is there a way to get a template function return type with
> instantiating it? The return type is independent of the template
> arguments.
No. There _is_ no function unless the template is instantiated. Remember
On 23/11/2016 2:29 AM, RazvanN wrote:
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it prints
false and I noticed that if Range is char[], wchar[],
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
ref const(T) byRef() const pure nothrow return
Add when DIP-1000 has been implemented into compiler this should
be `scope`-qualified aswell, right?
On Tuesday, 22 November 2016 at 13:29:47 UTC, RazvanN wrote:
Is this a bug?
The language is sane. The standard library is not alas, it is
insane by design, so not a bug.
Yep, I need muldiv for long values on x86-64.
What's the cleanest way of doing const or immutable slicing in D?
My first thought is
cast((const typeof(x))x)[]
cast((immutable typeof(x))x)[]
but that's too verbose for my/taste.
Is there a Phobos function for this?
hi,
I am totally following what hivemq and mqtt specs are telling.But
i have confusion regarding their implementation.In mqtt specs
they are suggesing to generate random client id if cleansession
flag is true and not for cleansession flag being false.My
question is how do i really implement
On Monday, 21 November 2016 at 09:11:39 UTC, Jonathan M Davis
wrote:
On Monday, November 21, 2016 08:57:11 Bauss via
Digitalmars-d-learn wrote:
[...]
Phobos doesn't have anything like that, but you can use the C
functions from the Windows API to do it. A quick search turned
up GetVersion
On Tuesday, 22 November 2016 at 08:54:36 UTC, Kagamin wrote:
Yep, I need muldiv for long values on x86-64.
Quick and dirty assembler:
version(D_InlineAsm_X86_64):
long muldiv(long a, long b, long c)
{
//windows RCX, RDX, R8
//linux RDI, RSI, RDX
version(Windows)
{
On Tuesday, 22 November 2016 at 19:16:56 UTC, Ali Çehreli wrote:
On 11/22/2016 08:05 AM, Satoshi wrote:
I don't have extensive experience with other languages. In
fact, the only other languages that I can claim proficiency are
C and C++. (I also know Python just enough to find it
incredible
On Tuesday, 22 November 2016 at 14:23:28 UTC, Jonathan M Davis
wrote:
On Tuesday, November 22, 2016 13:29:47 RazvanN via
Digitalmars-d-learn wrote:
[...]
You misunderstand. char[] is a dynamic array of char, wchar[]
is a dynamic array of wchar[], and dchar[] is a dynamic array
of dchar.
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
Let me know if it's not the equivalent of the original.
Ali
I've changed the idiom, thanks. The place to discuss this is the
d-idioms bugtracker, else I would have skipped this message.
On Tuesday, November 22, 2016 13:29:47 RazvanN via Digitalmars-d-learn
wrote:
> Given the following code:
>
> char[5] a = ['a', 'b', 'c', 'd', 'e'];
> alias Range = char[];
> writeln(is(ElementType!Range == char));
>
> One would expect that the program will print true. In fact, it
> prints
On Monday, 21 November 2016 at 20:04:51 UTC, Ali Çehreli wrote:
First, a reminder that we have this great resource of D idioms:
https://p0nce.github.io/d-idioms/#Rvalue-references:-Understanding-auto-ref-and-then-not-using-it
The link above has an idiom of mixing in a byRef() member
function
On Tuesday, 22 November 2016 at 11:00:52 UTC, Bauss wrote:
On Monday, 21 November 2016 at 09:11:39 UTC, Jonathan M Davis
wrote:
On Monday, November 21, 2016 08:57:11 Bauss via
Digitalmars-d-learn wrote:
[...]
Phobos doesn't have anything like that, but you can use the C
functions from the
On 11/21/16 11:53 AM, ag0aep6g wrote:
On Monday, 21 November 2016 at 16:37:32 UTC, Kagamin wrote:
Anything in .data and .bss sections and stack. See
https://issues.dlang.org/show_bug.cgi?id=15723
Ok, not an actual reference then, but a false pointer.
Yes. 100 million bytes is 1/40 of all
On Tuesday, 22 November 2016 at 13:29:47 UTC, RazvanN wrote:
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it
prints false and I noticed that if
On Tuesday, 22 November 2016 at 16:05:35 UTC, Satoshi wrote:
Sorry, but D seems to be worse and worse day by day.
This should be resolved by language and not doing it by
template function.
I hate this 'idiom' too (just a clumsy workaround for something
that should work out of the box), but
or I have simple class
class View {
this(Rectangle frame) {...}
this(float, float, float, float) { ... }
this(Point, Size) { ... }
}
then struct Point, Size and Rectangle (Point, Size)
now I need to write 2 overloads for View class taking 4 floats or
(Point, Size) and this must do in every
On Tuesday, 22 November 2016 at 16:57:28 UTC, kink wrote:
I hate this 'idiom' too (just a clumsy workaround for something
that should work out of the box), but the non-bindability of
rvalues to ref params and the associated dispute is veeery old,
nothing new, so I don't agree that the
Thanks! These tips are exactly what i needed :)
On Sunday, 20 November 2016 at 12:08:23 UTC, Ilya Yaroshenko
wrote:
You can use builtin complex numbers (cfloat/cdouble/creal). The
idea of std.complex is wrong . Mir GLAS uses builtin complex
numbers and I don't think they will be really deprecated. --Ilya
Good to know! The builtin syntax
On Sunday, 20 November 2016 at 11:46:04 UTC, Marc Schütz wrote:
Try placing it outside the function. Method call syntax doesn't
work with nested functions, see here:
https://dlang.org/spec/function.html#pseudo-member
"The reason why local symbols are not considered by UFCS, is to
avoid
On 11/22/2016 08:05 AM, Satoshi wrote:
> Sorry, but D seems to be worse and worse day by day.
I don't have extensive experience with other languages. In fact, the
only other languages that I can claim proficiency are C and C++. (I also
know Python just enough to find it incredible how it's
38 matches
Mail list logo