Re: version(noboundscheck) + friends

2013-06-04 Thread Timothee Cour
We really should aim to minimize the wtfpmhttp://davidlongstreet.wordpress.com/2009/04/29/new-software-metric-wtfs-per-minute/ for future users. I propose: * support version(nocheckbounds) with same meaning as version( D_NoBoundsChecks) * list D_NoBoundsChecks as soft-deprecated. By

Re: version(noboundscheck) + friends

2013-06-04 Thread Jonathan M Davis
On Monday, June 03, 2013 23:17:03 Timothee Cour wrote: We really should aim to minimize the wtfpmhttp://davidlongstreet.wordpress.com/2009/04/29/new-software-metric-wt fs-per-minute/ for future users. I propose: * support version(nocheckbounds) with same meaning as version( D_NoBoundsChecks)

Re: version(noboundscheck) + friends

2013-06-04 Thread eles
On Monday, 3 June 2013 at 22:19:23 UTC, Ali Çehreli wrote: On 06/03/2013 03:11 PM, Timothee Cour wrote: Why aren't we using version=noboundscheck (+ friends) instead of -noboundscheck? Hijack: what about version(integeroverflow) ?

Re: version(noboundscheck) + friends

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 09:14:28 eles wrote: On Monday, 3 June 2013 at 22:19:23 UTC, Ali Çehreli wrote: On 06/03/2013 03:11 PM, Timothee Cour wrote: Why aren't we using version=noboundscheck (+ friends) instead of -noboundscheck? Hijack: what about version(integeroverflow)

pasting ddoc code samples removes newlines

2013-06-04 Thread Timothee Cour
My biggest annoyance with ddoc generated files is that when pasting code samples (eg: The Example sample from http://dlang.org/phobos/std_algorithm.html), newline characters disappear, resulting in one giant line. For example this is part of the html for the generated example box:

Re: version(noboundscheck) + friends

2013-06-04 Thread eles
On Tuesday, 4 June 2013 at 07:19:52 UTC, Jonathan M Davis wrote: On Tuesday, June 04, 2013 09:14:28 eles wrote: On Monday, 3 June 2013 at 22:19:23 UTC, Ali Çehreli wrote: On 06/03/2013 03:11 PM, Timothee Cour wrote: Nothing in the language checks for integer overflow, and given the overhead

Re: version(noboundscheck) + friends

2013-06-04 Thread Timothee Cour
given the overhead that it would introduce Do you mean compiler-implementation overhead or resulting runtime overhead? If you mean runtime overhead then I disagree, as this would be an opt-in option enabled with, say, a version identifier such as version=check_arithmetic_overflow (same as

Re: version(noboundscheck) + friends

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 00:38:17 Timothee Cour wrote: given the overhead that it would introduce Do you mean compiler-implementation overhead or resulting runtime overhead? I'm talking about runtime overhead, and Walter is flat-out against it. Anyone who wants it even in just non-release

Re: version(noboundscheck) + friends

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 09:30:07 eles wrote: On Tuesday, 4 June 2013 at 07:19:52 UTC, Jonathan M Davis wrote: Walter has been against it every time that it's come up. Yes, even in the -debug mode. What I fail to see is why. The overhead will be there only if asked for, only in debug mode.

Re: version(noboundscheck) + friends

2013-06-04 Thread Timothee Cour
What are his arguments against an opt-in flag such as version=check_arithmetic_overflow ? * slowing down code is a very weak argument precisely because this would be an opt-in flag (and wouldn't be implied by version=debug in my proposal). * reliance on intentional overflow arithmetics could be

Re: version(noboundscheck) + friends

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 00:57:09 Timothee Cour wrote: What are his arguments against an opt-in flag such as version=check_arithmetic_overflow ? I'm sure that you can find his arguments in a number of threads that have discussed integer overflow. And if you want to get the situation changed,

Re: randomShuffle

2013-06-04 Thread Diggory
On Monday, 3 June 2013 at 21:24:50 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 08:28 PM, Diggory wrote: I'd guess that the heavy use of floating point arithmetic to calculate the step sizes means that algorithm has a fairly large constant overhead even though the complexity is smaller.

Re: randomShuffle

2013-06-04 Thread Diggory
On Tuesday, 4 June 2013 at 08:30:58 UTC, Diggory wrote: On Monday, 3 June 2013 at 21:24:50 UTC, Joseph Rushton Wakeling wrote: On 06/03/2013 08:28 PM, Diggory wrote: I'd guess that the heavy use of floating point arithmetic to calculate the step sizes means that algorithm has a fairly large

Re: pasting ddoc code samples removes newlines

2013-06-04 Thread bearophile
Timothee Cour: Any plan in adding a BR at the end of each line in ddoc generation or something similar, so that pasting will preserve newlines? I agree, it's a small problem. I think it's not too much hard to fix. Take a look in Bugzilla to see if it's already there, otherwise submit it.

Re: randomShuffle

2013-06-04 Thread Diggory
Here's the fixed one: uint[] randomSample(uint N, uint M) { uint[] result = new uint[N]; struct hashPair { uint key; uint index; } size_t tableSize = N*4; if (tableSize M) tableSize = M;

Re: pasting ddoc code samples removes newlines

2013-06-04 Thread Andrej Mitrovic
On 6/4/13, Timothee Cour thelastmamm...@gmail.com wrote: My biggest annoyance with ddoc generated files is that when pasting code samples (eg: The Example sample from http://dlang.org/phobos/std_algorithm.html), newline characters disappear, resulting in one giant line.

Re: Exception isn't thrown as expected

2013-06-04 Thread Alexandr Druzhinin
31.05.2013 8:56, Alexandr Druzhinin пишет: Hello I have code like this: class SomeClass { ubyte[] data_; ... auto getObjectType() const { if(data_ is null) { writeln(throwing); throw new Exception(Here the exception should be thrown!); }

Re: Exception isn't thrown as expected

2013-06-04 Thread Alexandr Druzhinin
04.06.2013 19:18, Alexandr Druzhinin пишет: 31.05.2013 8:56, Alexandr Druzhinin пишет: Hello I have code like this: class SomeClass { ubyte[] data_; ... auto getObjectType() const { if(data_ is null) { writeln(throwing); throw new Exception(Here the

Re: randomShuffle

2013-06-04 Thread Joseph Rushton Wakeling
On 06/04/2013 02:03 PM, Diggory wrote: Still a few places to optimise, and I think the compiler optimisation should be able to give a decent speed up as well. Would be interested to see how it compares in your benchmark! I'll try it out later and get back to you. :-)

Access violation when exiting program

2013-06-04 Thread Frank Fuente
Hi, The following program runs, loads the DLL, excutes the function, returns the correct value and unloads the DLL, but on exiting causes an exception: Unhandled exception at 0x0040f9c0 in USBRelay.exe: 0xC005: Access violation writing location 0xffea. The FT_STATUS is

Re: Nested class defined in another file

2013-06-04 Thread Flamaros
On Monday, 3 June 2013 at 22:39:39 UTC, Ali Çehreli wrote: On 06/03/2013 03:20 PM, Bruno Deligny wrote: I began to separate them by hand by passing a parent reference but it's ugly because i need to make the parent members accessible in public to have acces. Is there any friend like in C++

Re: and/or/not/xor operators

2013-06-04 Thread ixid
On Monday, 3 June 2013 at 09:29:20 UTC, Regan Heath wrote: On Fri, 31 May 2013 21:26:56 +0100, ixid nuacco...@gmail.com wrote: We really don't want D to become a TMTOWTDI language. Ideally there should be 1 right way and no alternatives. That way, anyone who knows D will have a greater

Re: Segfault on simple program?

2013-06-04 Thread Iain Buclaw
On Saturday, 1 June 2013 at 10:11:35 UTC, Ali Çehreli wrote: On 06/01/2013 01:34 AM, Shriramana Sharma wrote: All programs compiled by *DMD* produce a segfault. Programs compiled by GDC work just fine. It is likely that GDC is from the D1 era. Not that package, it's an old D2 release,

how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it

Re: how to reflect on function attributes

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it is(typeof(A.func) == const) - Jonathan M Davis

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
On 06/04/2013 07:19 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it is(typeof(A.func) == const) - Jonathan M Davis I think that is

Re: how to reflect on function attributes

2013-06-04 Thread Jonathan M Davis
On Tuesday, June 04, 2013 19:23:45 Ellery Newcomer wrote: On 06/04/2013 07:19 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
On 06/04/2013 07:43 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:23:45 Ellery Newcomer wrote: On 06/04/2013 07:19 PM, Jonathan M Davis wrote: On Tuesday, June 04, 2013 19:03:47 Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } }

Re: how to reflect on function attributes

2013-06-04 Thread Ellery Newcomer
Ah, you're right. don't know how I screwed that up. Yes I do. I was trying to use typeof(A.func)

Re: how to reflect on function attributes

2013-06-04 Thread Ali Çehreli
On 06/04/2013 07:03 PM, Ellery Newcomer wrote: specifically, const, eg. class A { void func() const { blah } } std.traits.FunctionAttributes makes no mention of it Not that it adds more information over the spec, but I have finished the translation of the is Expression chapter just