Rational numbers in D

2012-06-07 Thread Joseph Rushton Wakeling
Hello all, Does D2 have support for a rational number type of arbitrary precision? I found http://cis.jhu.edu/~dsimcha/d/phobos/std_rational.html with a Google search, but there's no reference to this on dlang.org. Thanks & best wishes, -- Joe

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Kevin
On 07/06/12 02:57, Sam Hu wrote: > string content = get("dlang.org"); > writefln("%s\n",content); > > So my very simple question is how to retrieve information from a > webpage which could possibily contains asia font (like Chinese font)? I'm not really sure but try: wstring content = get("dlang.o

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Dmitry Olshansky
On 07.06.2012 10:57, Sam Hu wrote: Greeting! The document on this website provide an example on how to get webpage information by std.net.curl.It is quite straightforward: [code] import std.net.curl, std.stdio; void main(){ // Return a string containing the content specified by an URL string

Re: gdc and gcc object linking issues

2012-06-07 Thread Kagamin
A class declaration is simply a declaration, it doesn't allocate storage, so members end up being implicitly extern (or static inline for methods with bodies) except for instance fields, whose storage is allocated with the new operator. As static inlining a field has no sense, it becomes extern

Re: gdc and gcc object linking issues

2012-06-07 Thread Andrej Mitrovic
On 6/7/12, Kagamin wrote: > If you define a > variable in the header, it will be included in each including > module and you'll get several instances of the variable and > symbol collision at link time. This wasn't a collision error, it was a missing symbol error. The variable is static, so it sh

Re: gdc and gcc object linking issues

2012-06-07 Thread Regan Heath
On Thu, 07 Jun 2012 15:12:46 +0100, Andrej Mitrovic wrote: On 6/7/12, Kagamin wrote: If you define a variable in the header, it will be included in each including module and you'll get several instances of the variable and symbol collision at link time. This wasn't a collision error, it w

Re: Function constraint vs const parameter?

2012-06-07 Thread Jonathan Crapuchettes
That worked great! I wish there was a simpler solution, but thank you very much for your help. JC Ali Çehreli wrote: On 06/06/2012 10:02 AM, Jonathan Crapuchettes wrote: > I'm running into a problem with the following function definition when > passing in a const(string[]). > > public T con

Re: gdc and gcc object linking issues

2012-06-07 Thread Kagamin
On Thursday, 7 June 2012 at 14:29:24 UTC, Regan Heath wrote: In the quoted passage above I suspect he was referring to a static/global variable defined in a C header, not a C++ class member static or otherwise. I'm pretty sure you can define (with storage) global variable in header file both

Re: gdc and gcc object linking issues

2012-06-07 Thread Kagamin
On Thursday, 7 June 2012 at 14:12:56 UTC, Andrej Mitrovic wrote: This wasn't a collision error, it was a missing symbol error. The variable is static, so it should be in the data or bss segment. You seem to be talking about instance variables but that wasn't the issue here. You didn't define

Re: gdc and gcc object linking issues

2012-06-07 Thread Dmitry Olshansky
On 07.06.2012 23:04, Kagamin wrote: On Thursday, 7 June 2012 at 14:29:24 UTC, Regan Heath wrote: In the quoted passage above I suspect he was referring to a static/global variable defined in a C header, not a C++ class member static or otherwise. I'm pretty sure you can define (with storage) g

Re: Function constraint vs const parameter?

2012-06-07 Thread Ali Çehreli
On 06/07/2012 12:02 PM, Jonathan Crapuchettes wrote: > That worked great! I wish there was a simpler solution, but thank you > very much for your help. I am glad. :) Note that isSomeStringArray should have been named isSomeStringRange because it ensures that variable.front compiles. Since slice

Re: gdc and gcc object linking issues

2012-06-07 Thread Andrej Mitrovic
On 6/7/12, Kagamin wrote: > You didn't define the variable. Aah, I see what's going on. See, I was using this in the context of wrapping existing C++ libs. Since I was writing a small test-case for wrapping a static field I made a header file with a static field declaration but no .cpp implementa

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Sam Hu
On Thursday, 7 June 2012 at 10:43:32 UTC, Dmitry Olshansky wrote: string content = get("dlang.org"); It's simple this line you "convert" whatever site content was to unicode. Problem is that "convert" is either broken or it's simply a cast whereas it should re-encode source as unicode. So th

Re: std.net.curl get webpage asia font issue

2012-06-07 Thread Sam Hu
On Thursday, 7 June 2012 at 10:38:53 UTC, Kevin wrote: On 07/06/12 02:57, Sam Hu wrote: string content = get("dlang.org"); writefln("%s\n",content); So my very simple question is how to retrieve information from a webpage which could possibily contains asia font (like Chinese font)? I'm not

Re: floats default to NaN... why?

2012-06-07 Thread Minas
I agree that the default value for floats/doubles should be zero. It feels much more natural. I think the problem here is that people are thinking about some stuff too much. D is a rather new language that wants to be practical. Floats defaulting to NaN is NOT practical FOR MOST PEOPLE when a

Re: floats default to NaN... why?

2012-06-07 Thread Kevin Cox
On Jun 7, 2012 9:53 PM, "Minas" wrote: > > I agree that the default value for floats/doubles should be zero. It feels much more natural. > > I think the problem here is that people are thinking about some stuff too much. D is a rather new language that wants to be practical. Floats defaulting to N

Re: floats default to NaN... why?

2012-06-07 Thread Jerome BENOIT
hello List: On 08/06/12 04:04, Kevin Cox wrote: On Jun 7, 2012 9:53 PM, "Minas" mailto:minas_mina1...@hotmail.co.uk>> wrote: > > I agree that the default value for floats/doubles should be zero. It feels much more natural. This highly depends on your perspective: for numerical folks, NaN i

Re: Ordering an associative array - or - another option

2012-06-07 Thread Era Scarecrow
On Wednesday, 6 June 2012 at 17:05:35 UTC, Jonathan M Davis wrote: On Wednesday, June 06, 2012 16:04:14 Paul wrote: I have and array string[string][string][string] that works great for everything I need except that they (assoc. arrays) don't maintain an order. I need to maintain the order of en