Re: how to avoid cycle detected?

2015-07-02 Thread aki via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 22:25:48 UTC, Jonathan M Davis wrote: On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via Digitalmars-d-learn wrote: The runtime cannot introspect the code to detect the circular dependency, so it makes a conservative decision. I'm waiting on an

Re: ddoc - modules with same name

2015-07-02 Thread armando sano via Digitalmars-d-learn
I could never get this working. Have you got an example of your compiler command. In case that's still helpful after a couple of years...: dmd path1/to/source.d path2/to/source.d -o- -D -Ddpath/to/doc -op generates `path/to/doc/path1/to/source.html` and

Re: how to avoid cycle detected?

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/1/15 6:25 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via Digitalmars-d-learn wrote: The runtime cannot introspect the code to detect the circular dependency, so it makes a conservative decision. I'm waiting on an

Re: Array operations, dynamic arrays and length

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/1/15 8:36 PM, J Miller wrote: Oh, and to make things really confusing, auto e = a[] - b[] and int[] e = a[] - b[] both cause Error: array operation a[] - b[] without destination memory not allowed. Using dmd 2.067.0. This is not a bug. You need to allocate memory before you can write to

linking external libs

2015-07-02 Thread Nicholas Wilson via Digitalmars-d-learn
So test.d depends on libgmp.a Unsurprisingly: $dmd test.d fails to find libgmp.a So tell it to look $dmd -L-lgmp test.d finds the wrong one or doesn't find it. Tell it where to look $dmd -L-L/usr/local/lib -L-lgmp test.d Ok. Now it fails to find Phobos. Ok $dmd -L-L/usr/local/lib

Re: linking external libs

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/2/15 8:10 AM, Nicholas Wilson wrote: So test.d depends on libgmp.a Unsurprisingly: $dmd test.d fails to find libgmp.a So tell it to look $dmd -L-lgmp test.d finds the wrong one or doesn't find it. Tell it where to look $dmd -L-L/usr/local/lib -L-lgmp test.d Ok. Now it fails to

Re: Array operations, dynamic arrays and length

2015-07-02 Thread via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=14759

Re: linking external libs

2015-07-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 2 July 2015 at 12:19:06 UTC, Steven Schveighoffer wrote: On 7/2/15 8:10 AM, Nicholas Wilson wrote: [...] Try dmd -v, it will tell you the link line. Then you can try it yourself to see how to get it to work. I know dmd has problems with link line parameters, because it always

Re: linking external libs

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/2/15 8:47 AM, Nicholas Wilson wrote: On Thursday, 2 July 2015 at 12:19:06 UTC, Steven Schveighoffer wrote: On 7/2/15 8:10 AM, Nicholas Wilson wrote: [...] Try dmd -v, it will tell you the link line. Then you can try it yourself to see how to get it to work. I know dmd has problems with

Re: Array operations, dynamic arrays and length

2015-07-02 Thread via Digitalmars-d-learn
On Thursday, 2 July 2015 at 10:48:56 UTC, Steven Schveighoffer wrote: On 7/1/15 8:36 PM, J Miller wrote: Oh, and to make things really confusing, auto e = a[] - b[] and int[] e = a[] - b[] both cause Error: array operation a[] - b[] without destination memory not allowed. Using dmd 2.067.0.

Re: etc.c.zlib help

2015-07-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 2 July 2015 at 03:07:43 UTC, Matthew Gamble wrote: I am trying to make the transition from C++ to D. I've hit a snag with the etc.c.zlib module where any attempt to use this module to open a file yields an error: Error 42: Symbol Undefined __lseeki64. Here is a simple example of

Re: Array operations, dynamic arrays and length

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/2/15 8:21 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: On Thursday, 2 July 2015 at 10:48:56 UTC, Steven Schveighoffer wrote: On 7/1/15 8:36 PM, J Miller wrote: Oh, and to make things really confusing, auto e = a[] - b[] and int[] e = a[] - b[] both cause Error: array

Re: linking external libs

2015-07-02 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 2 July 2015 at 12:47:52 UTC, Nicholas Wilson wrote: On Thursday, 2 July 2015 at 12:19:06 UTC, Steven Schveighoffer wrote: On 7/2/15 8:10 AM, Nicholas Wilson wrote: [...] Try dmd -v, it will tell you the link line. Then you can try it yourself to see how to get it to work. I

Re: goroutines vs vibe.d tasks

2015-07-02 Thread Etienne Cimon via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 18:09:19 UTC, Mathias Lang wrote: On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote: Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks. Compilers go: go version go1.4.2 linux/amd64 vibe.d: DMD64 D Compiler v2.067.1

Best way to convert datetime betwen Python and D

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. What's the best way to convert a D std.datetime DateTime to a Python datetime.datetime and back again ? PyD allows for custom conversion methods in D, but that is not much use if I don't know how to make the conversion on the D side. I could obviously split out into y,m,d,h,m,s again,

Re: etc.c.zlib help

2015-07-02 Thread Matthew Gamble via Digitalmars-d-learn
On Thursday, 2 July 2015 at 20:19:49 UTC, Laeeth Isharc wrote: On Thursday, 2 July 2015 at 03:07:43 UTC, Matthew Gamble wrote: I am trying to make the transition from C++ to D. I've hit a snag with the etc.c.zlib module where any attempt to use this module to open a file yields an error:

Re: etc.c.zlib help

2015-07-02 Thread Mike Parker via Digitalmars-d-learn
On 7/3/2015 8:44 AM, Matthew Gamble wrote: Thanks to Nicholas and Laeeth for all the suggestions. In the process of trying to explicitly link to zlib.dll like a do for C++, I came across a strange development. I changed the platform to x64 (Visual D) and now the program compiles and runs fine

bigint compile time errors

2015-07-02 Thread Paul D Anderson via Digitalmars-d-learn
The following code fails to compile and responds with the given error message. Varying the plusTwo function doesn't work; as long as there is an arithmetic operation the error occurs. It seems to mean that there is no way to modify a BigInt at compile time. This seriously limits the usability

Re: bigint compile time errors

2015-07-02 Thread Anon via Digitalmars-d-learn
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote: The following code fails to compile and responds with the given error message. Varying the plusTwo function doesn't work; as long as there is an arithmetic operation the error occurs. This works for me on OSX 10.10 (Yosemite)

Re: bigint compile time errors

2015-07-02 Thread Paul D Anderson via Digitalmars-d-learn
On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote: On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote: enum BigInt test1 = BigInt(123); enum BigInt test2 = plusTwo(test1); public static BigInt plusTwo(in bigint n) Should be plusTwo(in BigInt n) instead. Yes, I had aliased

Re: how to avoid cycle detected?

2015-07-02 Thread aki via Digitalmars-d-learn
On Thursday, 2 July 2015 at 17:21:03 UTC, Kapps wrote: An ugly solution, but the approach used in Phobos is to create something like a_init.d which a.d imports, provided that the static ctors don't actually rely on things from the static ctor of b. How about this idea? Allowing to define sub

Re: ddoc - modules with same name

2015-07-02 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 2 July 2015 at 06:33:42 UTC, armando sano wrote: I could never get this working. Have you got an example of your compiler command. In case that's still helpful after a couple of years...: dmd path1/to/source.d path2/to/source.d -o- -D -Ddpath/to/doc -op generates

Re: tkd - basic compilation problem

2015-07-02 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 19:45:04 UTC, Paul wrote: I can't see how they answer the questions I've asked. Let me see. On Tuesday, 30 June 2015 at 12:58:21 UTC, Paul wrote: I downloaded the archive from https://github.com/nomad-software/tkd and files are same as in the git repo. Tcl/tk is

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Justin Whear via Digitalmars-d-learn
On Thu, 02 Jul 2015 17:33:28 +, Laeeth Isharc wrote: FixedDecimal is a fixed decimal point struct that stores values as an int or long and takes number of decimal places as the second compile term argument. It's possible, if not likely I have made a mistake in implementing operator

Re: lovely compiler error message - incompatible types

2015-07-02 Thread anonymous via Digitalmars-d-learn
On Thursday, 2 July 2015 at 17:33:29 UTC, Laeeth Isharc wrote: Any thoughts on what could be leading to the following: ./../../marketdata/source/pricebar.d(397): Error: incompatible types for ((bar.high) + (bar.low)): 'FixedDecimal!(int, 8)' and 'FixedDecimal!(int, 8)'

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/2/15 1:33 PM, Laeeth Isharc wrote: Hi. It's not easy to reduce, but I will have a go if other options fail. Any thoughts on what could be leading to the following: ../../../marketdata/source/pricebar.d(397): Error: incompatible types for ((bar.high) + (bar.low)): 'FixedDecimal!(int, 8)'

lovely compiler error message - incompatible types

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. It's not easy to reduce, but I will have a go if other options fail. Any thoughts on what could be leading to the following: ./../../marketdata/source/pricebar.d(397): Error: incompatible types for ((bar.high) + (bar.low)): 'FixedDecimal!(int, 8)' and 'FixedDecimal!(int, 8)'

Re: etc.c.zlib help

2015-07-02 Thread Matthew Gamble via Digitalmars-d-learn
On Thursday, 2 July 2015 at 12:36:35 UTC, Nicholas Wilson wrote: On Thursday, 2 July 2015 at 03:07:43 UTC, Matthew Gamble wrote: I am trying to make the transition from C++ to D. I've hit a snag with the etc.c.zlib module where any attempt to use this module to open a file yields an error:

Re: how to avoid cycle detected?

2015-07-02 Thread Kapps via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 09:09:53 UTC, aki wrote: Following code causes run-time error. How can I use static this() without causing error? It's difficult to avoid this situation because actual code is more complex. file main.d: void main() { } file a.d: import b; class A { static

Re: tkd - basic compilation problem

2015-07-02 Thread Paul via Digitalmars-d-learn
On Thursday, 2 July 2015 at 17:41:45 UTC, Gary Willoughby wrote: This is exactly why you use dub, so you don't have to worry about all this! You're right, there's sufficient information there if using dub.

Re: tkd - basic compilation problem

2015-07-02 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 2 July 2015 at 18:34:13 UTC, Paul wrote: On Thursday, 2 July 2015 at 17:41:45 UTC, Gary Willoughby wrote: This is exactly why you use dub, so you don't have to worry about all this! You're right, there's sufficient information there if using dub. Please read that page again.

time difference - beautify my code

2015-07-02 Thread dd0s via Digitalmars-d-learn
i got a date t described in seconds from 1.1.1970, and i want to check if the current time is further than 12 hours from the given time t. the following code works but it's super ugly =S please give me some ideas how to make this code nicer :) private static bool sessionIsCurrent(long t)

Re: Array operations, dynamic arrays and length

2015-07-02 Thread J Miller via Digitalmars-d-learn
On Thursday, 2 July 2015 at 12:59:03 UTC, Steven Schveighoffer wrote: On 7/2/15 8:21 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: On Thursday, 2 July 2015 at 10:48:56 UTC, Steven Schveighoffer wrote: On 7/1/15 8:36 PM, J Miller wrote: Oh, and to make things really confusing, auto

Re: time difference - beautify my code

2015-07-02 Thread anonymous via Digitalmars-d-learn
On Thursday, 2 July 2015 at 19:03:49 UTC, dd0s wrote: i got a date t described in seconds from 1.1.1970, I.e., you have a unix timestamp. and i want to check if the current time is further than 12 hours from the given time t. the following code works but it's super ugly =S please give me

Re: goroutines vs vibe.d tasks

2015-07-02 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2015-06-30 at 15:20 +, Alex Parrill via Digitalmars-d-learn wrote: […] Use GDC or LDC for profiling code; the DMD optimizer isn't as good. Also note that gc code generation is poor compared to gccgo: always use gccgo for benchmarking. […] -- Russel.

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 2 July 2015 at 18:01:39 UTC, Steven Schveighoffer wrote: On 7/2/15 1:33 PM, Laeeth Isharc wrote: Hi. It's not easy to reduce, but I will have a go if other options fail. Any thoughts on what could be leading to the following: ../../../marketdata/source/pricebar.d(397): Error:

Re: etc.c.zlib help

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 2 July 2015 at 03:07:43 UTC, Matthew Gamble wrote: I am trying to make the transition from C++ to D. I've hit a snag with the etc.c.zlib module where any attempt to use this module to open a file yields an error: Error 42: Symbol Undefined __lseeki64. Here is a simple example of

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
Can you post the signature to the operator overload? I have an idea of what it might be, but it's difficult to explain without context. -Steve https://gist.github.com/Laeeth/6251fa731e4cee84bcdc not really a proper implementation. I wanted something as a placeholder today that I could

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Justin Whear via Digitalmars-d-learn
On Thu, 02 Jul 2015 21:03:37 +, Laeeth Isharc wrote: Can you post the signature to the operator overload? I have an idea of what it might be, but it's difficult to explain without context. -Steve https://gist.github.com/Laeeth/6251fa731e4cee84bcdc not really a proper implementation.

Re: lovely compiler error message - incompatible types

2015-07-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 2 July 2015 at 21:19:19 UTC, Justin Whear wrote: On Thu, 02 Jul 2015 21:03:37 +, Laeeth Isharc wrote: Can you post the signature to the operator overload? I have an idea of what it might be, but it's difficult to explain without context. -Steve