Re: how to reflect on function attributes

2013-06-04 Thread lomereiter
This doesn't work when the method is marked as @property. Any idea why is that so? On Wednesday, 5 June 2013 at 02:19:38 UTC, Jonathan M Davis wrote: is(typeof(A.func) == const) - Jonathan M Davis

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

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 } } std.traits.Funct

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 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

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 fo

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

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: 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, 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 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 chance of knowing what

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

A string splitting from the right

2013-06-04 Thread bearophile
If I have a string as "10,20,30" and I need to split it taking the part after the last comma and all before it, in Python I use rsplit with optional argument 1: s = "10,20,30" a, b = s.rsplit(",", 1) assert a, b == "10,20", "30" The optional second argument tells Python when to stop splitt

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 declared.

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. :-)

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: 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: pasting ddoc code samples removes newlines

2013-06-04 Thread Andrej Mitrovic
On 6/4/13, Timothee Cour 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. http://d.puremagic.com/issues/show_bug.cgi?

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; hashPair[

Re: pasting ddoc code samples removes newlines

2013-06-04 Thread bearophile
Timothee Cour: Any plan in adding a 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. By

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 con

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: 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: 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 e

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

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-relea

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 versio

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 t

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: sort!(greater)(

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(int

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) ?