Re: Status of Win32 C++ interop

2015-09-08 Thread Benjamin Thaut via Digitalmars-d-learn
On Monday, 7 September 2015 at 19:30:44 UTC, drug wrote: 07.09.2015 21:37, Benjamin Thaut пишет: snip So far I haven't found a situation where I couldn't make it work the way I wanted. Its just some work to write the D headers for the C++ classes and vise versa, because you have to

Re: What's the "right" way to do openmp-style parallelism?

2015-09-08 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 05:50:30 UTC, Russel Winder wrote: void main() { immutable imax = 10; immutable jmax = 10; float[imax][jmax] x; foreach(int j; 1..jmax){ foreach(int i, ref item; parallel(x[j-1])){ x[j][i] = complicatedFunction(i,

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Friday, 4 September 2015 at 03:31:40 UTC, Adam D. Ruppe wrote: On Friday, 4 September 2015 at 02:17:57 UTC, Joel wrote: In Mac OS, when typing with readln etc. I can't use the cursor keys. Works in Windows though. That's normal, line editing on Unix terminals is a kinda advanced library

Re: Regression?

2015-09-08 Thread FreeSlave via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote: Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ``` Why would you read file by line and then merge

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Ali Çehreli via Digitalmars-d-learn
On 09/08/2015 12:00 AM, drug wrote: import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { } It is probably because the type of floating point literals like 1.0 is double. Probably there is a 1.0 in iota's

Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread drug via Digitalmars-d-learn
import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { }

What is "FilterResult" type?

2015-09-08 Thread Bahman Movaqar via Digitalmars-d-learn
From what I can gather the output of `std.algorithm.iteration : filter` is a `FilterResult` type. I need a bit of help dealing with this type: 1. Why this type is there in the first place instead of simply using the type of input range? 2. Where is the documentation for this type? The

Re: What is "FilterResult" type?

2015-09-08 Thread cym13 via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 09:48:35 UTC, Bahman Movaqar wrote: From what I can gather the output of `std.algorithm.iteration : filter` is a `FilterResult` type. I need a bit of help dealing with this type: 1. Why this type is there in the first place instead of simply using the type of

Re: What is "FilterResult" type?

2015-09-08 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 11:08:59 UTC, Bahman Movaqar wrote: On Tuesday, 8 September 2015 at 10:08:03 UTC, cym13 wrote: Filter is a template and returns a FilterResult range which is used to lazily compute the result. This behaviour is the same for map and the majority of functions in

Re: Status of Win32 C++ interop

2015-09-08 Thread drug via Digitalmars-d-learn
On 08.09.2015 11:45, Benjamin Thaut wrote: On Monday, 7 September 2015 at 19:30:44 UTC, drug wrote: 07.09.2015 21:37, Benjamin Thaut пишет: snip So far I haven't found a situation where I couldn't make it work the way I wanted. Its just some work to write the D headers for the C++ classes

Re: What is "FilterResult" type?

2015-09-08 Thread Bahman Movaqar via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 10:08:03 UTC, cym13 wrote: Filter is a template and returns a FilterResult range which is used to lazily compute the result. This behaviour is the same for map and the majority of functions in std.algorithm. Ah...now it makes sense why use a proxy to the

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 07:17:01 UTC, Ali Çehreli wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/range/package.d#L4630 auto iota(B, E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E))) { return iota(begin, end, 1.0); } Such kind of stuff would

Re: Regression?

2015-09-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 08, 2015 07:12:50 FreeSlave via Digitalmars-d-learn wrote: > On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe > wrote: > > Fixed it by changing into: > > > > ``` > > import std.conv : text; > > string json = > >

Re: Concurency wtf?

2015-09-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/8/15 2:54 PM, Prudence wrote: I can't seem to receive certain messages, my code is very simple and it all works except for receiving: in one thread I do locate("MyMonitor").send(cast(shared)pt); You are casting to shared here. which sends the message(pt is a windows POINT

Re: Is D suitable for my latest project?

2015-09-08 Thread chris stevens via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static if(otherCondition) return new That; etc). I just had a look at

Re: Implicit conversion with ctor like C++

2015-09-08 Thread Pierre via Digitalmars-d-learn
I made a mistake it's more like: //Sample class class CClass { this(string MyValue){...} } //Called function void MyFunction(CClass MyClass){} void main() { MyFunction("Hello World!"); //Failed : MyFunction not callable... }

Re: Implicit conversion with ctor like C++

2015-09-08 Thread Meta via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:23:47 UTC, Pierre wrote: Hi everybody, I would like to use implicit conversion like this: //Sample class class MyClass { this(string MyValue){...} } //Called function void MyFunction(Foo MyFoo){} void main() { MyFunction("Hello World!"); //Failed :

Re: Implicit conversion with ctor like C++

2015-09-08 Thread Pierre via Digitalmars-d-learn
OK that's very clear thank you for the answer.

Re: What is "FilterResult" type?

2015-09-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 08, 2015 11:08:57 Bahman Movaqar via Digitalmars-d-learn wrote: > However, I have made this a strict practice of mine to specify > the full signature of my public API. If your API returns ranges, that's general not only bad practice but arguably impossible. Most range-based

Concurency wtf?

2015-09-08 Thread Prudence via Digitalmars-d-learn
I can't seem to receive certain messages, my code is very simple and it all works except for receiving: in one thread I do locate("MyMonitor").send(cast(shared)pt); which sends the message(pt is a windows POINT structure). In the MyMonitor spawned thread, I have while

Re: What is "FilterResult" type?

2015-09-08 Thread Meta via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 11:08:59 UTC, Bahman Movaqar wrote: However, I have made this a strict practice of mine to specify the full signature of my public API. I suppose, if I want to be pedantic, I have to realise the lazy value first and pass the resulting array out. Is this

Implicit conversion with ctor like C++

2015-09-08 Thread Pierre via Digitalmars-d-learn
Hi everybody, I would like to use implicit conversion like this: //Sample class class MyClass { this(string MyValue){...} } //Called function void MyFunction(Foo MyFoo){} void main() { MyFunction("Hello World!"); //Failed : MyFunction not callable... } I saw in forum this is OK

Re: Is D suitable for my latest project?

2015-09-08 Thread chris stevens via Digitalmars-d-learn
On Monday, 7 September 2015 at 07:57:07 UTC, Kagamin wrote: On Sunday, 6 September 2015 at 15:15:03 UTC, chris stevens wrote: I guess you're right it wouldn't be too difficult to do it all using strings. The code generation I'd done before in c# I'd used some 3rd person library where you build

Re: Is D suitable for my latest project?

2015-09-08 Thread BBasile via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Is D suitable for my latest project?

2015-09-08 Thread wobbles via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Status of Win32 C++ interop

2015-09-08 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 12:56:00 UTC, Laeeth Isharc wrote: How does it work when external APIs expect objects from the C++ standard library? strings, and so on? How about funny pointer types? shared_ptr etc? std::vector, std::list? No, in current state nothing smart is supported.

Re: OSX prompt limit

2015-09-08 Thread via Digitalmars-d-learn
Or just take it from the man page: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Meta via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 12:28:07 UTC, Dominikus Dittes Scherkl wrote: On Tuesday, 8 September 2015 at 07:17:01 UTC, Ali Çehreli wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/range/package.d#L4630 auto iota(B, E)(B begin, E end) if

Re: OSX prompt limit

2015-09-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/8/15 9:20 AM, Adam D. Ruppe wrote: On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote: Or just take it from the man page: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html ah excellent. My web search came up with

Re: Why 1f.iota(100f).array returns double[] not float[]?

2015-09-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/8/15 3:17 AM, Ali Çehreli wrote: On 09/08/2015 12:00 AM, drug wrote: import std.array : array; import std.range : iota; pragma(msg, typeof(iota(1f, 100f).array)); // why double[] not float[]? void main() { } It is probably because the type of floating point literals like 1.0 is double.

Re: OSX prompt limit

2015-09-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote: Or just take it from the man page: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html ah excellent. My web search came up with

Re: Status of Win32 C++ interop

2015-09-08 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 7 September 2015 at 18:37:49 UTC, Benjamin Thaut wrote: On Friday, 4 September 2015 at 16:19:49 UTC, Laeeth Isharc wrote: Hi Benjamin Would you be able to give a little more colour on what the limits are of interoperability for C++ with DMD master or release ? As I understand it

Re: OSX prompt limit

2015-09-08 Thread via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 13:02:35 UTC, Adam D. Ruppe wrote: On Tuesday, 8 September 2015 at 06:24:12 UTC, Joel wrote: arsd/terminal.d(1268): Error: undefined identifier 'SIGWINCH' There's a missing value in the signal header for OSX ! Could you run this little C program for me on

Re: How to partially forward properties of struct array member to struct (disable length property) ?

2015-09-08 Thread Kenji Hara via Digitalmars-d-learn
On Sunday, 6 September 2015 at 10:12:58 UTC, ParticlePeter wrote: In the end all that I want is "just" to disable access to array.length through vector and alias this array. struct Vec(T, size_t n = 3) { T[n] data; alias data this; @disable @property size_t length() const; }

Re: Are there any Phobos functions to check file permissions on Windows and Posix?

2015-09-08 Thread Jay Norwood via Digitalmars-d-learn
On Monday, 7 September 2015 at 15:48:56 UTC, BBasile wrote: On Sunday, 6 September 2015 at 23:05:29 UTC, Jonathan M Davis For example you can retieve the flags: archive/readonly/hidden/system/indexable(?) and even if it looks writable or readable, the file won't be open at all because the ACL

Win32 function vs delegate issues with api

2015-09-08 Thread Prudence via Digitalmars-d-learn
I have hook = SetWindowsHookEx(WH_MOUSE, , NULL, ThreadID); Proc is the standard hook proc: public extern (Windows) LRESULT Proc(int code, WPARAM wParam, LPARAM lParam) I get a type mismatch because Proc is a delegate and SetWindowsHookEx expects a function. Making proc static works but

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 13:20:20 UTC, Adam D. Ruppe wrote: On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote: Or just take it from the man page: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html ah excellent. My

Re: OSX prompt limit

2015-09-08 Thread via Digitalmars-d-learn
On Wed, Sep 09, 2015 at 12:05:52AM +, Joel via Digitalmars-d-learn wrote: > Now I get the error: What is your code calling the function? The prompt might just be too long.

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 00:44:57 UTC, via Digitalmars-d-learn wrote: On Wed, Sep 09, 2015 at 12:05:52AM +, Joel via Digitalmars-d-learn wrote: Now I get the error: What is your code calling the function? The prompt might just be too long. import terminal; void main() {

Re: Regression?

2015-09-08 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 07:12:52 UTC, FreeSlave wrote: On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote: Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls =

Re: Win32 function vs delegate issues with api

2015-09-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 09/09/15 12:18 PM, Prudence wrote: I have hook = SetWindowsHookEx(WH_MOUSE, , NULL, ThreadID); Proc is the standard hook proc: public extern (Windows) LRESULT Proc(int code, WPARAM wParam, LPARAM lParam) I get a type mismatch because Proc is a delegate and SetWindowsHookEx expects a

Re: Are there any Phobos functions to check file permissions on Windows and Posix?

2015-09-08 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 September 2015 at 15:48:56 UTC, BBasile wrote: On Sunday, 6 September 2015 at 23:05:29 UTC, Jonathan M Davis wrote: [...] which makes treating some of this stuff in a cross-platform fashion quite difficult. And even more with ACLs that it could be: Not to mention, Windows locks

Re: OSX prompt limit

2015-09-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 06:24:12 UTC, Joel wrote: arsd/terminal.d(1268): Error: undefined identifier 'SIGWINCH' There's a missing value in the signal header for OSX ! Could you run this little C program for me on your Mac and let me know the output? --- #include #include int

Re: spawn X different workers & wait for results from all of them

2015-09-08 Thread Justin Whear via Digitalmars-d-learn
On Sat, 05 Sep 2015 12:21:33 +0200, Robert M. Münch wrote: > My "pieceOfWork" is not the same. So I don't have the case: Do 4 time > this 1thing. Instead, do 1 time these 4 things. Ah, so you want to receive one each of various types? Something like this might work (untested): //

Re: Windows Header consts

2015-09-08 Thread NX via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 17:22:44 UTC, NX wrote: I have figure out typo: ...I had to figure out...

Re: Windows Header consts

2015-09-08 Thread NX via Digitalmars-d-learn
On Monday, 7 September 2015 at 19:06:48 UTC, Prudence wrote: It's called encapsulation. Do you have any idea how much I struggled when I try to use enums in OpenTK library because they were "encapsulated" ? Whenever I read OpenGL tutorials I have figure out which enum-name they used as

Re: What is "FilterResult" type?

2015-09-08 Thread cym13 via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 11:08:59 UTC, Bahman Movaqar wrote: However, I have made this a strict practice of mine to specify the full signature of my public API. I suppose, if I want to be pedantic, I have to realise the lazy value first and pass the resulting array out. Is this