Think you can share the code?
On Sunday, 9 April 2017 at 14:47:39 UTC, Jonathan Marler wrote:
Does anyone know why Socket and Address in phobos were created
as classes instead of structs?
It is probably just the historical evolution, but I find it
pretty handy: I did a subclass of Socket to do SSL, then as is
nice with cl
On Sunday, 9 April 2017 at 16:44:41 UTC, ag0aep6g wrote:
Or you can make it a template value parameter [2] with type
`string[]`:
string[] sfilter(T, string[] fields)()
{
string[] result;
foreach (f; aliasSeqOf!fields)
{
/* ... loop body as you have it ... */
}
On Sunday, 9 April 2017 at 20:59:26 UTC, ag0aep6g wrote:
On 04/09/2017 10:49 PM, Duarte wrote:
[...]
You're allowed to break purity in debug code.
From the spec: "As a concession to practicality, a pure
function can also [...] perform impure operations in statements
that are in a Conditiona
On Sunday, 9 April 2017 at 20:20:55 UTC, Jethro wrote:
On Sunday, 9 April 2017 at 19:55:57 UTC, Stefan Koch wrote:
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
[...]
The constructor is nuts.
You do not need to zero the string!
Also avoid templates if you can.
Please don't critici
On 04/09/2017 10:49 PM, Duarte wrote:
---
import std.stdio;
pure void foo()
{
debug
{
stdout.writeln("1");
}
stdout.writeln("2");
}
void main(string[] args)
{
foo();
}
---
Using either '-debug' or '-release', the second stdout will give an
Hi all,
Using the following example:
---
import std.stdio;
pure void foo()
{
debug
{
stdout.writeln("1");
}
stdout.writeln("2");
}
void main(string[] args)
{
foo();
}
---
Using either '-debug' or '-release', the second stdout will give
a
On Sunday, 9 April 2017 at 19:55:57 UTC, Stefan Koch wrote:
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
[...]
The constructor is nuts.
You do not need to zero the string!
Also avoid templates if you can.
Please don't criticize banal stuff by choosing one meaningless
line and cal
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
I tried to make a string like replacement called fstring which
uses buffering to avoid lots of little allocations. The problem
is, that it actually causes the compiler to use 10x the memory
and about 10 times slower.
It doesn't do anythi
On Saturday, 8 April 2017 at 21:34:30 UTC, Ali Çehreli wrote:
You can mixin declarations with a template but I don't see how
it can help here. A string mixin would work but it's really
ugly at the use site:
string roundUp(alias x)()
if (is (typeof(x) == uint)) {
import std.string : format
I tried to make a string like replacement called fstring which
uses buffering to avoid lots of little allocations. The problem
is, that it actually causes the compiler to use 10x the memory
and about 10 times slower.
It doesn't do anything special but tries to emulate string(so it
can be a d
On 04/09/2017 04:36 PM, Boris-Barboris wrote:
Hello, I have a similar problem. For the life of me I can't make CTFE
work while manipulating collections. Source:
This post is only loosely related to the thread. Generally, please make
a new thread for a new problem.
import std.meta;
import st
On 09/04/2017 4:19 PM, Jonathan Marler wrote:
On Sunday, 9 April 2017 at 15:04:29 UTC, rikki cattermole wrote:
On 09/04/2017 3:56 PM, Jonathan Marler wrote:
On Sunday, 9 April 2017 at 14:49:14 UTC, rikki cattermole wrote:
Don't think too hard, times have changed since std.socket was written.
I
On Sunday, 9 April 2017 at 15:04:29 UTC, rikki cattermole wrote:
On 09/04/2017 3:56 PM, Jonathan Marler wrote:
On Sunday, 9 April 2017 at 14:49:14 UTC, rikki cattermole
wrote:
Don't think too hard, times have changed since std.socket was
written.
It certainly isn't designed for high performance
On 09/04/2017 3:56 PM, Jonathan Marler wrote:
On Sunday, 9 April 2017 at 14:49:14 UTC, rikki cattermole wrote:
Don't think too hard, times have changed since std.socket was written.
It certainly isn't designed for high performance hence e.g. libasync.
What an odd response... You don't think I
On Sunday, 9 April 2017 at 14:49:14 UTC, rikki cattermole wrote:
Don't think too hard, times have changed since std.socket was
written.
It certainly isn't designed for high performance hence e.g.
libasync.
What an odd response... You don't think I should ask questions
about why decisions were
Don't think too hard, times have changed since std.socket was written.
It certainly isn't designed for high performance hence e.g. libasync.
Does anyone know why Socket and Address in phobos were created as
classes instead of structs?
My guess is that making Socket a class prevents socket handle
leaks because you can clean up the handle in the destructor when
the memory gets freed if no one closes it. Is this the reason it
is a c
On Wednesday, 15 March 2017 at 17:27:35 UTC, ag0aep6g wrote:
Phobos has it: std.meta.aliasSeqOf "converts an input range
[...] to an
alias sequence." [1]
Woops, forgot to give the URL for that "[1]". Here it is:
http://dlang.org/phobos/std_meta.html#aliasSeqOf
Hello, I have a similar proble
On Sunday, 9 April 2017 at 00:36:00 UTC, TheGag96 wrote:
I'm trying to use a binary heap initialized with one element.
However, this always seems to cause a range violation for some
reason. This small example will do it:
import std.stdio, std.container;
void main() {
auto pq = heapify([5]);
On 04/09/2017 07:44 AM, Meta wrote:
On Saturday, 8 April 2017 at 22:37:18 UTC, ag0aep6g wrote:
[...]
This line works just fine, actually. There's really no difference
between a normal template and a mixin template when you use it in a
mixin.
[...]
Hmm, you're right, but this is not how it is
On Sunday, 9 April 2017 at 09:23:07 UTC, Joseph Rushton Wakeling
wrote:
Thanks for the explanation. TBH I find myself wondering
whether `-fPIC` should be in the flags defined in dmd.conf _at
all_ (even for 64-bit environments); surely that should be on
request of individual project builds ..
On Sunday, 9 April 2017 at 07:12:51 UTC, Patrick Schluter wrote:
32 bit modes support for PIC is painful because the RIP
relative addressing mode does not exist. AMD introduced it when
they added 64 bit support in the Opteron processors. In 32 bit
mode it was possible to generate PIC code but i
On Saturday, 8 April 2017 at 21:31:31 UTC, Joseph Rushton
Wakeling wrote:
Hello folks,
The default dmd.conf settings for 64-bit environments include
the -fPIC flag (for good reason), but the settings for 32-bit
environments do not. Any particular reason for this?
Thanks & best wishes,
On Saturday, 8 April 2017 at 21:31:31 UTC, Joseph Rushton
Wakeling wrote:
Hello folks,
The default dmd.conf settings for 64-bit environments include
the -fPIC flag (for good reason), but the settings for 32-bit
environments do not. Any particular reason for this?
Thanks & best wishes,
25 matches
Mail list logo