On 2017-01-31 11:36, Jason Schroeder wrote:
I am interested in contributing to D on GitHub, and was wondering if
there is a minimum or preferabe minimum size of a pull request; e.g. I
woukd like to work on increasing code coverage, and am wondering if a
pull request with one additional line of
Hi all,
I was looking at D as the next language to use in my hobby
projects, but the
"conservative GC" part in the language spec
(http://dlang.org/spec/garbage.html) looks a bit concerning. I'm
wondering what
are the implications of the fact that current GC is a Boehm-style
conservative
GC
On Wednesday, 1 February 2017 at 00:43:39 UTC, bitwise wrote:
Container!int c; // = Container!int() -> can't do this.
Can you live with
Container!int c = Container!int.create();
because D supports that and can force the issue with `@disable
this();` which causes compilation to fail any
is it possible to intercept the STDOUT or STDERR and capture the
output into a variable ?
some pseudocode to explain what I mean
string[] output_buffer;
stdout.capture_to(output_buffer);
writeln("test 1"); # not printed
writeln("test 2"); # not printed
stdout.release(output_buffer);
C#'s "Dispose" pattern comes to mind here.
You don't leak memory, you just leak file handles and graphics
resources instead when you forget to explicitly call Dispose().
On Tuesday, 31 January 2017 at 23:52:31 UTC, Ali Çehreli wrote:
On 01/31/2017 03:15 PM, bitwise wrote:
[...]
Thanks for the response, but this doesn't really solve the
problem.
> If the object is defined at module scope as shared static
> immutable
It is indeed possible to initialize
On 01/31/2017 03:15 PM, bitwise wrote:
> If the object is defined at module scope as shared static immutable
Yes, the situation is different from C++ but it's always possible to
call a function (which constructor is one) to make the object.
It is indeed possible to initialize immutable
Unless I'm missing something, it seems that neither of these are
actually possible.
Consider an object which needs internal state to function.
The obvious answer is to create it in the constructor:
struct Foo(T)
{
T* payload;
this() { payload =
On Tuesday, 31 January 2017 at 17:20:00 UTC, John Colvin wrote:
It's a bug, please report it. The initializer should be
statically disallowed.
Adding a .dup works around the problem.
OK. Hmm, but the real use case was a bit more complicated, more
like:
-
int n = 10;
foreach (i; 0..n)
On Tuesday, 31 January 2017 at 14:15:58 UTC, Ivan Kazmenko wrote:
Hi.
I wanted to check whether a few variables of the same type are
all distinct, in a quick and dirty way. I tried to do it
similar to Python's "len(set(value_list)) == len(value_list)"
idiom by using an associative array
On Friday, 27 January 2017 at 23:22:17 UTC, Nick Sabalausky wrote:
Suppose an array is being used like a FIFO:
---
T[] slice;
// Add:
slice ~= T();
// Remove:
slice = slice[1..$];
---
Assuming of course there's no other references to the memory,
as
Hi.
I wanted to check whether a few variables of the same type are
all distinct, in a quick and dirty way. I tried to do it similar
to Python's "len(set(value_list)) == len(value_list)" idiom by
using an associative array (AA). At this point, I found out that
when initializing the AA with
On Monday, 30 January 2017 at 11:03:52 UTC, Profile Anaysis wrote:
I need to yield from a complex recursive function too allow
visualizing what it is doing.
e.g., if it is a tree searching algorithm, I'd like to yield
for each node so that the current state can be shown visually.
I realize
On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote:
Are there any dub package for compressing images uploaded
through web forms? Cropping/resizing may also come in handy.
I want one for a vibe.d project.
dlib-webp[1] is almost what I've been looking for. In fact, webp
is a complete
On Tuesday, 31 January 2017 at 11:31:28 UTC, Ali Çehreli wrote:
On 01/31/2017 03:00 AM, Profile Anaysis wrote:
> [...]
[...]
> [...]
return type.
Options:
[...]
Thanks again!
On Tuesday, 31 January 2017 at 11:40:06 UTC, Ali Çehreli wrote:
On 01/31/2017 02:49 AM, Alex wrote:
> auto r = E!(int, myType.a, true)();
> static if (is(T : TX!TL, alias TX, TL...))
> {
> writeln(is(TL[0] == int));
> writeln(typeid(TL[1]));
>
On 01/31/2017 02:49 AM, Alex wrote:
> auto r = E!(int, myType.a, true)();
> static if (is(T : TX!TL, alias TX, TL...))
> {
> writeln(is(TL[0] == int));
> writeln(typeid(TL[1]));
> writeln(typeid(TL[2]));
> writeln(is(TL[2] == bool));
> }
That's
On 01/31/2017 03:00 AM, Profile Anaysis wrote:
> Just curious, how can I use start() recursively?
[...]
> Seems I can't create start with a parameter and non-void return type.
Options:
- The class can maintain state
- You can start the fiber with a delegate;
int local;
double state;
On Tuesday, 31 January 2017 at 10:42:41 UTC, rikki cattermole
wrote:
On 31/01/2017 11:36 PM, Jason Schroeder wrote:
I am interested in contributing to D on GitHub, and was
wondering if
there is a minimum or preferabe minimum size of a pull
request; e.g. I
woukd like to work on increasing code
On Tuesday, 31 January 2017 at 06:32:02 UTC, Ali Çehreli wrote:
On 01/30/2017 08:12 PM, Profile Anaysis wrote:
import std.stdio, std.concurrency, core.thread;
class Search : Fiber
{
this() { super(); }
int res = 0;
void start()
{
Fiber.yield();
res = 1;
}
}
Hey guys,
could you help me understand the syntax of the isExpression?
I have an example, leaned on documentation
https://dlang.org/spec/expression.html#IsExpression
case 7.
// Code starts here //
import std.stdio, std.typecons;
alias Tup = Tuple!(int, string, bool);
enum myType {a, b, c}
On 31/01/2017 11:36 PM, Jason Schroeder wrote:
I am interested in contributing to D on GitHub, and was wondering if
there is a minimum or preferabe minimum size of a pull request; e.g. I
woukd like to work on increasing code coverage, and am wondering if a
pull request with one additional line
On Tuesday, 31 January 2017 at 06:32:02 UTC, Ali Çehreli wrote:
On 01/30/2017 08:12 PM, Profile Anaysis wrote:
[...]
That's because the fiber is not in a callable state. (You can
check with search.state.) Here is one where the fiber function
lives (too) long:
import std.stdio,
I am interested in contributing to D on GitHub, and was wondering
if there is a minimum or preferabe minimum size of a pull
request; e.g. I woukd like to work on increasing code coverage,
and am wondering if a pull request with one additional line of
code, e.g. one assert () in a unittest
24 matches
Mail list logo