Re: Sending an immutable object to a thread

2015-07-19 Thread Ali Çehreli via Digitalmars-d-learn
It is a pitty that although Variant is the default message type in concurrency, it still has issues: https://issues.dlang.org/buglist.cgi?quicksearch=variant%20concurrency&list_id=202195 It looks like passing a pointer to an immutable(Message) works as well: import std.stdio; import std.concu

static opCall not working?

2015-07-19 Thread TC via Digitalmars-d-learn
I tested the code from: http://dlang.org/struct.html Section: Dynamic Initialization of Structs struct S { int a; static S opCall(int v) { S s; s.a = v; return s; } static S opCall(S v) { S s; s.a = v.a + 1; return s;

Can't use toHexString

2015-07-19 Thread badlink via Digitalmars-d-learn
Hello, I get different results if I either use toHexString or crcHexString. I can't explain this behavior because crcHexString is just an alias of toHexString... Test code: http://pastebin.com/33Ye7yyJ

Re: Can't use toHexString

2015-07-19 Thread Kagamin via Digitalmars-d-learn
http://forum.dlang.org/post/ydaeytbyxdnwlbpwk...@forum.dlang.org

Re: Can't use toHexString

2015-07-19 Thread badlink via Digitalmars-d-learn
On Sunday, 19 July 2015 at 12:00:23 UTC, Kagamin wrote: http://forum.dlang.org/post/ydaeytbyxdnwlbpwk...@forum.dlang.org Argh... must use the search function first... If I understand correctly in my case toHexString is returning a static char[len]. But why it gets silently converted to an im

Re: Can't use toHexString

2015-07-19 Thread Adam D. Ruppe via Digitalmars-d-learn
This line is illegal: return toHexString!(Order.decreasing)(crc.finish()); The std.digest.toHexString and variants return a *static array* which is static data and has a scope lifetime. It is horrendous a compiler bug that allows it to implicitly convert to string - it should not compile b

Re: Can't use toHexString

2015-07-19 Thread badlink via Digitalmars-d-learn
On Sunday, 19 July 2015 at 12:08:18 UTC, Adam D. Ruppe wrote: This line is illegal: return toHexString!(Order.decreasing)(crc.finish()); The std.digest.toHexString and variants return a *static array* which is static data and has a scope lifetime. It is horrendous a compiler bug that allow

static-if cant compile

2015-07-19 Thread Clayton via Digitalmars-d-learn
Pardon me for trivial question, Am new to D. Why would a statement as below fail to compile. The plan is to do some computation at compile-time hence considering the static-if statement which fails to compile. The regular if-statement compiles but is not useful since it is a runtime construc

Re: static-if cant compile

2015-07-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 19 July 2015 at 12:17:04 UTC, Clayton wrote: Pardon me for trivial question, Am new to D. In D, you can run regular runtime code at compile time in a lot of cases. Just write an ordinary function that returns the data you need, then use it in a static variable initialization. //

Re: static-if cant compile

2015-07-19 Thread Rikki Cattermole via Digitalmars-d-learn
On 20/07/2015 12:17 a.m., Clayton wrote: Pardon me for trivial question, Am new to D. Why would a statement as below fail to compile. The plan is to do some computation at compile-time hence considering the static-if statement which fails to compile. The regular if-statement compiles but is no

Customization of User Defined Logger

2015-07-19 Thread Suliman via Digitalmars-d-learn
When I try co compile next code: class MyCustomLogger : Logger { this(string newName, LogLevel lv) @safe { super(newName, lv); } override void writeLogMsg(ref LogEntry payload) { // log message in my custom way } } auto logger = new MyCustomLogger(); logg

Re: static opCall not working?

2015-07-19 Thread Ali Çehreli via Digitalmars-d-learn
On 07/19/2015 03:26 AM, TC wrote: I tested the code from: http://dlang.org/struct.html Section: Dynamic Initialization of Structs struct S { int a; static S opCall(int v) { S s; s.a = v; return s; } static S opCall(S v) { S s;

Re: Can't use toHexString

2015-07-19 Thread Johannes Pfau via Digitalmars-d-learn
Am Sun, 19 Jul 2015 12:08:16 + schrieb "Adam D. Ruppe" : > This line is illegal: > > > return toHexString!(Order.decreasing)(crc.finish()); > > The std.digest.toHexString and variants return a *static array* > which is static data and has a scope lifetime. > > It is horrendous a compiler b

Re: Using executeShell in multiple thread causes access violation error

2015-07-19 Thread ketmar via Digitalmars-d-learn
On Fri, 17 Jul 2015 22:53:55 +, Minas Mina wrote: > bump sorry, i was wrong about GC non-calling. yet we still need more info: how long it works before crashing, how much threads it runs, how many "git clone" commands were ok before crach, what DMD version are you using, and *full* source

Re: Sending an immutable object to a thread

2015-07-19 Thread Frank Pagliughi via Digitalmars-d-learn
It looks like passing a pointer to an immutable(Message) works as well: Oh, yes, pointer. Ha! I didn't even think of that. Thanks. I'm not familiar with how garbage collection works in D. If the initial reference goes out of scope, and you just have a pointer - in another thread, no less - th

What is the std.stream replacement?

2015-07-19 Thread Charles Hixson via Digitalmars-d-learn
I have DMD64 D Compiler v2.067.1 installed, and in the documentation of phobos what it says about std.stream is "don't use it on new code". It doesn't, however, appear to offer any replacement. Certainly std.file, std.stdio, and std.path aren't replacements. So what *is* the appropriate repla

Re: Sending an immutable object to a thread

2015-07-19 Thread rsw0x via Digitalmars-d-learn
On Sunday, 19 July 2015 at 17:04:07 UTC, Frank Pagliughi wrote: [...] Oh, yes, pointer. Ha! I didn't even think of that. Thanks. I'm not familiar with how garbage collection works in D. If the initial reference goes out of scope, and you just have a pointer - in another thread, no less - the

Re: Replacement of std.stream

2015-07-19 Thread Charles Hixson via Digitalmars-d-learn
On Monday, 29 June 2015 at 12:00:14 UTC, Jonathan M Davis wrote: On Sunday, June 28, 2015 11:14:57 Baz via Digitalmars-d-learn wrote: On Sunday, 28 June 2015 at 05:04:48 UTC, DlangLearner wrote: > I will convert a Java program into D. The original Java code > is based on the class RandomeAccess

Re: Customization of User Defined Logger

2015-07-19 Thread Ali Çehreli via Digitalmars-d-learn
On 07/19/2015 06:02 AM, Suliman wrote: > When I try co compile next code: > > class MyCustomLogger : Logger > { > this(string newName, LogLevel lv) @safe > { > super(newName, lv); According to (and despite :p) its documentation Logger's constructor takes just a LogLevel:

Re: Dangular - D Rest server + Angular frontend

2015-07-19 Thread David DeWitt via Digitalmars-d-learn
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal wrote: Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. [...] Nice. I was thinking about doing one up in React but h

Re: Dangular - D Rest server + Angular frontend

2015-07-19 Thread Etienne Cimon via Digitalmars-d-learn
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal wrote: Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. Nice ! I'm also working on a project like this, using some pai

Dangular - D Rest server + Angular frontend

2015-07-19 Thread via Digitalmars-d-learn
Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. I have been thinking about the possibility of embedding D code in diet templates, as for ex to set api urls. Right now the urls are

Re: exclude current directory from search path in dmd ?

2015-07-19 Thread Timothee Cour via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=14811 On Wed, Jun 17, 2015 at 3:22 AM, Liran Zvibel via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 8 June 2015 at 04:08:55 UTC, Adam D. Ruppe wrote: > >> The easiest way is to not use search paths, and instead pass all the

Re: exclude current directory from search path in dmd ?

2015-07-19 Thread Timothee Cour via Digitalmars-d-learn
I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this in official dmd? On Sun, Jul 19, 2015 at 8:07 PM, Timothee Cour w

Re: What is the std.stream replacement?

2015-07-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 19, 2015 09:56:11 Charles Hixson via Digitalmars-d-learn wrote: > I have DMD64 D Compiler v2.067.1 installed, and in the documentation of > phobos what it says about std.stream is "don't use it on new code". It > doesn't, however, appear to offer any replacement. Certainly std.file

Re: exclude current directory from search path in dmd ?

2015-07-19 Thread ZombineDev via Digitalmars-d-learn
On Monday, 20 July 2015 at 03:33:08 UTC, Timothee Cour wrote: I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this in