Re: No tempFile() in std.file

2017-05-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 05:09:12 UTC, Era Scarecrow wrote: On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: Personally, I think that it would be very much worth making hello world larger, since hello world really doesn't matter, but because there are plenty of folks checking o

Atomicity of file-copying/moving

2017-05-16 Thread Nordlöw via Digitalmars-d-learn
What's the status of atomicity of file-copying and -moving (renaming) using std.file on different platforms?

Re: No tempFile() in std.file

2017-05-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-05-16 09:39, Anonymouse wrote: Linker --gc-sections IIRC that only works with LDC. With DMD it's possible that it removes sections that are used but not directly referenced. -- /Jacob Carlborg

Re: Atomicity of file-copying/moving

2017-05-16 Thread FreeSlave via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 08:32:56 UTC, Nordlöw wrote: What's the status of atomicity of file-copying and -moving (renaming) using std.file on different platforms? Not sure about renaming but copying is not atomic on Posix because it does not handle interruption by signal. I opened issue abo

Re: No tempFile() in std.file

2017-05-16 Thread bachmeier via Digitalmars-d-learn
On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: I suppose that we could add a tempFile that did what std.stdio.File.scratchFile did but create an empty file and return its path rather than returning a File, though that would be a bit annoying, since you'd then have to open it to

Re: No tempFile() in std.file

2017-05-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote: > On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: > > I suppose that we could add a tempFile that did what > > std.stdio.File.scratchFile did but create an empty file and > > return its path rather than retur

Re: No tempFile() in std.file

2017-05-16 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 13:56:57 UTC, Jonathan M Davis wrote: std.file doesn't have anything to do with File. It only operates on entire files at a time, so it wouldn't make sense for a function in std.file to return a std.stdio.File. At most what would make sense to me would be to have a f

Re: No tempFile() in std.file

2017-05-16 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, May 16, 2017 at 06:56:57AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote: > > On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: > > > I suppose that we could add a tempFile that did what > >

[issue std.regex] Fail to match with negative look-ahead assertion when tracking down on a delimiter

2017-05-16 Thread k-five via Digitalmars-d-learn
Although I wanted to post this context at: https://issues.dlang.org/ but even I registered at,I could not login to. -- As long as I know a little about RegExp, the two below patterns are the same: [ 1 ]: ^(?:[ab]|ab)(.)(?:(?!\1).)+\1$ [ 2 ]: ^(?:ab|[a

Re: No tempFile() in std.file

2017-05-16 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, May 16, 2017 at 08:06:13AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, May 16, 2017 at 06:56:57AM -0700, Jonathan M Davis via > Digitalmars-d-learn wrote: > > On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote: > > > On Monday, 15 May 2017 at 22:38:15

Re: No tempFile() in std.file

2017-05-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 16, 2017 08:06:13 H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, May 16, 2017 at 06:56:57AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote: > > > On Monday, 15 May 2017 at 22:38:15 UTC, Jona

Cheetah: Keeping track of multiple connected clients

2017-05-16 Thread aberba via Digitalmars-d-learn
Does anyone know how to keep track of multiple clients in Cheetah socket lib such that one can directly message a client or broadcast to all connected clients. Something like: onMessage(... e) { ... // send to all e.clients.broadcast (message); ...OR... // target a client e.clie

Re: Cheetah: Keeping track of multiple connected clients

2017-05-16 Thread bauss via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 16:01:49 UTC, aberba wrote: Does anyone know how to keep track of multiple clients in Cheetah socket lib such that one can directly message a client or broadcast to all connected clients. Something like: onMessage(... e) { ... // send to all e.clients.broadca

Re: Cheetah: Keeping track of multiple connected clients

2017-05-16 Thread aberba via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 17:49:07 UTC, bauss wrote: On Tuesday, 16 May 2017 at 16:01:49 UTC, aberba wrote: Does anyone know how to keep track of multiple clients in Cheetah socket lib such that one can directly message a client or broadcast to all connected clients. Something like: onMess

Re: Cheetah: Keeping track of multiple connected clients

2017-05-16 Thread aberba via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 21:56:16 UTC, aberba wrote: On Tuesday, 16 May 2017 at 17:49:07 UTC, bauss wrote: [...] It really awesome the way you responded quickly. About targeting a client, suppose I have clients A, B, and C. Message can be broadcast to all using above solution. But in cas

D equivalent of C++11's function local static initialization?

2017-05-16 Thread Timothee Cour via Digitalmars-d-learn
what's the best D equivalent of C++11's function local static initialization? ``` void fun(){ static auto a=[](){ //some code return some_var; } } ``` (C++11 guarantees thread safety)

Re: D equivalent of C++11's function local static initialization?

2017-05-16 Thread Timothee Cour via Digitalmars-d-learn
NOTE: curious about both cases: * thread local * shared On Tue, May 16, 2017 at 8:04 PM, Timothee Cour wrote: > what's the best D equivalent of C++11's function local static initialization? > ``` > void fun(){ > static auto a=[](){ > //some code >return some_var; > } > } > ``` > > (C+

Re: Equivalent to nullptr

2017-05-16 Thread Leonardo via Digitalmars-d-learn
On Thursday, 4 May 2017 at 04:34:40 UTC, Stanislav Blinov wrote: In the meantime, you can get around the issue by redeclaring the function with another name and loading it manually just after calling DerelictSDL2.load(): import derelict.sdl2.sdl; __gshared SDL_bool function (const(SDL_Point)

Re: No tempFile() in std.file

2017-05-16 Thread Patrick Schluter via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 13:56:57 UTC, Jonathan M Davis wrote: On Tuesday, May 16, 2017 11:19:14 bachmeier via Digitalmars-d-learn wrote: On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: > [...] That seems perfectly reasonable to me. Couldn't the function return both the path

Re: No tempFile() in std.file

2017-05-16 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 05:30:40 UTC, Patrick Schluter wrote: On Tuesday, 16 May 2017 at 13:56:57 UTC, Jonathan M Davis wrote: [...] As your solution doesn't inherently solve the race condition associated with temporary files, you could still generate the name with a wrapper around temp