On Tuesday, 15 August 2017 at 14:24:57 UTC, Steven Schveighoffer
wrote:
What IFTI would need is a mechanism to change the parameter
types to mutable similar to how you can do this:
foo(T)(const(T) t);
This now generates one function for int, const(int),
immutable(int), and t is const within
On Monday, 14 August 2017 at 03:59:48 UTC, Jonathan M Davis wrote:
The way to handle shared is to protect the section of code
that's using the shared object with either a mutex or
synchronized block, and then you cast away shared from the
object within that section and operate on it as thread-
It's hard to tell offhand but I would recommend that you extract
the inner string into a function that generates that string,
allowing you to print out the finished product before mixing it
in.
I want declare only signature of function and build body code by
CTFE.
module mdl;
import std.stdio;
import std.traits;
import std.string;
enum autofnc;
@autofnc
{
int foo(int);
int bar(int);
}
void main()
{
writeln(foo(12));
}
mixin cfuncR;
mixin template cfuncR()
{
There is a question on SO:
https://stackoverflow.com/questions/45697469/in-dub-how-do-i-conditionally-compile-code-based-on-optional-dependencies
I have found the answer, but I am interesting is there any doc
about this?
On Tuesday, 15 August 2017 at 21:54:23 UTC, Steven Schveighoffer
wrote:
On 8/15/17 5:27 PM, Arek wrote:
On Tuesday, 15 August 2017 at 10:37:08 UTC, Kagamin wrote:
Well, no wrapper is actually needed here:
[...]
The issue is that send cannot handle shared value types due to
a bug in the imple
On Wednesday, 16 August 2017 at 18:17:36 UTC, kinke wrote:
On Wednesday, 16 August 2017 at 18:11:05 UTC, bitwise wrote:
If I define a non-default constructor for a struct, are the
fields initialized to T.init by the time it's called?
The struct instance is initialized with T.init before invoki
On Wednesday, 16 August 2017 at 16:54:04 UTC, Pham wrote:
On Wednesday, 16 August 2017 at 13:55:31 UTC, Steven
Schveighoffer wrote:
On 8/16/17 9:12 AM, Daniel Kozak via Digitalmars-d-learn wrote:
It should not be print? AIAIK std.utf.toUTF16 is not
deprecated: http://dlang.org/phobos/std_utf.ht
On Wednesday, 16 August 2017 at 18:11:05 UTC, bitwise wrote:
[...]
I'm asking this because I need to forward args to a container's
node's value.
Something like this:
struct Node(T)
{
int flags;
T value; // maybe const
this(Args...)(int flags, auto ref Args args)
{
On Wednesday, 16 August 2017 at 18:11:05 UTC, bitwise wrote:
If I define a non-default constructor for a struct, are the
fields initialized to T.init by the time it's called?
The struct instance is initialized with T.init before invoking
the constructor.
If I define a non-default constructor for a struct, are the
fields initialized to T.init by the time it's called? or am I
responsible for initializing all fields in that constructor?
..or do structs follow the same rules as classes?
https://dlang.org/spec/class.html#field-init
Thanks
On Wed, Aug 16, 2017 at 03:30:18PM +, Vino.B via Digitalmars-d-learn wrote:
[...]
> Current Output
> C:\Test1\Test2\T.txt 1234 2017-Aug-16 19:10:54.0618385
> C:\Test1\Test2\TX.txt 1234 2017-Aug-16 19:10:54.0618385
> C:\Test1\Test2\TXXX.txt 1234 2017-Aug-16 19:10:54.06183
On Wednesday, 16 August 2017 at 13:55:31 UTC, Steven
Schveighoffer wrote:
On 8/16/17 9:12 AM, Daniel Kozak via Digitalmars-d-learn wrote:
It should not be print? AIAIK std.utf.toUTF16 is not
deprecated: http://dlang.org/phobos/std_utf.html#toUTF16
OK this one
is:https://github.com/dlang/phobo
Hi,
I have a small program which will list the file names, size and
creation date and time, the output of the program is as below and
required your help to print the output as per "Required Output"
Current Output
C:\Test1\Test2\T.txt 1234 2017-Aug-16
19:10:54.0618385
C:\Tes
On 8/16/17 8:58 AM, Steven Schveighoffer wrote:
However, I have found a better way to call postblit that involves the
qualifiers than the way Variant currently does it. I'm going to submit a
PR to fix these issues.
https://github.com/dlang/phobos/pull/5694
-Steve
On 8/16/17 10:32 AM, Suliman wrote:
On Wednesday, 16 August 2017 at 13:41:29 UTC, Biotronic wrote:
On Wednesday, 16 August 2017 at 12:50:07 UTC, Suliman wrote:
MyStruct[] is actually a struct similar to this:
struct MyStruct[] {
MyStruct* ptr;
size_t length;
}
That struct is placed on
On Wednesday, 16 August 2017 at 13:41:29 UTC, Biotronic wrote:
On Wednesday, 16 August 2017 at 12:50:07 UTC, Suliman wrote:
MyStruct[] is actually a struct similar to this:
struct MyStruct[] {
MyStruct* ptr;
size_t length;
}
That struct is placed on the stack, but the data it points
t
On 8/16/17 9:12 AM, Daniel Kozak via Digitalmars-d-learn wrote:
It should not be print? AIAIK std.utf.toUTF16 is not deprecated:
http://dlang.org/phobos/std_utf.html#toUTF16
OK this one
is:https://github.com/dlang/phobos/blob/v2.075.1/std/utf.d#L2760 (but
this one is not in doc)
but this on
On Wednesday, 16 August 2017 at 12:50:07 UTC, Suliman wrote:
MyStruct[] is actually a struct similar to this:
struct MyStruct[] {
MyStruct* ptr;
size_t length;
}
That struct is placed on the stack, but the data it points to,
via the ptr field, is heap allocated.
What is struct? Just
On 8/16/17 9:04 AM, Kagamin wrote:
On Wednesday, 16 August 2017 at 12:58:25 UTC, Steven Schveighoffer wrote:
Use cases don't matter. What matters is: is it proper for Variant to
call the postblit (as it does currently) without regard for the
qualifiers?
Looks like it isn't, https://dpaste.dzf
It should not be print? AIAIK std.utf.toUTF16 is not deprecated:
http://dlang.org/phobos/std_utf.html#toUTF16
OK this one is:https://github.com/dlang/phobos/blob/v2.075.1/std/utf.d#L2760
(but this one is not in doc)
but this one should not be deprecated:
https://github.com/dlang/phobos/blob/v2.07
On Wednesday, 16 August 2017 at 12:58:25 UTC, Steven
Schveighoffer wrote:
Use cases don't matter. What matters is: is it proper for
Variant to call the postblit (as it does currently) without
regard for the qualifiers?
Looks like it isn't, https://dpaste.dzfl.pl/183e6dae9867 - shared
referenc
On 8/16/17 1:09 AM, apz28 wrote:
void main()
{
import std.utf : toUTF16; // Same problem with toUTF8
wstring s = toUTF16!string("abc");
}
Compilation output:
/d500/f513.d(3): Deprecation: function std.utf.toUTF16 is deprecated -
To be removed November 2017. Please use std.utf.encode
On 8/16/17 6:23 AM, Kagamin wrote:
On Tuesday, 15 August 2017 at 15:19:02 UTC, Steven Schveighoffer wrote:
However, I'm not sure about the postblit being called afterward. Does
a postblit need to be marked shared in order to work for shared types?
Ideally yes, but it's difficult to come up wit
MyStruct[] is actually a struct similar to this:
struct MyStruct[] {
MyStruct* ptr;
size_t length;
}
That struct is placed on the stack, but the data it points to,
via the ptr field, is heap allocated.
What is struct? Just name and size?
On Tuesday, 15 August 2017 at 15:19:02 UTC, Steven Schveighoffer
wrote:
However, I'm not sure about the postblit being called
afterward. Does a postblit need to be marked shared in order to
work for shared types?
Ideally yes, but it's difficult to come up with a good shared
postblit, send and
On Tuesday, 15 August 2017 at 21:27:49 UTC, Arek wrote:
Yes, but this doesn't compile:
import std.stdio;
import std.concurrency;
struct A
{
int t;
int r;
int method() shared
{
return 0;
}
}
void consumer()
{
shared a = receiveOnly
On Wednesday, 16 August 2017 at 07:39:01 UTC, Suliman wrote:
On the heap, unless you are allocating it via e.g. alloca.
If
struct MyStruct
{
int x;
int y;
}
MyStruct mystruct;
is located on stack, why:
MyStruct [] mystructs;
should located on heap?
MyStruct[] is actually a struct simila
On Wednesday, 16 August 2017 at 07:39:01 UTC, Suliman wrote:
On the heap, unless you are allocating it via e.g. alloca.
If
struct MyStruct
{
int x;
int y;
}
MyStruct mystruct;
is located on stack, why:
MyStruct [] mystructs;
should located on heap?
because in D
MyStruct [] mystructs;
On the heap, unless you are allocating it via e.g. alloca.
If
struct MyStruct
{
int x;
int y;
}
MyStruct mystruct;
is located on stack, why:
MyStruct [] mystructs;
should located on heap?
On 16/08/2017 8:14 AM, Suliman wrote:
On Wednesday, 16 August 2017 at 07:09:02 UTC, rikki cattermole wrote:
On 16/08/2017 8:06 AM, Suliman wrote:
If structures placing data on the stack why we do not getting
stackoveflow while we creating array of structures? Or for example
big structure.
Am
On Wednesday, 16 August 2017 at 07:09:02 UTC, rikki cattermole
wrote:
On 16/08/2017 8:06 AM, Suliman wrote:
If structures placing data on the stack why we do not getting
stackoveflow while we creating array of structures? Or for
example big structure.
Am I right understand that structures pla
If structures placing data on the stack why we do not getting
stackoveflow while we creating array of structures? Or for
example big structure.
Am I right understand that structures placing data _only_ on
stack? But the stack size is very limited (on Widnows it's just
1MB).
So how it's work
On 16/08/2017 8:06 AM, Suliman wrote:
If structures placing data on the stack why we do not getting
stackoveflow while we creating array of structures? Or for example big
structure.
Am I right understand that structures placing data _only_ on stack? But
the stack size is very limited (on Widn
34 matches
Mail list logo