Re: What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
On Thursday, 29 August 2013 at 06:23:18 UTC, Jonathan M Davis wrote: On Thursday, August 29, 2013 07:47:16 Paul Jurczak wrote: I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningless variable

Re: UFCS in template function

2013-08-28 Thread Jacob Carlborg
On 2013-08-28 23:28, ixid wrote: UFCS does not work in this template where the normal function call syntax will work: template test(alias fun) { auto test(T)(T n) { return n.fun; } } Is this the same as the inability to use UFCS with functions declared in the same scope as th

Re: Question about garbage collector

2013-08-28 Thread Jacob Carlborg
On 2013-08-28 23:28, bioinfornatics wrote: Hi everyone, yesterday i read an article into a french linux journal that in some years garbage collector will disapear. Why ? he explain in very very short as: -- - Moore's law will be not anymore true so only memory will conti

Re: What is a concise way to test if floating point value is integral?

2013-08-28 Thread Jonathan M Davis
On Thursday, August 29, 2013 07:47:16 Paul Jurczak wrote: > I'm writing this rather ugly: > > sqrt(cast(float)D) != round(sqrt(cast(float)D) > > line and I'm looking for more concise notation without > introducing a meaningless variable to hold expression being > tested. Is there an equivalent of

Re: What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
On Thursday, 29 August 2013 at 05:47:43 UTC, Paul Jurczak wrote: I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningless variable to hold expression being tested. Is there an equivalent of st

What is a concise way to test if floating point value is integral?

2013-08-28 Thread Paul Jurczak
I'm writing this rather ugly: sqrt(cast(float)D) != round(sqrt(cast(float)D) line and I'm looking for more concise notation without introducing a meaningless variable to hold expression being tested. Is there an equivalent of std.math.trunc(), which would return fractional portion instead, ma

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread Marek Janukowicz
H. S. Teoh wrote: > On Thu, Aug 29, 2013 at 12:45:05AM +0200, Marek Janukowicz wrote: >> H. S. Teoh wrote: > [...] >> > Oh, and BTW, are you on Linux 32-bit or 64-bit? Don't know if that >> > makes a difference, but just in case. >> >> 64-bit > [...] > > Maybe try compiling with -m32 and see if

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread H. S. Teoh
On Thu, Aug 29, 2013 at 12:45:05AM +0200, Marek Janukowicz wrote: > H. S. Teoh wrote: [...] > > Oh, and BTW, are you on Linux 32-bit or 64-bit? Don't know if that > > makes a difference, but just in case. > > 64-bit [...] Maybe try compiling with -m32 and see if it makes a difference? If so, it m

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread Marek Janukowicz
H. S. Teoh wrote: > On Wed, Aug 28, 2013 at 11:02:17PM +0200, Marek Janukowicz wrote: >> I was finally able to create simple test case that probably reproduces >> the bug (probably, because the stack trace is completely different, >> but the code that is there is similar). This requires 2 source c

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 02:10:34PM -0700, H. S. Teoh wrote: > On Wed, Aug 28, 2013 at 11:02:17PM +0200, Marek Janukowicz wrote: > > I was finally able to create simple test case that probably > > reproduces the bug (probably, because the stack trace is completely > > different, but the code that is

Question about garbage collector

2013-08-28 Thread bioinfornatics
Hi everyone, yesterday i read an article into a french linux journal that in some years garbage collector will disapear. Why ? he explain in very very short as: -- - Moore's law will be not anymore true so only memory will continue to increase ( static and volatil ) - G

UFCS in template function

2013-08-28 Thread ixid
UFCS does not work in this template where the normal function call syntax will work: template test(alias fun) { auto test(T)(T n) { return n.fun; } } Is this the same as the inability to use UFCS with functions declared in the same scope as the call? Is there no

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Era Scarecrow
On Wednesday, 28 August 2013 at 15:20:34 UTC, Artur Skawina wrote: It's hard to tell what your actual requirements are; this discriminated union might help. It does a bit more than what you ask for, as it also gives access to /data/, not just methods; this shouldn't be a problem. Requirement

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 11:02:17PM +0200, Marek Janukowicz wrote: > I was finally able to create simple test case that probably reproduces > the bug (probably, because the stack trace is completely different, > but the code that is there is similar). This requires 2 source code > files: [...] > Run

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread Marek Janukowicz
I was finally able to create simple test case that probably reproduces the bug (probably, because the stack trace is completely different, but the code that is there is similar). This requires 2 source code files: main.d: module main; // This line must be there - import any module from std cau

Re: repeating random number sequences.

2013-08-28 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 06:18:01PM +0200, Jesse Phillips wrote: > On Tuesday, 27 August 2013 at 12:59:19 UTC, Jason den Dulk wrote: > >Hi > > > >This code > > > > foreach (j; 0..5) > >writeln(rndGen().take(5)); > > writeln(uniform(0, 1024)); > > foreach (j; 0..5) > >writeln(rndGen().take

Re: dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 05:29:40PM +0200, Marek Janukowicz wrote: > This is really a cross-domain issue, but I didn't feel like splitting > it into separate posts would make sense. > > I use DMD 2.063.2 on Linux 64-bit. > > I have some code in my (non-trivial) application that basically > corresp

Re: repeating random number sequences.

2013-08-28 Thread Jesse Phillips
On Tuesday, 27 August 2013 at 12:59:19 UTC, Jason den Dulk wrote: Hi This code foreach (j; 0..5) writeln(rndGen().take(5)); writeln(uniform(0, 1024)); foreach (j; 0..5) writeln(rndGen().take(5)); What monarch said, though std.range.refRange() may be of interest: http://dlang.or

dmd memory usage/static lib/algorithm bug?

2013-08-28 Thread Marek Janukowicz
This is really a cross-domain issue, but I didn't feel like splitting it into separate posts would make sense. I use DMD 2.063.2 on Linux 64-bit. I have some code in my (non-trivial) application that basically corresponds to this: import std.stdio, std.algorithm, std.array; void main () { s

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Artur Skawina
On 08/28/13 06:45, Era Scarecrow wrote: > On Wednesday, 28 August 2013 at 03:45:06 UTC, Andre Artus wrote: >> Era, >> >> I haven't had time to go through your everything you wrote here but are you >> looking to create some form of discriminated union (AKA tagged union) using >> D structs? >> >> D

Re: Regarding std.collection.Array

2013-08-28 Thread Tobias Pankrath
On Wednesday, 28 August 2013 at 00:45:48 UTC, bearophile wrote: Is it a good idea to add to std.collection.Array a method similar to: T[] unsafeRelease() pure nothrow { return this._data._payload; } It's meant to be used as an unsafe hack to call some some functions that requ

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-28 Thread Era Scarecrow
K got a prototype working, I know there's issues with it but for now it looks simple and acts the way it is suppose to (at least to the unittest) so... Had to use templates through all the functions in order for auto ref to work right (hopefully forwards what it needs...) /* //the only th

Re: Variant[Variant]

2013-08-28 Thread Jason den Dulk
On Tuesday, 27 August 2013 at 18:32:46 UTC, Ali Çehreli wrote: May I ask you or somebody else to create a bug about VariantN.toHash not being considered at all. Thank you! :) I have filed a bug report for this, and I have placed a work around in my code, so that's it for now, I suppose. Thank