Re: const version for foreach/opApply

2012-06-09 Thread Matthias Walter
On 2012-06-08 22:47, Era Scarecrow wrote: > On Friday, 8 June 2012 at 16:33:28 UTC, Matthias Walter wrote: >> Hi, >> >> trying to traverse the entries of a std.bitmanip.BitArray I stumbled >> upon the following problem: >> >> In case I want to accept const(BitArray) objects, it shall look like >> t

Re: Segmentation fault hell in D

2012-06-09 Thread Dejan Lekic
On Fri, 08 Jun 2012 19:57:47 -0700, Andrew Wiley wrote: > On Fri, Jun 8, 2012 at 11:29 AM, Jonathan M Davis > wrote: > >> On Friday, June 08, 2012 19:30:57 Jarl André" >> @puremagic.com wrote: >> > Evry single time I encounter them I yawn. It means using the next >> > frickin hour to comment away

Using keyword as package name

2012-06-09 Thread Roman D. Boiko
I generate bindings to a c library, and one of folders is named `shared`, which is a keyword and thus cannot be used as a package name. One option is to remove this package and put files to a parent directory, or simply rename it. Is there any way to avoid this and keep the name as is? What

Re: Is D actually |-----------this-----powerful-----------|?

2012-06-09 Thread David Piepgrass
Oops, forgot the code. "4. Unit inference engine: Given some notation for optionally indicating units, e.g. unit(value), could a D metaprogram examine the following code, infer the correct units, and issue an error message on the last line? auto mass = kg(2.0); auto accel = 1.0; auto force =

Re: Segmentation fault hell in D

2012-06-09 Thread Andrew Wiley
On Sat, Jun 9, 2012 at 6:09 AM, Dejan Lekic wrote: > On Fri, 08 Jun 2012 19:57:47 -0700, Andrew Wiley wrote: > >> On Fri, Jun 8, 2012 at 11:29 AM, Jonathan M Davis >> wrote: >> >>> On Friday, June 08, 2012 19:30:57 Jarl André" >>> @puremagic.com wrote: >>> > Evry single time I encounter them I yaw

Re: floats default to NaN... why?

2012-06-09 Thread Minas
With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still not a good choice. I think that

Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Chris Saunders
Hi -- I've been trying to learn more about D's purity features after reading David Nadlinger's interesting post on this topic. While 'purifying' some existing code I discovered that I can't use roundTo in a pure function, and I don't understand why. Is this a general problem with most floatin

Re: floats default to NaN... why?

2012-06-09 Thread Kevin
On 09/06/12 14:42, Minas wrote: >> With >> ints, the best we can do is 0. With floats, NaN makes it better. > > With the logic that NaN is the default for floats, 0 is a very bad > choice for ints. It the worst we could do. Altough I understand that > setting it to something else like -infinity is

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 09/06/12 20:48, Kevin wrote: On 09/06/12 14:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to somethin

Re: floats default to NaN... why?

2012-06-09 Thread Kevin
On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: > > > On 09/06/12 20:48, Kevin wrote: >> On 09/06/12 14:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. >>> >>> With the logic that NaN is the default for floats, 0 is a very bad >>> choice for in

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 09/06/12 20:42, Minas wrote: With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Jonathan M Davis
On Saturday, June 09, 2012 20:43:42 Chris Saunders wrote: > Hi -- > > I've been trying to learn more about D's purity features after > reading David Nadlinger's interesting post on this topic. While > 'purifying' some existing code I discovered that I can't use > roundTo in a pure function, and I

Re: const version for foreach/opApply

2012-06-09 Thread Era Scarecrow
On Saturday, 9 June 2012 at 10:09:25 UTC, Matthias Walter wrote: First, thank you for your answer. I've already made some tiny modifications in order to make BitArray work for my purposes: https://github.com/xammy/phobos/commit/eb46d99217f2bf1e6d173964e2954248b08146d6 If you plan to create pul

Re: floats default to NaN... why?

2012-06-09 Thread Andrew Wiley
On Sat, Jun 9, 2012 at 11:57 AM, Kevin wrote: > On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: > > > > > > On 09/06/12 20:48, Kevin wrote: > >> On 09/06/12 14:42, Minas wrote: > With > ints, the best we can do is 0. With floats, NaN makes it better. > >>> > >>> With the logic tha

Re: floats default to NaN... why?

2012-06-09 Thread Andrew Wiley
On Sat, Jun 9, 2012 at 4:53 PM, Andrew Wiley wrote: > > On Sat, Jun 9, 2012 at 11:57 AM, Kevin wrote: >> >> On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: >> > >> > >> > On 09/06/12 20:48, Kevin wrote: >> >> On 09/06/12 14:42, Minas wrote: >> With >> ints, the best we can do is 0

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
Hello: On 10/06/12 01:57, Andrew Wiley wrote: On Sat, Jun 9, 2012 at 4:53 PM, Andrew Wiley wrote: On Sat, Jun 9, 2012 at 11:57 AM, Kevin wrote: On Sat 09 Jun 2012 14:59:21 EDT, Jerome BENOIT wrote: On 09/06/12 20:48, Kevin wrote: On 09/06/12 14:42, Minas wrote: With ints, the best we

Re: floats default to NaN... why?

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: > I see. So the alternative, to get a kind of NaN effect, would be to set > integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option > is hardware dependent, so zero as default for integers sounds the best > option. ??? All

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Chris Saunders
On Saturday, 9 June 2012 at 19:33:55 UTC, Jonathan M Davis wrote: On Saturday, June 09, 2012 20:43:42 Chris Saunders wrote: Hi -- I've been trying to learn more about D's purity features after reading David Nadlinger's interesting post on this topic. While 'purifying' some existing code I disco

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 10/06/12 02:49, Jonathan M Davis wrote: On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: I see. So the alternative, to get a kind of NaN effect, would be to set integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option is hardware dependent, so zero as default for in

Re: floats default to NaN... why?

2012-06-09 Thread Jerome BENOIT
On 10/06/12 02:49, Jonathan M Davis wrote: On Sunday, June 10, 2012 02:32:18 Jerome BENOIT wrote: I see. So the alternative, to get a kind of NaN effect, would be to set integers to their hardware extremum (INT_MAX,SIZE_MAX,...). But this option is hardware dependent, so zero as default for in

Re: Why is to(T) pure but roundTo(T) impure?

2012-06-09 Thread Jonathan M Davis
On Sunday, June 10, 2012 04:06:03 Chris Saunders wrote: > Thanks Jonathan. Sounds like a practical issue rather than some > theoretical problem -- good to know. The vast majority of purity issues with Phobos are purely an implementation issue and not any kind of limit in the language. Obviously s

Re: Segmentation fault hell in D

2012-06-09 Thread Chad J
On 06/08/2012 02:00 PM, Justin Whear wrote: On Fri, 08 Jun 2012 19:30:57 +0200, Jarl André wrote: Evry single time I encounter them I yawn. It means using the next frickin hour to comment away code, add more log statements and try to eleminate whats creating the hell of bugz, segmantation fault