In this example:
const(AliasSeq!(int, int)) a;
pragma(msg, typeof(a)); // (int, int)
This kind of make sense, since AliasSeq is not a "single" type.
But silently dropping const seems bad, the compiler should
probably report an error/warning in this case?
This surprised me A LOT:
https://d.godbolt.org/z/82a_GZ
So if I call something.map!().array, I get an array of delegates?
That makes no sense to me.
Issue filed: https://issues.dlang.org/show_bug.cgi?id=19190
On Saturday, 25 August 2018 at 14:13:18 UTC, rikki cattermole
wrote:
On 26/08/2018 2:10 AM, Yuxuan Shui wrote:
The offending code base is a little big and hard to reduce.
I'll try if code is required, but here is the gist of the
problem:
This snippet of code in my project:
...
alia
The offending code base is a little big and hard to reduce. I'll
try if code is required, but here is the gist of the problem:
This snippet of code in my project:
...
alias tmp = genCode!T;
enum str = tmp.str; // This line here
...
Generate a circular reference error.
However,
file1.d:
import std.stdio;
file2.d:
import file1;
pragma(msg, __traits(getProtection, __traits(getMember, m1,
"std"))); // public
pragma(msg, __traits(getProtection, m1.std)); // private
Bug? Intended?
On Saturday, 4 August 2018 at 21:10:32 UTC, Steven Schveighoffer
wrote:
On 8/4/18 4:10 PM, Yuxuan Shui wrote:
This doesn't work:
template A() {
void B() {};
}
template B() {
mixin A!();
}
void main() {
B!()();
}
Is this intentional?
I believe mixin templates introduce a new sy
This doesn't work:
template A() {
void B() {};
}
template B() {
mixin A!();
}
void main() {
B!()();
}
Is this intentional?
On Wednesday, 31 May 2017 at 09:31:48 UTC, Jonathan M Davis wrote:
On Wednesday, May 31, 2017 08:18:07 Vasileios Anagnostopoulos
via Digitalmars-d-learn wrote:
[...]
Well, if you're not doing checked exceptions, the interesting
question is really what _doesn't_ throw rather than what
throws,
On Wednesday, 31 May 2017 at 08:18:07 UTC, Vasileios
Anagnostopoulos wrote:
Hi,
after reading various articles bout the "supposed" drawbacks of
checked exceptions I started to have questions on @nothrow. Why
there exists and not a @throws annotation enforced by the
compiler? I understand that
On Tuesday, 16 May 2017 at 01:34:50 UTC, Stanislav Blinov wrote:
On Tuesday, 16 May 2017 at 01:22:49 UTC, Yuxuan Shui wrote:
Can I expand an array with uninitialized object? Or can I rely
on the compiler to optimize the initialization away?
Built-in arrays always default-initialize their elem
On Monday, 15 May 2017 at 23:36:06 UTC, Stanislav Blinov wrote:
On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote:
Suppose I have a
struct A {
@disable this(this);
} x;
How do I append it into an array?
Do I have to do
array.length++;
moveEmplace(x, array[$-1]);
?
moveEmplace is
Suppose I have a
struct A {
@disable this(this);
} x;
How do I append it into an array?
Do I have to do
array.length++;
moveEmplace(x, array[$-1]);
?
So in this document:
http://yshui.gitlab.io/sdpc/sdpc/parsers/whitespace.html
Part of the type name is still mangled. I found ddox use
core.demangle.demangleType internally. So I guess code.demangle
is following behind dmd?
Is there a better way to demangle a name?
On Thursday, 6 April 2017 at 18:45:26 UTC, Ali Çehreli wrote:
On 04/06/2017 11:37 AM, Russel Winder via Digitalmars-d-learn
wrote:
[...]
I think it's just a design choice. C implicitly converts the
name of the function to a pointer to that function. D requires
the explicit & operator:
alia
On Saturday, 25 March 2017 at 05:20:44 UTC, Jonathan M Davis
wrote:
On Saturday, March 25, 2017 04:57:26 Yuxuan Shui via
Digitalmars-d-learn wrote:
[...]
An AliasSeq isn't really ever a type. AliasSeq!(int, float) is
a list of types, not a type itself, and is expressions supports
comp
On Saturday, 25 March 2017 at 04:23:31 UTC, Jonathan M Davis
wrote:
On Saturday, March 25, 2017 03:25:27 Yuxuan Shui via
Digitalmars-d-learn wrote:
In this example:
import std.range;
template expandRange(alias R) if
(isInputRange!(typeof(R))) {
static if (R.empty
In this example:
import std.range;
template expandRange(alias R) if (isInputRange!(typeof(R))) {
static if (R.empty)
alias expandRange = AliasSeq!();
else
alias expandRange = AliasSeq!(R.front(),
expandRange!(R.drop(1)));
}
///
unittest {
Hi,
Is there any difference, when a type is passed into an alias
parameter vs into a type parameter?
auto a(T)(auto ref T t) {
return t;
}
void main() {
alias tmp = a!int;
import std.stdio;
writeln(tmp(10));
}
This gives this error message:
test.d(1): Error: 'auto' can only be used as part of 'auto ref'
for template function parameters
Which is rather useless,
Example:
/**
test type
*/
struct A(bool T) {
static if (T) {
/// Case 1
int ok(){ return 1; }
} else {
/// case 2
int notok(){ return 1; }
}
/// Other
int other() { return 0; }
}
///
unitte
On Monday, 30 January 2017 at 12:40:44 UTC, Jack Applegame wrote:
bug report: https://issues.dlang.org/show_bug.cgi?id=17128
LDC (2.070.2) has a different problem: the dtor is never called.
On Thursday, 19 January 2017 at 02:00:10 UTC, Ali Çehreli wrote:
On 01/18/2017 05:22 PM, Yuxuan Shui wrote:
Somehow I can't use ubyte variables behind 'case', but ulong
works fine.
Why is that?
case expressions must be constants:
"The case expressions must all evaluate to a constant value
Somehow I can't use ubyte variables behind 'case', but ulong
works fine. Why is that?
void main() {
alias TestType = ulong; // won't compile if = ubyte
import std.stdio;
TestType a,b,c;
readf("%s %s %s ", &a, &b, &c);
switch(c){
case a: wri
The built in chain seems to only be able to chain a fixed number
of ranges, is there a way to chain a range/array of ranges?
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3, 'P':4];
And got a "non-constant expression" error (with or without
'immutable').
What's the correct way?
On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui wrote:
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3,
'P':4];
And got a "non-constant expression" error (with or without
'immutable').
What's the correct way?
This example here: https://dlang.org/spec/has
On Tuesday, 13 December 2016 at 00:33:58 UTC, Yuxuan Shui wrote:
On Monday, 12 December 2016 at 22:35:22 UTC, Yuxuan Shui wrote:
On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote:
On 12/12/2016 02:08 PM, Yuxuan Shui wrote:
> [...]
wrote:
>> [...]
Error.bypassedException
>> [...]
me
On Monday, 12 December 2016 at 22:35:22 UTC, Yuxuan Shui wrote:
On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote:
On 12/12/2016 02:08 PM, Yuxuan Shui wrote:
> [...]
wrote:
>> [...]
Error.bypassedException
>> [...]
mechanism,
>> [...]
Error."
>> [...]
Exception,
>> [...]
otherwise
>
On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote:
On 12/12/2016 02:08 PM, Yuxuan Shui wrote:
> [...]
wrote:
>> [...]
Error.bypassedException
>> [...]
mechanism,
>> [...]
Error."
>> [...]
Exception,
>> [...]
otherwise
>> [...]
original
>> [...]
is the Error.
> [...]
Exception to
> [.
Thanks a lot for the explanation!
On Monday, 12 December 2016 at 22:01:54 UTC, Ali Çehreli wrote:
(Note: Looks like there is a bug regarding
Error.bypassedException member. Would others please confirm.)
On 12/12/2016 01:15 PM, Yuxuan Shui wrote:
> [...]
that Error
> [...]
vague, and I'm
> [...
I read https://dlang.org/spec/statement.html, which told me that
Error is different in the way it's chained. But that is pretty
vague, and I'm still confused.
Can someone explain that using examples?
Thanks.
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.
On Wednesday, 12 October 2016 at 23:14:26 UTC, Jonathan M Davis
wrote:
opIndexUnary, opIndexAssign, and opIndexOpAssign exist to make
it possible to do some basic operations on the result of
foo[bar] without having to have opIndex return by ref, but
assuming that you can return by ref, all of t
On Monday, 10 October 2016 at 19:16:06 UTC, Jonathan M Davis
wrote:
On Monday, October 10, 2016 19:01:19 Yuxuan Shui via
Digitalmars-d-learn wrote:
Hi,
Why is there no opIndexDispatch for overloading a[x].func() ?
There's opIndex for overloading a[x], and then you can call a
function o
Hi,
Why is there no opIndexDispatch for overloading a[x].func() ?
On Friday, 23 September 2016 at 15:29:43 UTC, Rene Zwanenburg
wrote:
On Friday, 23 September 2016 at 07:54:15 UTC, John C wrote:
How is it possible that "onTextChanged" isn't accessible but
the private method "changeSize" *is*?
Smells like an oversight. I guess the compiler doesn't see the
de
On Tuesday, 20 September 2016 at 22:38:33 UTC, Jonathan M Davis
wrote:
On Tuesday, September 20, 2016 22:23:08 Yuxuan Shui via
Digitalmars-d-learn wrote:
struct A {
ulong[] x;
}
struct B {
ulong x;
}
void main() {
B[] b;
const(B) xx = B(1);
b ~= xx; // Works
A[] c;
const(A) yy
struct A {
ulong[] x;
}
struct B {
ulong x;
}
void main() {
B[] b;
const(B) xx = B(1);
b ~= xx; // Works
A[] c;
const(A) yy = A([1]);
c ~= yy; // Does not
}
What gives?
On Tuesday, 13 September 2016 at 20:36:22 UTC, Steven
Schveighoffer wrote:
On 9/13/16 4:11 PM, Yuxuan Shui wrote:
On Tuesday, 13 September 2016 at 20:00:40 UTC, Steven
Schveighoffer wrote:
Not familiar with C++ lambda. You can always "specify" how to
capture
the data by directly declaring it:
On Tuesday, 13 September 2016 at 20:00:40 UTC, Steven
Schveighoffer wrote:
On 9/13/16 3:42 PM, Yuxuan Shui wrote:
[...]
There's nothing in the language to prevent this optimization.
[...]
Again, could be clearer. But the fact that both the function
and the struct affect the same data kind
On Tuesday, 13 September 2016 at 01:32:19 UTC, Steven
Schveighoffer wrote:
On 9/12/16 4:11 PM, Ali Çehreli wrote:
On 09/10/2016 10:44 PM, Yuxuan Shui wrote:
I recently noticed nested struct capture its context by
reference
(which, BTW, is not mentioned at all here:
https://dlang.org/spec/struc
I recently noticed nested struct capture its context by reference
(which, BTW, is not mentioned at all here:
https://dlang.org/spec/struct.html#nested). And bliting a struct
obviously doesn't do a deep copy of its context.
So my question is, is there a way to deep copy the context of a
struct
On Friday, 9 September 2016 at 10:03:01 UTC, wobbles wrote:
On Thursday, 8 September 2016 at 07:20:52 UTC, Yuxuan Shui
wrote:
On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg
wrote:
On 2016-09-08 07:39, Yuxuan Shui wrote:
Hi,
I wonder if there's standardized way to gather which f
On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg
wrote:
On 2016-09-08 07:39, Yuxuan Shui wrote:
Hi,
I wonder if there's standardized way to gather which files are
imported
by a source file. I know I can run "dmd -v" and look for lines
start
with "import", but I don't know if this
Hi,
I wonder if there's standardized way to gather which files are
imported by a source file. I know I can run "dmd -v" and look for
lines start with "import", but I don't know if this is the best
way to do it.
On Wednesday, 7 September 2016 at 22:54:14 UTC, Basile B. wrote:
On Wednesday, 7 September 2016 at 21:20:30 UTC, Yuxuan Shui
wrote:
I have a little data processing program which makes heavy use
of associative arrays, and GC almost doubles the runtime of it
(~2m with GC disabled -> ~4m).
I jus
I have a little data processing program which makes heavy use of
associative arrays, and GC almost doubles the runtime of it (~2m
with GC disabled -> ~4m).
I just want to ask what's the best practice in this situation? Do
I just use GC.disable and manually run GC.collect periodically?
On Thursday, 1 September 2016 at 21:07:36 UTC, Steven
Schveighoffer wrote:
On 9/1/16 4:38 PM, Yuxuan Shui wrote:
[...]
Referring to a null object is not a problem. Your program
crashes ungracefully, but does not corrupt memory. However, in
either approach, it can easily end up being a dangli
On Thursday, 1 September 2016 at 20:28:03 UTC, Rene Zwanenburg
wrote:
On Thursday, 1 September 2016 at 19:37:25 UTC, Yuxuan Shui
wrote:
[...]
This will allocate a closure. A struct definition inside a
function has a hidden context / closure pointer, unless it's a
static struct.
There is no
I just figured out how to store a reference:
@safe:
auto x(ref int a) {
struct A {
ref int xa() { return a; }
}
return A();
}
void main() {
import std.stdio;
int b = 10;
auto a = x(b);
a.xa = 20;
writeln(b); //Prints
On Wednesday, 31 August 2016 at 18:28:20 UTC, Ali Çehreli wrote:
On 08/31/2016 07:03 AM, Yuxuan Shui wrote:
> I want to make a hash table that uses
> std.experiment.allocator. The bucket is allocated from an
> allocator, and freed in ~this(). I don't want to copy the
whole
> bucket in this(this)
On Wednesday, 31 August 2016 at 19:39:36 UTC, ag0aep6g wrote:
On 08/31/2016 09:23 PM, Yuxuan Shui wrote:
Correct me if I'm wrong. But I believe this is only true when
the source
code of function is not available. Otherwise the compiler
should always
know if a function is actually @nogc or not.
On Wednesday, 31 August 2016 at 18:07:46 UTC, Cauterite wrote:
On Wednesday, 31 August 2016 at 16:17:51 UTC, Yuxuan Shui wrote:
No. When you use assumeUnique, you know something the compiler
does know, and have to use assumeUnique to tell the compiler
that (at least when you use it correctly).
On Wednesday, 31 August 2016 at 15:52:18 UTC, Cauterite wrote:
On Wednesday, 31 August 2016 at 15:10:11 UTC, Seb wrote:
AssumeNogc is potentially dangerous, so I don't know whether
it can make it directly, but only if you try you know ;-)
So is assumeUnique
No. When you use assumeUnique, you
On Tuesday, 30 August 2016 at 20:30:12 UTC, Ali Çehreli wrote:
On 08/30/2016 12:06 PM, Yuxuan Shui wrote:
Is there a way to use a range defined with disabled post-blit
in
foreach? In other words, is there a way to prevent foreach
from copying
the range?
It's not possible. You can't do much w
Is there a way to use a range defined with disabled post-blit in
foreach? In other words, is there a way to prevent foreach from
copying the range?
Should I use move()?
I was trying to use allocators in a @nogc function.
I tried FreeList!Mallocator and it works fine. But
AllocatorList!Mallocator doesn't work. dmd complains that
AllocatorList.allocate is not @nogc, even when
BookkeepingAllocator is NullAllocator. But if I add '@nogc' to
AllocatorList.allocate
On Saturday, 21 May 2016 at 17:32:47 UTC, dan wrote:
Is it possible to have a class which has a variable which can
be seen from the outside, but which can only be modified from
the inside?
Something like:
class C {
int my_var = 3; // semi_const??
void do_something() { my_var = 4; }
}
On Friday, 20 May 2016 at 06:40:42 UTC, Jacob Carlborg wrote:
On 2016-05-20 04:14, Yuxuan Shui wrote:
Hmm... This could work. But I'm not satisfied with this
solution. What
if I have multiple yield sites in the fiber, and each have
different
return types?
Maybe I should use a Variant?
I th
On Thursday, 19 May 2016 at 23:42:03 UTC, Ali Çehreli wrote:
On 05/19/2016 12:57 PM, Yuxuan Shui wrote:
[...]
You can use a delegate that takes a ref parameter:
import std.stdio;
import core.thread;
void fiberFunc(ref string y) {
y = "produced_by_fiberFunc";
Fiber.yield();
}
void ma
I find this difficult because I can't passing data via
Fiber.yield/Fiber.call pair. e.g. I want something like:
void fiberFunc() {
//Add some file descriptor to main loop
string y = Fiber.yield();
writeln(y);
}
auto f = new Fiber(&fiberFunc);
f.call();
mainloop {
if (fd_readable)
On Thursday, 21 April 2016 at 23:05:38 UTC, deed wrote:
Often I find myself wanting to alias an expression, such as
verbose fields, possibly nested. AFAIK, the with statement
makes it easier, but not as good as it could have been. What
I'd like to express is for example something like this:
[
On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote:
[...]
Looks like _d_arrayappendcTX asked for a enormous amount of
memory and it fails, can't figure out why
Just find out it's my own fault.
BTW, memory block allocat
On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 03:37:39 UTC, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole
wrote:
On 07/04/2016 3:18 PM, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
On Thursday, 7 April 2016 at 03:37:39 UTC, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole
wrote:
On 07/04/2016 3:18 PM, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
[...]
static this/static ~this should work, right?
They e
On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole wrote:
On 07/04/2016 3:18 PM, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
[...]
static this/static ~this should work, right?
They execute when the runtime is started.
So now I add call rt_init
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote:
[...]
The runtime is needed if you are going to use any of its
features, like the GC. If you restrict yourself strictly to C
in D (and that means avoiding thinks like b
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote:
[...]
The runtime is needed if you are going to use any of its
features, like the GC. If you restrict yourself strictly to C
in D (and that means avoiding thinks like b
On Thursday, 7 April 2016 at 01:42:54 UTC, rikki cattermole wrote:
On 07/04/2016 1:38 PM, Yuxuan Shui wrote:
[...]
Have you started D's runtime?
How to start D's runtime? I followed the examples found here:
https://dlang.org/dll-linux.html#dso9, which doesn't say anything
about starting th
I have a D shared library which is loaded by a C shared library,
which is in turn loaded by my main program.
When the D library tries to allocate something, the whole program
get an SIGSEGV in __GI___pthread_mutex_lock.
Stack trace:
(gdb) bt
#0 __GI___pthread_mutex_lock (mutex=0x7fffc1b
On Monday, 4 April 2016 at 21:31:08 UTC, Ali Çehreli wrote:
On 04/04/2016 09:36 AM, Anonymouse wrote:
On Monday, 4 April 2016 at 03:55:26 UTC, Yuxuan Shui wrote:
[...]
assert(x.aa.length > 0); // <-- boom
[...]
No idea myself but that's where it seems to go wrong.
Looks like
On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote:
I have encountered a weird bug.
I defined a Set class, which has a opBinary!"-". And somehow
this:
auto tmp = set_a-set_b;
produces different results as this:
set_a = set_a-set_b;
the latter will produce an empty set.
I tried to
On Monday, 4 April 2016 at 03:55:26 UTC, Yuxuan Shui wrote:
On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote:
I have encountered a weird bug.
I defined a Set class, which has a opBinary!"-". And somehow
this:
auto tmp = set_a-set_b;
produces different results as this:
set_a = set
On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote:
I have encountered a weird bug.
I defined a Set class, which has a opBinary!"-". And somehow
this:
auto tmp = set_a-set_b;
produces different results as this:
set_a = set_a-set_b;
the latter will produce an empty set.
I tried to
I have encountered a weird bug.
I defined a Set class, which has a opBinary!"-". And somehow this:
auto tmp = set_a-set_b;
produces different results as this:
set_a = set_a-set_b;
the latter will produce an empty set.
I tried to reduce the source code to get a test case. But this
problem ju
On Monday, 4 April 2016 at 00:50:27 UTC, Jonathan M Davis wrote:
On Sunday, April 03, 2016 23:46:10 John Colvin via
Digitalmars-d-learn wrote:
On Saturday, 2 April 2016 at 16:00:51 UTC, Jonathan M Davis
wrote:
> [...]
Maybe
aa.byKey().takeExactly(aa.length)
Yeah, that's a clever workaround.
Why?
This is annoying when I need to feed it into a function that
requires hasLength.
On Wednesday, 30 March 2016 at 00:26:49 UTC, Yuxuan Shui wrote:
My code looks something like this:
bool[ulong][ulong] edge;
foreach(u; from)
foreach(v; to_)
edge[u][v] = true;
foreach(u; edge.keys) {
auto adj = edge[u];
//
}
And sometimes edge[u] would give Range violati
My code looks something like this:
bool[ulong][ulong] edge;
foreach(u; from)
foreach(v; to_)
edge[u][v] = true;
foreach(u; edge.keys) {
auto adj = edge[u];
//
}
And sometimes edge[u] would give Range violation error.
On Thursday, 24 March 2016 at 15:52:49 UTC, Adam D. Ruppe wrote:
On Thursday, 24 March 2016 at 15:07:09 UTC, Yuxuan Shui wrote:
Is there a way to do this automatically?
No. You have to decide to bring them together if you want them
to overload.
Oh, sorry, this is not what I meant.
What I w
On Thursday, 24 March 2016 at 13:55:31 UTC, Adam D. Ruppe wrote:
On Thursday, 24 March 2016 at 12:11:33 UTC, Marc Schütz wrote:
On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote:
module one;
void func(int a){}
/
module two;
import one;
void func(float a){}
Add
Say:
module one;
void func(int a){}
/
module two;
import one;
void func(float a){}
Is there a way to get both func() in module two?
On Thursday, 10 March 2016 at 02:14:19 UTC, H. S. Teoh wrote:
On Thu, Mar 10, 2016 at 01:33:41AM +, Yuxuan Shui via
Digitalmars-d-learn wrote:
[...]
You can't rely on invoking the compiler to link these objects,
because if you're using shared libraries, it will be the OS&
On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote:
On 03/09/2016 07:05 AM, Yuxuan Shui wrote:
> Can we left TypeInfo symbol undefined in the shared
libraries? i.e. D
> compiler will strip out TypeInfo definition when creating .so.
> (Alternatively, we can have TypeInfo always undefin
On Tuesday, 8 March 2016 at 23:13:32 UTC, Anon wrote:
On Tuesday, 8 March 2016 at 20:26:04 UTC, Yuxuan Shui wrote:
[...]
[Note: I phrase my answer in terms of Linux shared libraries
(*.so) because D doesn't actually have proper Windows DLL
support yet. The same would apply to DLLs, it just f
On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer
wrote:
On 3/4/16 4:30 PM, Yuxuan Shui wrote:
On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer
wrote:
[...]
Thanks for answering. But I still don't understand why
TypeInfo would
need to be allocated. Aren't typeid() ju
On Saturday, 5 March 2016 at 14:18:31 UTC, Atila Neves wrote:
With a small number of threads, things work as intended in the
code below. But with 1000, on my machine it either crashes or
throws an exception:
import std.stdio;
import std.parallelism;
import std.range;
void main() {
stdou
For example
struct A{}
@safe void main(){
import std.stdio;
A a, b;
auto y = typeid(a);
y.name = "Nope, I'm not A";
auto x = typeid(b);
writeln(x);
}
Make changes to TypeInfo will affect all the future typeid()
results! And D is OK with that?
IM
On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer
wrote:
On 3/3/16 6:58 PM, Yuxuan Shui wrote:
On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote:
On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote:
Will typeid(a) is typeid(b) yield different results than
type
On Thursday, 3 March 2016 at 23:58:39 UTC, Yuxuan Shui wrote:
On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote:
On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote:
Will typeid(a) is typeid(b) yield different results than
typeid(a) == typeid(b)?
No. Indeed, opEquals on
On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote:
On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote:
Will typeid(a) is typeid(b) yield different results than
typeid(a) == typeid(b)?
No. Indeed, opEquals on TypeInfo just calls is itself.
But opEquals also has extra co
Will typeid(a) is typeid(b) yield different results than
typeid(a) == typeid(b)?
On Friday, 19 February 2016 at 21:58:24 UTC, user001 wrote:
Well struct don't have it, but i would like something like it
but only for data, i don't need functions or anything like that
just data.
[...]
How about
struct A
{
int valueA;
}
struct B
{
A a;
int valueB;
alias a
On Friday, 19 February 2016 at 20:45:23 UTC, jmh530 wrote:
On Friday, 19 February 2016 at 15:00:51 UTC, jmh530 wrote:
This works.
But when I re-write foo to take that into account as in below,
I get an error that I can't implicitly convert int
function(int x) to int function(int x, int y).
Why is reduce defined as 'auto reduce(S, R)(S seed, R r)',
instead of reduce(R r, S seed)? I can't chain it.
Maybe provide both?
On Wednesday, 12 August 2015 at 23:15:48 UTC, Adam D. Ruppe wrote:
On Wednesday, 12 August 2015 at 23:06:32 UTC, Yuxuan Shui wrote:
What is wrong here?
I didn't look too closely, but there's some memory allocations
going on there which have the potential of locking all the
threads any time o
Here is a small program
(https://gist.github.com/yshui/a426f73be77d1d699555) that uses
taskPool to parallely reading from /proc// and sum the swap
usage.
Individual tasks has zero dependency between each other, but when
I remove the 'defaultPoolThreads(1)' line, the programs takes 8x
more CP
On Thursday, 30 July 2015 at 00:14:23 UTC, Yuxuan Shui wrote:
Is there a way to have dub pack the library along with all its
dependencies into a single .a?
And if not, is there any D build system capable of doing this?
reggae maybe?
Is there a way to have dub pack the library along with all its
dependencies into a single .a?
1 - 100 of 129 matches
Mail list logo