Re: struct: default construction or lazy initialization.

2017-02-01 Thread kinke via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 23:32:12 UTC, bitwise wrote: On Wednesday, 1 February 2017 at 23:24:27 UTC, kinke wrote: It's not that bad. D just doesn't support a default ctor for structs at all and simply initializes each instance with T.init. Your `s2` initialization is most likely seen

Re: struct: default construction or lazy initialization.

2017-02-01 Thread bitwise via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 23:24:27 UTC, kinke wrote: It's not that bad. D just doesn't support a default ctor for structs at all and simply initializes each instance with T.init. Your `s2` initialization is most likely seen as explicit default initialization (again with T.init).

Re: struct: default construction or lazy initialization.

2017-02-01 Thread kinke via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 23:02:11 UTC, bitwise wrote: On Wednesday, 1 February 2017 at 01:52:40 UTC, Adam D. Ruppe wrote: 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 =

Re: struct: default construction or lazy initialization.

2017-02-01 Thread bitwise via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 01:52:40 UTC, Adam D. Ruppe wrote: 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

dep files

2017-02-01 Thread Satoshi via Digitalmars-d-learn
Hi, I'm using package.d file for the project, where is each file imported. In each file is imported only that one package file (like `import Foo;`). Problem is with .dep files. dep file for each source file contains all source files of the project just because it imports that package.

Re: std.system reports win32 when running OS X

2017-02-01 Thread Ali Çehreli via Digitalmars-d-learn
On 02/01/2017 01:34 PM, Dave Chapman wrote: I am running an iMac with OS X 10.11.5 (El Capitan) and dmd version 2.072.2 The following program prints out OS = win32. Is this the intended behavior? #!/usr/local/bin/rdmd import std.stdio; import std.system; void main (string[] args) {

std.system reports win32 when running OS X

2017-02-01 Thread Dave Chapman via Digitalmars-d-learn
I am running an iMac with OS X 10.11.5 (El Capitan) and dmd version 2.072.2 The following program prints out OS = win32. Is this the intended behavior? #!/usr/local/bin/rdmd import std.stdio; import std.system; void main (string[] args) { immutable OS os; writefln("OS = %s",os); }

How to Exec Store Procedure For MySql in D? Thanks

2017-02-01 Thread FrankLike via Digitalmars-d-learn
Hi,everyone: Now,I find that I can't exec Store Procedure For MySql in D. use mySql-d,mySql-native,or ddbc. I want to get a SqlResult. I think that it's the time to fix the bug! Who can help me? Thank you! Frank

Re: Does vibe.d support setting cookies?

2017-02-01 Thread Jack Applegame via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 14:09:41 UTC, aberba wrote: I can't find it. Like set_cookie() in php. Yes, it does. http://vibed.org/api/vibe.http.common/HTTPResponse.cookies

Re: Does vibe.d support setting cookies?

2017-02-01 Thread Daniel Kozák via Digitalmars-d-learn
V Wed, 01 Feb 2017 14:09:41 + aberba via Digitalmars-d-learn napsáno: > I can't find it. Like set_cookie() in php. maybe this http://vibed.org/api/vibe.http.server/HTTPServerResponse.setCookie

Re: Does vibe.d support setting cookies?

2017-02-01 Thread Daniel Kozák via Digitalmars-d-learn
V Wed, 01 Feb 2017 14:09:41 + aberba via Digitalmars-d-learn napsáno: > I can't find it. Like set_cookie() in php. I am not sure but I use this in one of my projects import vibe.http.client; auto clientOCX = new RestInterfaceClient!I(host ~

Re: capture stdout or stderr

2017-02-01 Thread angel via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 01:08:19 UTC, Emil wrote: 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

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 11:39:46 UTC, Suliman wrote: Full error log: 0x00580A4D in @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint) 0x00412AB6 in @safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint)

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread aberba via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 11:55:20 UTC, Suliman wrote: On Wednesday, 1 February 2017 at 11:39:46 UTC, Suliman wrote: [...] Yeah, it was issue in dini 2. dini 1 work fine. Is std.file not blocking (when used in vibe.d)?

Does vibe.d support setting cookies?

2017-02-01 Thread aberba via Digitalmars-d-learn
I can't find it. Like set_cookie() in php.

Re: Convert struct to set of fields and pass it's to constructor

2017-02-01 Thread Suliman via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 13:51:28 UTC, Minty Fresh wrote: On Wednesday, 1 February 2017 at 13:37:27 UTC, Suliman wrote: Class constructor accept only set if fields like this(string login, string pass) Can I create structure, fill it, and than pass to constructor? Like this: ``` import

Re: Convert struct to set of fields and pass it's to constructor

2017-02-01 Thread Minty Fresh via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 13:37:27 UTC, Suliman wrote: Class constructor accept only set if fields like this(string login, string pass) Can I create structure, fill it, and than pass to constructor? Like this: ``` import std.stdio; struct ConnectSettings { string login;

Convert struct to set of fields and pass it's to constructor

2017-02-01 Thread Suliman via Digitalmars-d-learn
Class constructor accept only set if fields like this(string login, string pass) Can I create structure, fill it, and than pass to constructor? Like this: ``` import std.stdio; struct ConnectSettings { string login; string pass; }; ConnectSettings cs; void main() { cs.login =

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Suliman via Digitalmars-d-learn
Not even issue, but unhandled exception when access to nonexistent file.

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Suliman via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 11:39:46 UTC, Suliman wrote: Full error log: 0x00580A4D in @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint) 0x00412AB6 in @safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint)

Re: Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Suliman via Digitalmars-d-learn
Full error log: 0x00580A4D in @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint) 0x00412AB6 in @safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint) at C:\D\dmd2\windows\bin\..\..\src\phobos\std\file.d(229)

Can't find the reason of issue: "std.file.FileException@std\file.d(360): path/to/file.conf:"

2017-02-01 Thread Suliman via Digitalmars-d-learn
After building vibed project and running it I am getting error: "std.file.FileException@std\file.d(360): path/to/file.conf: Системе не удается найти указанный путь." (System can't find selected path) I even do not understand where is the error... It's do not seems that it's vibed issue.

Re: GC question

2017-02-01 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 09:50:42 UTC, osa1 wrote: Thanks for the answer. Could you elaborate on the lacklustre part? It's fine if I have to do manual memory management, but I don't want any leaks. Ideally I'd have a precise GC + RAII style resource management when needed. Rust, Go,

Re: GC question

2017-02-01 Thread osa1 via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 09:40:17 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 1 February 2017 at 06:58:43 UTC, osa1 wrote: I'm wondering what are the implications of the fact that current GC is a Boehm-style conservative GC rather than a precise one, I've never worked with a

Re: GC question

2017-02-01 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 06:58:43 UTC, osa1 wrote: I'm wondering what are the implications of the fact that current GC is a Boehm-style conservative GC rather than a precise one, I've never worked with a conservative GC before. The GC isn't competitive with the ones you find in GC