Re: Initialise dynamic array in array of structures

2016-06-21 Thread Paul via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 19:33:31 UTC, cym13 wrote: ... but “trackTemplates[0].coords = [{0, 9}, {1, 1}, {3, 6}];” is an assignment so the compiler can infer as much and doesn't understand that each of those list of values are really CoordLists. I see, but it seems a bit strange given that

Re: blog.dlang.org

2016-06-21 Thread Christian Köstlin via Digitalmars-d-learn
On 22/06/16 01:51, Seb wrote: > On Tuesday, 21 June 2016 at 23:36:41 UTC, Leandro Motta Barros wrote: >> Try http://dlang.org/blog/ >> >> But, indeed, I would expect blog.dlang.org to work... >> >> Cheers, >> >> LMB >> >> On Tue, Jun 21, 2016 at 6:47 PM, Christian Köstlin < >> digitalmars-d-learn@p

Re: Using .lib and .dll in D applications

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 03:06:29 UTC, moe wrote: I meant like this: - PluginContract // not a dub project, just some folder -- iplugin.d - TestApp // all files for the app (separate project) -- packages DerelictUtil-master // contains the project for derelict -- source app.d //

Real implicitly converts to float?

2016-06-21 Thread Tofu Ninja via Digitalmars-d-learn
Is this intended behavior? I can't seem to find it documented anywhere, I would think the loss in precision would atleast be a warning. real x = 10; float y = x; // No error or warning real to double and double to float also work.

Re: Using .lib and .dll in D applications

2016-06-21 Thread moe via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 02:54:06 UTC, Mike Parker wrote: On Wednesday, 22 June 2016 at 02:38:23 UTC, moe wrote: Yes, I did it intentionally. I wanted to ensure that the packages are self contained and check whether it would work fine like this. Basically I like to have a project that

Re: Using .lib and .dll in D applications

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 02:38:23 UTC, moe wrote: Yes, I did it intentionally. I wanted to ensure that the packages are self contained and check whether it would work fine like this. Basically I like to have a project that contains everything it needs with the versions originally used

Re: Using .lib and .dll in D applications

2016-06-21 Thread moe via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 01:40:47 UTC, Mike Parker wrote: On Tuesday, 21 June 2016 at 23:59:54 UTC, moe wrote: I had some time to try it out and I finally got it to work. I have only tried in windows so far but there was a pitfall in windows. Your dll need a DllMain entry to compile. This

Re: Timer

2016-06-21 Thread Joerg Joergonson via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 01:31:17 UTC, Adam D. Ruppe wrote: On Tuesday, 21 June 2016 at 23:15:58 UTC, Joerg Joergonson wrote: Does D have a timer? You could make one with threads or timeouts, or event loop and GUI libraries have one. Like simpledisplay.d has a Timer class http://dpldo

Re: Using .lib and .dll in D applications

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 23:59:54 UTC, moe wrote: I had some time to try it out and I finally got it to work. I have only tried in windows so far but there was a pitfall in windows. Your dll need a DllMain entry to compile. This was the only thing that was missing from your information. Ri

Re: Timer

2016-06-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 23:15:58 UTC, Joerg Joergonson wrote: Does D have a timer? You could make one with threads or timeouts, or event loop and GUI libraries have one. Like simpledisplay.d has a Timer class http://dpldocs.info/experimental-docs/arsd.simpledisplay.Timer.html and i'm su

Re: blog.dlang.org

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 21:47:46 UTC, Christian Köstlin wrote: I just wanted to have a look at the new blog post about ldc, and entered blog.dlang.org without thinking into the browser. This does not lead to the official blog anymore, but to the old digitalmars website. When we first set

Re: Using .lib and .dll in D applications

2016-06-21 Thread moe via Digitalmars-d-learn
I had some time to try it out and I finally got it to work. I have only tried in windows so far but there was a pitfall in windows. Your dll need a DllMain entry to compile. This was the only thing that was missing from your information. The rest worked perfectly. This may be obvious to most ar

Re: blog.dlang.org

2016-06-21 Thread Seb via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 23:36:41 UTC, Leandro Motta Barros wrote: Try http://dlang.org/blog/ But, indeed, I would expect blog.dlang.org to work... Cheers, LMB On Tue, Jun 21, 2016 at 6:47 PM, Christian Köstlin < digitalmars-d-learn@puremagic.com> wrote: I just wanted to have a look at

Re: blog.dlang.org

2016-06-21 Thread Leandro Motta Barros via Digitalmars-d-learn
Try http://dlang.org/blog/ But, indeed, I would expect blog.dlang.org to work... Cheers, LMB On Tue, Jun 21, 2016 at 6:47 PM, Christian Köstlin < digitalmars-d-learn@puremagic.com> wrote: > I just wanted to have a look at the new blog post about ldc, and entered > blog.dlang.org without thinki

Timer

2016-06-21 Thread Joerg Joergonson via Digitalmars-d-learn
Does D have a timer? I've tried some user code and it doesn't work. I need to be able to have a delegate called periodically. (fiber or thread, doesn't matter) https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d module lib.mTimer; private { import std.traits : Parameter

blog.dlang.org

2016-06-21 Thread Christian Köstlin via Digitalmars-d-learn
I just wanted to have a look at the new blog post about ldc, and entered blog.dlang.org without thinking into the browser. This does not lead to the official blog anymore, but to the old digitalmars website.

Re: opDispatch and @property setters

2016-06-21 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 21:11:39 UTC, ag0aep6g wrote: Works when you change the return type of the the @property opDispatch to auto, so that it can return the result. It's a little weird, but D does support calling functions with assignment syntax. Alternatively, maybe you can actually ch

Re: opDispatch and @property setters

2016-06-21 Thread ag0aep6g via Digitalmars-d-learn
On 06/21/2016 10:48 PM, Lodovico Giaretta wrote: struct Wrapper(T) { private T wrapped; template hasAssignableProperty(string name, Arg) { enum bool hasAssignableProperty = is(typeof( (ref T val, ref Arg arg) {

opDispatch and @property setters

2016-06-21 Thread Lodovico Giaretta via Digitalmars-d-learn
Hi, I'm trying to achieve perfect forwarding of any invocation from the wrapper to the wrapped item, but I'm having a bad time with @property. Suppose this is my wrapper (with all logic stripped): struct Wrapper(T) { private T wrapped; template hasAssignableProperty(

Re: Initialise dynamic array in array of structures

2016-06-21 Thread ketmar via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 19:33:31 UTC, cym13 wrote: i would want him to figure that by himself, tbh. just to remember that "{}" struct initialization is BAD. ;-)

Re: Initialise dynamic array in array of structures

2016-06-21 Thread cym13 via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 19:15:56 UTC, Paul wrote: Given these structures and declaration: struct CoordList{ int x, y; } struct Part{ int x, y; CoordList[] coords; int nextNode, prevNode; string nextEnter, prevEnter; } Part[10] trackTemplates; Can s

Re: Initialise dynamic array in array of structures

2016-06-21 Thread ketmar via Digitalmars-d-learn
trackTemplates[0].coords = [ CoordList(0, 9), CoordList(1, 1), CoordList(3, 6) ];

Re: Is there anyway to make opApply @nogc?

2016-06-21 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 12:53:11 UTC, Adam D. Ruppe wrote: On Tuesday, 21 June 2016 at 12:48:04 UTC, Gary Willoughby wrote: I have no idea what that means. Can anyone shed more light on this, please? So when you use local variables in a delegate, the compiler usually makes a copy of them

Initialise dynamic array in array of structures

2016-06-21 Thread Paul via Digitalmars-d-learn
Given these structures and declaration: struct CoordList{ int x, y; } struct Part{ int x, y; CoordList[] coords; int nextNode, prevNode; string nextEnter, prevEnter; } Part[10] trackTemplates; Can someone please tell me why I can't initialise Part[0].co

TickDuration depreciated, yet stopwatch not?

2016-06-21 Thread Joerg Joergonson via Digitalmars-d-learn
Stopwatch depends on TickDuration and TickDuration is depreciated yet Stopwatch isn't and hasn't been converted to MonoTime... makes sense?

Re: Meaning of const variables

2016-06-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 21, 2016 at 01:48:27PM +, jmh530 via Digitalmars-d-learn wrote: [...] > Thanks to you and the others for the detailed clarifications. I think > part of the difficulty is that there are basically three things being > discussed that are all very similar: an alias to data, a pointer to

Re: Meaning of const variables

2016-06-21 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 15:21:01 UTC, Ali Çehreli wrote: [snip] Thanks.

Re: D casting broke?

2016-06-21 Thread Joerg Joergonson via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 02:39:25 UTC, H. S. Teoh wrote: On Tue, Jun 21, 2016 at 02:09:50AM +, Joerg Joergonson via Digitalmars-d-learn wrote: [...] Lets suppose A -> B means B is derived from A. That is, any object of B can be cast to A because the memory layout of A is contained in B a

Re: Meaning of const variables

2016-06-21 Thread Ali Çehreli via Digitalmars-d-learn
On 06/21/2016 06:48 AM, jmh530 wrote: > So an immutable pointer guarantees that whatever it is pointing to will > never change, Yes but saying "_requires_ that data never changes" is more correct. When it comes to a pointer (i.e. the user of data), "guarantee" is related to const. > but a co

Re: Meaning of const variables

2016-06-21 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 02:54:06 UTC, ketmar wrote: Thanks to you and the others for the detailed clarifications. I think part of the difficulty is that there are basically three things being discussed that are all very similar: an alias to data, a pointer to data, and a view of data.

Re: Is there anyway to make opApply @nogc?

2016-06-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 12:48:04 UTC, Gary Willoughby wrote: I have no idea what that means. Can anyone shed more light on this, please? So when you use local variables in a delegate, the compiler usually makes a copy of them just in case the delegate gets saved for later. When you mark

Re: Is there anyway to make opApply @nogc?

2016-06-21 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 20 June 2016 at 15:27:32 UTC, Adam D. Ruppe wrote: On Monday, 20 June 2016 at 15:13:53 UTC, Gary Willoughby wrote: I think the problem is that the delegate which is required by opApply is allocated using the GC. make the delegate in opApply scope int opApply(scope int delegate(what

Re: D casting broke?

2016-06-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/20/16 10:45 PM, Joerg Joergonson wrote: On Monday, 20 June 2016 at 23:35:28 UTC, Steven Schveighoffer wrote: On 6/19/16 5:19 PM, Joerg Joergonson wrote: On Sunday, 19 June 2016 at 20:21:35 UTC, ag0aep6g wrote: On 06/19/2016 09:59 PM, Joerg Joergonson wrote: This should be completely vali

Re: vibe.d - asynchronously wait() for process to exit

2016-06-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/20/16 11:01 PM, Vladimir Panteleev wrote: On Monday, 20 June 2016 at 19:39:42 UTC, Steven Schveighoffer wrote: On 6/20/16 12:29 PM, Vladimir Panteleev wrote: On Monday, 20 June 2016 at 16:16:32 UTC, Steven Schveighoffer wrote: What is the OS support for waitid (http://man7.org/linux/man-p

Re: vibe.d - asynchronously wait() for process to exit

2016-06-21 Thread Johannes Pfau via Digitalmars-d-learn
Am Tue, 21 Jun 2016 03:01:39 + schrieb Vladimir Panteleev : > > As I recently learned, there's also signalfd. With that, had > Vibe.d had a primitive to wrap a file descriptor into a stream it > can manage, it would be as simple as reading from it. But it > doesn't seem to have one so I gu

Re: Meaning of const variables

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
behavior is identical. And really, if you never need to take the address of the variable, then a manifest constant using enum would be more appropriate. Actually, I should say it *may* be more appropriate. Definitely only when the initializer is known at compile time. There are cases when y

Re: Meaning of const variables

2016-06-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 02:24:03 UTC, jmh530 wrote: I tried making an alias of a const variable and modifying it, but that didn't work. So presumably they mean something else. By alias they mean another reference (or view) to the data, as in Ketmar's example and your assignment of a &x1 t