Re: Ddoc inheritance

2012-06-11 Thread Alex Rønne Petersen
On 12-06-2012 08:29, Jacob Carlborg wrote: On 2012-06-12 04:20, Ary Manzana wrote: I believe no special comment is needed for this. If you override a method without commenting it it should retain the original comment. If you do comment it, it should take that new comment. Sounds like a good i

Re: Ddoc inheritance

2012-06-11 Thread Jacob Carlborg
On 2012-06-12 04:20, Ary Manzana wrote: I believe no special comment is needed for this. If you override a method without commenting it it should retain the original comment. If you do comment it, it should take that new comment. Sounds like a good idea. I wonder though, if a special comment i

static switch

2012-06-11 Thread cal
Does a switch statement acting on a template parameter act just like a chain of static if-else's? That is, does it just generate the code for the matching case? enum E { A, B, C } class Blah(E param) { void foo() { switch(param) { case(E.A) : blah; case(E.B) : def

Re: Using C macros without massive rewrites

2012-06-11 Thread Alex Rønne Petersen
On 12-06-2012 04:20, Charles McAnany wrote: Hi, all. I'm studying Kerrisk's The Linux Programming Interface for fun. The book is written in C, and I thought it would be fun to do the exercises in D. My problem is that I'm doing things like #include in my C code and that loads oodles of macros li

Re: Ddoc inheritance

2012-06-11 Thread Ary Manzana
On 6/12/12 8:59 , Alex Rønne Petersen wrote: Hi, Suppose I have: abstract class A { /// My very long and helpful documentation. void foo(); } class B : A { override void foo() { } } Is there any way I can instruct Ddoc to copy the documentation from A.foo to B.foo? Copying it over manually is

Using C macros without massive rewrites

2012-06-11 Thread Charles McAnany
Hi, all. I'm studying Kerrisk's The Linux Programming Interface for fun. The book is written in C, and I thought it would be fun to do the exercises in D. My problem is that I'm doing things like #include in my C code and that loads oodles of macros like ssize_t, O_RDONLY, EXIT_SUCCESS, etc.

Re: Ddoc inheritance

2012-06-11 Thread Jonathan M Davis
On Tuesday, June 12, 2012 02:59:05 Alex Rønne Petersen wrote: > Hi, > > Suppose I have: > > abstract class A > { > /// My very long and helpful documentation. > void foo(); > } > > class B : A > { > override void foo() > { > } > } > > Is there any way I can instruct Ddoc to copy the documentati

Re: Ddoc inheritance

2012-06-11 Thread Andrej Mitrovic
On 6/12/12, Alex Rønne Petersen wrote: > Would be neat if you could do something like ditto: > > /// inherit > override void foo() > { > } Maybe we should have "// super ditto" :)

Ddoc inheritance

2012-06-11 Thread Alex Rønne Petersen
Hi, Suppose I have: abstract class A { /// My very long and helpful documentation. void foo(); } class B : A { override void foo() { } } Is there any way I can instruct Ddoc to copy the documentation from A.foo to B.foo? Copying it over manually is a maintenance nightmare.

Re: Template argument types

2012-06-11 Thread Alex Rønne Petersen
On 12-06-2012 02:04, bearophile wrote: Do you know why D templates accept floating point values and even arrays of 32 bit dchars: template Foo(dchar[] s) { enum size_t Foo = s.length; } void main() { pragma(msg, Foo!("hello"d.dup)); } But they don't accept arrays of ints? template Foo(int[]

Template argument types

2012-06-11 Thread bearophile
Do you know why D templates accept floating point values and even arrays of 32 bit dchars: template Foo(dchar[] s) { enum size_t Foo = s.length; } void main() { pragma(msg, Foo!("hello"d.dup)); } But they don't accept arrays of ints? template Foo(int[] s) { enum size_t Foo = s.le

Re: Auto-conversion in array literals?

2012-06-11 Thread Timon Gehr
On 06/12/2012 12:55 AM, bearophile wrote: This is valid Scala code: object Main { def main(args: Array[String]): Unit = { val a: List[BigInt] = List(1, BigInt(2)) } } Is it possible/meaningful to support/allow D code like this? import std.bigint; void main() { BigInt[]

Auto-conversion in array literals?

2012-06-11 Thread bearophile
This is valid Scala code: object Main { def main(args: Array[String]): Unit = { val a: List[BigInt] = List(1, BigInt(2)) } } Is it possible/meaningful to support/allow D code like this? import std.bigint; void main() { BigInt[] a = [1, BigInt(2)]; } Bye, bearophile

Re: Float compare broke!

2012-06-11 Thread Dmitry Olshansky
On 11.06.2012 14:33, Era Scarecrow wrote: Most curiously while making unittests the asserts fail when I've confirmed it's working. The difference seems to be if it's immutable/const vs non, and why this makes a difference I don't see... Can someone give some light to this? const float i_f = 3.14

Re: Float compare broke!

2012-06-11 Thread Era Scarecrow
On Monday, 11 June 2012 at 20:28:06 UTC, Era Scarecrow wrote: On Monday, 11 June 2012 at 12:54:37 UTC, Adam D. Ruppe wrote: a == b is probably done by the bits at runtime which match because it is the same assignment. But a == i_f might be propagated down there as 80 bit compared to 32 bit and

Re: Float compare broke!

2012-06-11 Thread Era Scarecrow
On Monday, 11 June 2012 at 12:54:37 UTC, Adam D. Ruppe wrote: a == b is probably done by the bits at runtime which match because it is the same assignment. But a == i_f might be propagated down there as 80 bit compared to 32 bit and thus be just slightly different. Unfortunately I used FloatR

Re: Build all combinations of strings

2012-06-11 Thread bearophile
Andrej Mitrovic: string[] words = "foo bar doo".split(); into: string[] res = ["foo bar doo", "foo doo bar", "bar foo doo", "bar doo foo", "doo foo bar", "doo bar foo"]; http://rosettacode.org/wiki/Permutations#F

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Philippe Sigaud wrote: > Does it still work? It must be almost 2 years old now. Yup!

Re: GtkD compile failed. shift by 32

2012-06-11 Thread Mike Wey
On 06/11/2012 03:21 AM, 1100110 wrote: http://svn.dsource.org/projects/gtkd/branches/070125merge/gtkD/src/gdk/Color.d uint getValue() { return (gdkColor.red <<32) | (gdkColor.green << 16) | (gdkColor.blue); } Just browsing through the source it looks like gtkColor.red is a ushort. I get

Re: Build all combinations of strings

2012-06-11 Thread Philippe Sigaud
On Mon, Jun 11, 2012 at 8:32 PM, Andrej Mitrovic wrote: > On 6/11/12, Andrej Mitrovic wrote: >> I wouldn't know how to translate that to D though. > > Found Phillipe's implementation. Cut from dranges.algorithm: > http://pastebin.com/26s7wNYJ > > There's a github clone here: https://github.com/da

Re: Build all combinations of strings

2012-06-11 Thread Ali Çehreli
On 06/11/2012 10:41 AM, Andrej Mitrovic wrote: Is there a Phobos function to turn this: string[] words = "foo bar doo".split(); into: string[] res = ["foo bar doo", "foo doo bar", "bar foo doo", "bar doo foo", "doo foo bar",

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Andrej Mitrovic wrote: > I wouldn't know how to translate that to D though. Found Phillipe's implementation. Cut from dranges.algorithm: http://pastebin.com/26s7wNYJ There's a github clone here: https://github.com/dawgfoto/dranges Problem solved for now. :)

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Andrej Mitrovic wrote: > So that's not what I'm looking for. Here's what I'm looking for, but in Python: http://docs.python.org/library/itertools.html#itertools.combinations They also have a version that has repeated elements: http://docs.python.org/library/itertools.html#itertools.c

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Andrej Mitrovic wrote: > Also I think the formal word of what I'm looking for is a "powerset". > Hmm wrong, not looking a powerset. Here's one anyway which bearophile posted in another thread: import std.stdio: writeln; auto powerSet(T)(T[] items) { auto r = new T[][](1, 0); for

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Andrej Mitrovic wrote: > On 6/11/12, Andrej Mitrovic wrote: >> Is there a Phobos function.. > > Almost forgot, it can't repeat one string multiple times, so no "foo foo > foo". > Also I think the formal word of what I'm looking for is a "powerset".

Re: Module level privacy

2012-06-11 Thread Jonathan M Davis
On Monday, June 11, 2012 19:59:24 Jarl André" @puremagic.com wrote: > Hi > > I just noticed that by setting a class to private in a module, > its not inaccessible by other modules including the mentioned > module. What am I saying syntactically when I am setting a class > to private in a module?

Re: Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
On 6/11/12, Andrej Mitrovic wrote: > Is there a Phobos function.. Almost forgot, it can't repeat one string multiple times, so no "foo foo foo".

Build all combinations of strings

2012-06-11 Thread Andrej Mitrovic
Is there a Phobos function to turn this: string[] words = "foo bar doo".split(); into: string[] res = ["foo bar doo", "foo doo bar", "bar foo doo", "bar doo foo", "doo foo bar", "doo bar foo"]; So basically all comb

Re: Float compare broke!

2012-06-11 Thread David
Am 11.06.2012 18:42, schrieb David: Am 11.06.2012 16:47, schrieb bearophile: Adam D. Ruppe: This function should help: http://dlang.org/phobos/std_math.html#approxEqual This is better: http://dlang.org/phobos/std_math.html#feqrel Bye, bearophile Wasn't there a bug with feqrel? I think s

Re: Float compare broke!

2012-06-11 Thread David
Am 11.06.2012 16:47, schrieb bearophile: Adam D. Ruppe: This function should help: http://dlang.org/phobos/std_math.html#approxEqual This is better: http://dlang.org/phobos/std_math.html#feqrel Bye, bearophile Wasn't there a bug with feqrel? I think so, that's the reason why I implemente

Re: Float compare broke!

2012-06-11 Thread bearophile
Adam D. Ruppe: This function should help: http://dlang.org/phobos/std_math.html#approxEqual This is better: http://dlang.org/phobos/std_math.html#feqrel Bye, bearophile

Re: Float compare broke!

2012-06-11 Thread Adam D. Ruppe
It probably has to do with different rounding with the constant and the assignment. http://dlang.org/float.html Check out the section: Float­ing Point Con­stant Fold­ing Dif­fer­ent com­piler set­tings, op­ti­miza­tion set­tings, and in­lin­ing set­tings can af­fect op­por­tu­ni­ties for con­

Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r
I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa? Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.

Re: Float compare broke!

2012-06-11 Thread Era Scarecrow
On Monday, 11 June 2012 at 11:47:59 UTC, Matej Nanut wrote: On Monday, 11 June 2012 at 10:33:22 UTC, Era Scarecrow wrote: Most curiously while making unittests the asserts fail when I've confirmed it's working. The difference seems to be if it's immutable/const vs non, and why this makes a diff

Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread ixid
I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa?

Re: Float compare broke!

2012-06-11 Thread Matej Nanut
On Monday, 11 June 2012 at 10:33:22 UTC, Era Scarecrow wrote: Most curiously while making unittests the asserts fail when I've confirmed it's working. The difference seems to be if it's immutable/const vs non, and why this makes a difference I don't see... Can someone give some light to this?

Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r
import std.stdio, core.simd; void main() { int4 v; } Internal error: ..\ztc\cgcod.c 1447 Building Debug\dtest1.exe failed! Works fine on Linux. Maybe the 32Bit check doesn't work for Windoze? -m32 on Linux yields Error: SIMD vector types not supported on this platform

Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread ixid
import std.stdio, core.simd; void main() { int4 v; } Internal error: ..\ztc\cgcod.c 1447 Building Debug\dtest1.exe failed!

Re: align(16) struct member throws an exception with movdqa

2012-06-11 Thread Trass3r
test code please

Float compare broke!

2012-06-11 Thread Era Scarecrow
Most curiously while making unittests the asserts fail when I've confirmed it's working. The difference seems to be if it's immutable/const vs non, and why this makes a difference I don't see... Can someone give some light to this? const float i_f = 3.14159265; float a = i_f; float b = i_f; a