TypeInfo_Class.interfaces has TypeInfo_Class and not TypeInfo_Interface?

2017-12-14 Thread Tofu Ninja via Digitalmars-d-learn
TypeInfo_Class.interfaces has TypeInfo_Class and not TypeInfo_Interface? Is this correct? Or is it a bug? Doesn't make much sense to me.

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 15 December 2017 at 02:08:12 UTC, Nicholas Wilson wrote: See also https://github.com/d-gamedev-team/gfm/tree/master/integers/gfm/integers Thanks

What is a robust implementation of a file mutex? Mine is sucking...

2017-12-14 Thread Enjoys Math via Digitalmars-d-learn
I share data between two programs. Programs on side A output .bin files full of doubles like around 19KB each. And there can be between 30 - 100 of these bin files. I have a thread for each file on the B side, which first checks the existence of filename__MUTEX.txt. If it exist, then a

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 15 December 2017 at 01:17:17 UTC, Jack Stouffer wrote: On Thursday, 14 December 2017 at 23:33:34 UTC, Nicholas Wilson wrote: On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? Not really as a plain

Re: High-resolution thread sleep

2017-12-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/14/17 6:45 PM, Ivan Trombley wrote: On Thursday, 14 December 2017 at 21:47:05 UTC, Rene Zwanenburg wrote: On Thursday, 14 December 2017 at 21:11:34 UTC, Ivan Trombley wrote: I need to be able to put a thread to sleep for some amount of time. I was looking at using Thread.sleep but it

Re: Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/14/17 5:56 PM, aliak wrote: On Thursday, 14 December 2017 at 16:38:26 UTC, Steven Schveighoffer wrote: b) if the above actually does compile for you, what is the minimal code that does not? Yes of course, here's a minimal program that does not compile for me:   import std.stdio,

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 14 December 2017 at 23:33:34 UTC, Nicholas Wilson wrote: On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? Not really as a plain type, although there is effort to get [u]cent working. I could have

Re: High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
On Friday, 15 December 2017 at 00:39:13 UTC, Rene Zwanenburg wrote: On Thursday, 14 December 2017 at 23:45:18 UTC, Ivan Trombley wrote: Something along the lines of this: while (render) { immutable auto startTime = MonoTime.currTime; // Render the frame... immutable auto remain =

Re: High-resolution thread sleep

2017-12-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 14 December 2017 at 23:45:18 UTC, Ivan Trombley wrote: Something along the lines of this: while (render) { immutable auto startTime = MonoTime.currTime; // Render the frame... immutable auto remain = m_frameDuration - (startTime - MonoTime.currTime); if (remain >

Re: High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
On Thursday, 14 December 2017 at 21:47:05 UTC, Rene Zwanenburg wrote: On Thursday, 14 December 2017 at 21:11:34 UTC, Ivan Trombley wrote: I need to be able to put a thread to sleep for some amount of time. I was looking at using Thread.sleep but it appears that on Windows, it's limited to

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? There has been some work on this a while ago, by Kai, but it hasn't been merged yet: https://github.com/ldc-developers/ldc/pull/1355 — David

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? Not really as a plain type, although there is effort to get [u]cent working. I could have sworn that mir was using InlineIR with it for multiplication. But

Re: Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-14 Thread aliak via Digitalmars-d-learn
On Thursday, 14 December 2017 at 16:38:26 UTC, Steven Schveighoffer wrote: So enumerate returns as its element type a Tuple. Specifically, it's going to be a Tuple!(size_t, int), since you are enumerating an array of ints. I'm not sure why you are having the error, compiling your code above

overload

2017-12-14 Thread dark777 via Digitalmars-d-learn
I know that this community is not from c ++, but for some time I studied how to do overload of ostream operators in c ++ and I even managed to get to this result, I got to this result in another post done here but I did not understand the that it returns this error below: bin2.cxx:44:43:

Re: High-resolution thread sleep

2017-12-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 14 December 2017 at 21:11:34 UTC, Ivan Trombley wrote: I need to be able to put a thread to sleep for some amount of time. I was looking at using Thread.sleep but it appears that on Windows, it's limited to millisecond resolution. Is there a way to do this in a cross-platform way

High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
I need to be able to put a thread to sleep for some amount of time. I was looking at using Thread.sleep but it appears that on Windows, it's limited to millisecond resolution. Is there a way to do this in a cross-platform way that is higher resolution?

Re: Global variable type does not match previous declaration

2017-12-14 Thread Satoshi via Digitalmars-d-learn
On Thursday, 14 December 2017 at 12:18:22 UTC, Nicholas Wilson wrote: On Wednesday, 13 December 2017 at 21:39:40 UTC, Satoshi wrote: On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote: [...] Compiling with ldc2 -debuglib= -defaultlib= -code-model=kernel -disable-red-zone -w -wi

Re: GUI program on Mac OS in D?

2017-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-14 20:06, mrphobby wrote: Ok, I see! Sounds like I'll have to wait then. How long do you think it will take until DIP43 is available for use? Is it months or years we are talking about here? It will take more than months to have the complete set of features of DIP43 available,

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-14 Thread Ali Çehreli via Digitalmars-d-learn
On 12/14/2017 11:55 AM, Unazed Spectaculum wrote: This is the only function which has a call to `receiveAll` I marked my changes with [Ali]: import std.stdio; import std.socket; import std.conv; import std.json; ubyte[] receiveBytes(T)(T socket, size_t receiveCount) { ubyte[] buffer =

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-14 Thread Unazed Spectaculum via Digitalmars-d-learn
On Thursday, 14 December 2017 at 00:09:39 UTC, Ali Çehreli wrote: On 12/13/2017 11:39 AM, Unazed Spectaculum wrote: > ubyte[] receiveBytes(T)(T socket, size_t receiveCount) > { > ubyte[] buffer = new ubyte[receiveCount]; > size_t count = socket.receive(buffer); Don't trust code you

Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
Clang has __int128. Is there anyway to use this with D with LDC?

Re: GUI program on Mac OS in D?

2017-12-14 Thread mrphobby via Digitalmars-d-learn
On Thursday, 14 December 2017 at 14:07:25 UTC, Adam D. Ruppe wrote: I was playing with this myself based on Jacob's code and made it look like this: extern (Objective-C) interface ViewController : NSViewController { extern (C) @ObjCMethodOverride("loadView") static

Re: GUI program on Mac OS in D?

2017-12-14 Thread mrphobby via Digitalmars-d-learn
On Thursday, 14 December 2017 at 16:12:30 UTC, Jacob Carlborg wrote: No, that would not work. Several years ago I created an The bridge basically wrapped an Objective-C object inside a D object, resulted in two objects for each object instead of one. That bridge turned out to be a failure,

Re: weird exception on windows

2017-12-14 Thread Szabo Bogdan via Digitalmars-d-learn
On Thursday, 14 December 2017 at 14:47:25 UTC, Kagamin wrote: writeln(fileName); if (!fileName.exists) { return; } :) I'm not sure I understand this solution...

Re: How to statically link Derelict SDL2 satellite libs

2017-12-14 Thread eskaypeee via Digitalmars-d-learn
On Thursday, 14 December 2017 at 15:43:22 UTC, Mike Parker wrote: Should be: "libs" : [ "SDL2_image", "SDL2"] Thank you, it now works. I think I did try that but in lower case, which didn't work. I was following the example dub file on this page: http://derelictorg.github.io/packages/sdl2/

Re: Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/14/17 10:28 AM, aliak wrote: Then I get this error:   Error: couldn't find field __expand_field_0 of type ulong in Tuple(0LU, 117) 117 is the ascii code for 'u' btw, which happens to be the first character in my random input string. This error is coming from inside my day 10's

Re: GUI program on Mac OS in D?

2017-12-14 Thread Mengu via Digitalmars-d-learn
On Thursday, 14 December 2017 at 14:07:25 UTC, Adam D. Ruppe wrote: I was playing with this myself based on Jacob's code and made it look like this: extern (Objective-C) interface ViewController : NSViewController { extern (C) @ObjCMethodOverride("loadView") static

Re: GUI program on Mac OS in D?

2017-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-14 14:56, mrphobby wrote: Also, it feels a bit awkward to implement the callback handling methods as static methods, with the "self" and SEL arguments. Would have been nice if it was possible to use instance methods. That's currently not possible. The "self" and SEL arguments are

Re: Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-14 Thread aliak via Digitalmars-d-learn
On Thursday, 14 December 2017 at 15:28:22 UTC, aliak wrote: int[] rotate(int[] list, int[] lengths) { auto range = list.cycle; foreach (skip, length; lengths.enumerate) { // do stuff to range } return list; } Ok srsly, I got things to at least compile by changing the

Re: How to statically link Derelict SDL2 satellite libs

2017-12-14 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 14 December 2017 at 15:07:12 UTC, eskaypee wrote: On Thursday, 14 December 2017 at 14:45:51 UTC, Mike Parker wrote: Yes, you need to link with SDL_image. Sorry Mike, just noticed the end of my original question was missing: I have SDL_Image installed (dev version) but can't see

Halp! type system (__expand_field_0 error), compile time/runtime questions (AoC-2017 puzzle spoilers inside)

2017-12-14 Thread aliak via Digitalmars-d-learn
Warning: following has Advent of Code 2017 (day 14 and day 10) spoilers incase you are doing those challenges. And apologies for the slightly long post, I'm unsure how much information is needed here and am a bit clueless. Any help would be much appreciated. = Ok, so I'm trying to get

Re: How to statically link Derelict SDL2 satellite libs

2017-12-14 Thread eskaypee via Digitalmars-d-learn
On Thursday, 14 December 2017 at 14:45:51 UTC, Mike Parker wrote: Yes, you need to link with SDL_image. Sorry Mike, just noticed the end of my original question was missing: I have SDL_Image installed (dev version) but can't see how to refer/add it to the "libs" section (if that's how it

Re: weird exception on windows

2017-12-14 Thread Kagamin via Digitalmars-d-learn
writeln(fileName); if (!fileName.exists) { return; } :)

Re: How to statically link Derelict SDL2 satellite libs

2017-12-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 20:59:41 UTC, eskaypee wrote: I'm on Linux 64 bit, all SDL libraries (-dev versions) are installed, dub is set up with: "dependencies": { "derelict-sdl2": "~>3.0.0-beta" }, "subConfigurations": { "derelict-sdl2": "derelict-sdl2-static"

Now,“core.sys.windows.objidl:QueryInterface” that's not work? Thank.

2017-12-14 Thread Frank Like via Digitalmars-d-learn
Hi,everyone, I want to use "core.sys.windows.objidl:QueryInterface" to create ShortCut,but it's not work? how do you to do it? Thanks. Frank

weird exception on windows

2017-12-14 Thread Szabo Bogdan via Digitalmars-d-learn
Hi, I noticed that sometimes on windows this line of code crashes the test suites. https://github.com/gedaiu/fluent-asserts/blob/master/core/fluentasserts/core/results.d#L1072 This exception can be captured only with a debugger... is it a dmd bug? ``` Thread 25CC created, Entry:

Re: GUI program on Mac OS in D?

2017-12-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 14 December 2017 at 13:56:28 UTC, mrphobby wrote: After thinking about it for a while I guess it could work with one static dispatch method that maps selectors to specific instance methods. So when callbacks are made from Objective-C they are made to this one static method, which

Re: AssocArray to string is ok,but how to get the AssocArray from string? Thanks

2017-12-14 Thread Frank Like via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 21:18:19 UTC, Azi Hassan wrote: Serialization seems to be the answer. Unfortunately I could neither get it to work with Cereal nor with Orange. If all else fails, you could still attempt to manually parse it ot of its string representation (AATimes.to!string).

Re: AssocArray to string is ok,but how to get the AssocArray from string? Thanks

2017-12-14 Thread Frank Like via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 08:39:00 UTC, Nicholas Wilson wrote: Have a look at std.conv.parse I know it.But it's not work with DateTime or SysTime. Now,it's only work on string. But thank you.

Re: GUI program on Mac OS in D?

2017-12-14 Thread mrphobby via Digitalmars-d-learn
On Thursday, 14 December 2017 at 11:36:46 UTC, mrphobby wrote: I'm thinking it would be nice to wrap this setup code into some kind of mixin template so that I could put the required configuration setup in each class. In other languages like Python or C# I would maybe decorate my methods with

Re: Why is there no std.stream anymore?

2017-12-14 Thread Kagamin via Digitalmars-d-learn
On Monday, 11 December 2017 at 23:33:44 UTC, Seb wrote: --- void main(string[] args) { import std.conv, std.range, std.stdio; foreach (d; File(__FILE_FULL_PATH__).byChunk(4096).join.take(5)) { writefln("%s", d.to!char); } } --- A variant: https://run.dlang.io/is/2TUQBv

Re: Why is there no std.stream anymore?

2017-12-14 Thread Kagamin via Digitalmars-d-learn
Or this https://run.dlang.io/is/MO9Wiy

Re: Global variable type does not match previous declaration

2017-12-14 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote: What means this error and how to solve it? object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ Try to write typeinfo as is without mixin.

Re: Ddoc and struct members

2017-12-14 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 14 December 2017 at 03:17:10 UTC, rikki cattermole wrote: On 14/12/2017 3:16 AM, n00nb wrote: I don't understand if there is a way to generate documentation for all the members without putting a '///' over every member There isn't. It doesn’t need to take any vertical space

Re: Global variable type does not match previous declaration

2017-12-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 21:39:40 UTC, Satoshi wrote: On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote: What means this error and how to solve it? object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name:

Re: GUI program on Mac OS in D?

2017-12-14 Thread mrphobby via Digitalmars-d-learn
On Thursday, 14 December 2017 at 10:14:13 UTC, Jacob Carlborg wrote: That is to register the methods with the Objective-C runtime. Currently the @selector attribute can only be used on methods that are already implemented in Objective-C. If a need to implement a new method or override an

Re: Global variable type does not match previous declaration

2017-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-13 22:38, Satoshi wrote: What means this error and how to solve it? object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ Actually, I'm working on OS with minimal D runtime and I'm unable to

Re: GUI program on Mac OS in D?

2017-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-13 16:59, mrphobby wrote: I have another question about your Webkit test example... I see that you are doing some elaborate setup in order to bind the application delegate methods. Can you explain a bit about why you are doing it in this way instead of using the @selector attribute