Re: Out of Source Unittests

2011-09-06 Thread Jacob Carlborg
On 2011-09-06 19:15, Tobias Pankrath wrote: Yes, just move those unit tests into another module. However, it won't have access to private members. Which is IMO a showstopper. How do you handle your unit tests? I am now stuffing everything related to unit tests at the bottom of the module int

Re: Debug on OSX?

2011-09-06 Thread Jacob Carlborg
On 2011-09-06 18:57, Robert Clipsham wrote: On 06/09/2011 07:25, Jacob Carlborg wrote: On 2011-09-06 05:22, Dan Olson wrote: I tried dmd -gc like on linux but gdb on OSX doesn't seem happy. Is there a way to get the debuger to work with dmd on OSX? Thanks, Dan There are things that won't wor

Re: Assertion failure: '!vthis->csym' on line 713 in file 'glue.c

2011-09-06 Thread Jonathan M Davis
On Wednesday, September 07, 2011 12:00:04 azurenote wrote: > Hi there, please look at this. This code occur "Assertion failure: > '!vthis->csym' on line 713 in file 'glue.c": [snip] > I cannot understand error message.. It's a compiler bug. You should never see an Assertion failure when compiling

Assertion failure: '!vthis->csym' on line 713 in file 'glue.c

2011-09-06 Thread azurenote
Hi there, please look at this. This code occur "Assertion failure: '!vthis->csym' on line 713 in file 'glue.c": import std.algorithm; class Node { Node _parent; Node[] _children; this() { } void addChild(Node

Re: Forward a single field to a subfield, "alias this"-style?

2011-09-06 Thread Vladimir Panteleev
On Wed, 07 Sep 2011 01:02:49 +0300, Timon Gehr wrote: Yes, that is because alias does not work with expressions, only with symbols. Thanks. Seems odd that you can forward *all* undefined symbols to a sub-class/struct, but not just specific ones. I wonder how hard would it be to get that

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Andrew Wiley
On Tue, Sep 6, 2011 at 1:51 PM, Nick Sabalausky wrote: > "Trass3r" wrote in message news:op.v1edf3bj3ncmek@enigma... > >> I've heard that our company is considering the T20 from Toradex.com for > >> a new project with remote hardware. The platform runs on Nvidia Tegra > >> and Linux. > >> > >> S

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Andrew Wiley
On Tue, Sep 6, 2011 at 2:25 PM, Johannes Pfau wrote: > Trass3r wrote: > >> I've heard that our company is considering the T20 from Toradex.com > >> for a new project with remote hardware. The platform runs on Nvidia > >> Tegra and Linux. > >> > >> Since I have been very impressed by the D program

Re: Forward a single field to a subfield, "alias this"-style?

2011-09-06 Thread Jonathan M Davis
On Wednesday, September 07, 2011 00:02:49 Timon Gehr wrote: > On 09/06/2011 11:03 PM, Vladimir Panteleev wrote: > > What I'm trying to do: > > > > struct S1 { int f; } > > struct S2 > > { > > S1 s1; > > alias s1.f g; > > } > > > > This doesn't work. The declaration compiles, but attempts to acces

Re: Forward a single field to a subfield, "alias this"-style?

2011-09-06 Thread Timon Gehr
On 09/06/2011 11:03 PM, Vladimir Panteleev wrote: What I'm trying to do: struct S1 { int f; } struct S2 { S1 s1; alias s1.f g; } This doesn't work. The declaration compiles, but attempts to access g result in: Error: struct test.S2 'f' is not a member Error: struct test.S2 member f is not acce

Re: pattern matching

2011-09-06 Thread Jonathan M Davis
On Tuesday, September 06, 2011 21:05:54 %u wrote: > template factorial(int n) { const factorial = n * factorial!(n-1); } > template factorial(int n : 1) { const factorial = 1; } > > i think this pattern matching or like it, can i do the same thing with > regular function > > int factorial(int n)

Re: pattern matching

2011-09-06 Thread bearophile
%u: > is that work? In D unfortunately there is no pattern matching on the run-time values of function arguments. But I don't really understand what you are asking me, sorry. Bye, bearophile

pattern matching

2011-09-06 Thread %u
template factorial(int n) { const factorial = n * factorial!(n-1); } template factorial(int n : 1) { const factorial = 1; } i think this pattern matching or like it, can i do the same thing with regular function int factorial(int n) { return n* factorial(n-1); return 1 ; } int factorial(int n

Re: Default argument for template tuple function parameter

2011-09-06 Thread Vladimir Panteleev
On Tue, 06 Sep 2011 14:37:55 +0300, Timon Gehr wrote: Workaround: AddressInfo[] getAddressInfo()(string node){return getAddressInfo(node,cast(string)null);} AddressInfo[] getAddressInfo(T...)(string node, string service, T options); Thanks, I tried this at first as well, but was turned o

Forward a single field to a subfield, "alias this"-style?

2011-09-06 Thread Vladimir Panteleev
What I'm trying to do: struct S1 { int f; } struct S2 { S1 s1; alias s1.f g; } This doesn't work. The declaration compiles, but attempts to access g result in: Error: struct test.S2 'f' is not a member Error: struct test.S2 member f is not accessible Error: this for f needs t

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread bearophile
Nick Sabalausky: > I *really* think this needs to be one of D's top > priorities at this point. In my opinion at the moment one of the highest priorities of D (maybe _the_ top one) is to find a ways to improve and speed up the process of reviewing, fixing and applying pull requests for DMD/Pho

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Trass3r
At least for gdc only hello-world like code works. Real code hits this issue: https://bitbucket.org/goshawk/gdc/issue/215/alignment-of-struct-members-wrong-on-arm Did you ever try with LDC?

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Johannes Pfau
Trass3r wrote: >> I've heard that our company is considering the T20 from Toradex.com >> for a new project with remote hardware. The platform runs on Nvidia >> Tegra and Linux. >> >> Since I have been very impressed by the D programming language, for >> some years now, could it be possible to use D

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Trass3r
For a language that aims at C/C++'s domain, it's extremely depressing that this is still the case. I *really* think this needs to be one of D's top priorities at this point. I honestly see it as D's #1 biggest glaring hole We have much bigger problems that need attention. And there's nothin

Re: Doesn't std.signal completely miss the point?

2011-09-06 Thread Johannes Pfau
Andrej Mitrovic wrote: >On 9/5/11, Johannes Pfau wrote: >> You're talking about phobos std.signals, not my implementation, >> right? > >Yes. > >On 9/5/11, Johannes Pfau wrote: >> However, I think it's useless as long as it can't be used by multiple >> threads. But when I wanted to add 'shared' su

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Nick Sabalausky
"Trass3r" wrote in message news:op.v1edf3bj3ncmek@enigma... >> I've heard that our company is considering the T20 from Toradex.com for >> a new project with remote hardware. The platform runs on Nvidia Tegra >> and Linux. >> >> Since I have been very impressed by the D programming language, for

Re: Out of Source Unittests

2011-09-06 Thread Trass3r
If you really need that you could use the import expression to mixin your unittests. But you should really put the unittests next to the tested code. A good editor could fold it anyway.

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Trass3r
I've heard that our company is considering the T20 from Toradex.com for a new project with remote hardware. The platform runs on Nvidia Tegra and Linux. Since I have been very impressed by the D programming language, for some years now, could it be possible to use D in such projects? You'

Re: Out of Source Unittests

2011-09-06 Thread bearophile
Tobias Pankrath: > Which is IMO a showstopper. Because in D unittests are meant to be put beside the code they test. If you go against the language, you sometimes find troubles :-) > How do you handle your unit tests? I am now stuffing everything related > to unit tests at the bottom of the mod

Re: Out of Source Unittests

2011-09-06 Thread Tobias Pankrath
> > Yes, just move those unit tests into another module. > > However, it won't have access to private members. Which is IMO a showstopper. How do you handle your unit tests? I am now stuffing everything related to unit tests at the bottom of the module into an private scope (section?). This w

Re: Out of Source Unittests

2011-09-06 Thread bearophile
Tobias Pankrath: > is there any well supported way to store the unittest code in different > files then the actual code? I really don't like to clutter my code with > tests or test helper functions. Unittests too are code. I suggest to keep unittests close to the code they test because this is

Re: Doesn't std.signal completely miss the point?

2011-09-06 Thread Andrej Mitrovic
On 9/5/11, Johannes Pfau wrote: > You're talking about phobos std.signals, not my implementation, right? Yes. On 9/5/11, Johannes Pfau wrote: > However, I think it's useless as long as it can't be used by multiple > threads. But when I wanted to add 'shared' support to it, I always hit > a dead

Re: Debug on OSX?

2011-09-06 Thread Robert Clipsham
On 06/09/2011 07:25, Jacob Carlborg wrote: On 2011-09-06 05:22, Dan Olson wrote: I tried dmd -gc like on linux but gdb on OSX doesn't seem happy. Is there a way to get the debuger to work with dmd on OSX? Thanks, Dan There are things that won't work with gdb and dmd on Mac OS X due to a bug i

Re: Out of Source Unittests

2011-09-06 Thread Steven Schveighoffer
On Tue, 06 Sep 2011 12:42:08 -0400, Tobias Pankrath wrote: Hi, is there any well supported way to store the unittest code in different files then the actual code? I really don't like to clutter my code with tests or test helper functions. Yes, just move those unit tests into another module

Out of Source Unittests

2011-09-06 Thread Tobias Pankrath
Hi, is there any well supported way to store the unittest code in different files then the actual code? I really don't like to clutter my code with tests or test helper functions. Also: Is there a library or possibility to turn the "example:" ddoc sections into unittests? Greetings, Tobias

Re: D on other platforms than Win,Lin,Mac?

2011-09-06 Thread Jacob Carlborg
On 2011-09-06 16:21, lurker57 wrote: Hi! I've heard that our company is considering the T20 from Toradex.com for a new project with remote hardware. The platform runs on Nvidia Tegra and Linux. Since I have been very impressed by the D programming language, for some years now, could it be pos

D on other platforms than Win,Lin,Mac?

2011-09-06 Thread lurker57
Hi! I've heard that our company is considering the T20 from Toradex.com for a new project with remote hardware. The platform runs on Nvidia Tegra and Linux. Since I have been very impressed by the D programming language, for some years now, could it be possible to use D in such projects?

Re: What does ref means

2011-09-06 Thread malio
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Tue, 06 Sep 2011 05:28:22 -0400, malio > wrote: > > Hi guys, > > > > I'm a bit confused what exactly ref means and in which cases I > > definitely need this keyword. > ref is simple. It's a pointer, but without the messy poin

Re: Default argument for template tuple function parameter

2011-09-06 Thread Timon Gehr
On 09/06/2011 01:01 PM, Vladimir Panteleev wrote: AddressInfo[] getAddressInfo(T...)(string node, string service = null, T options) TypeTuple!() emptyTuple; AddressInfo[] getAddressInfo(T...)(string node, string service = null, T options=emptyTuple) {} Error: cannot implicitly convert expre

Re: What does ref means

2011-09-06 Thread Steven Schveighoffer
On Tue, 06 Sep 2011 05:28:22 -0400, malio wrote: Hi guys, I'm a bit confused what exactly ref means and in which cases I definitely need this keyword. ref is simple. It's a pointer, but without the messy pointer syntax. These two programs are exactly the same (will generate the same

Re: clear bug?

2011-09-06 Thread Steven Schveighoffer
On Mon, 05 Sep 2011 22:05:56 -0400, Dan Olson wrote: Jonathan M Davis writes: On Tuesday, September 06, 2011 02:12:11 Andrej Mitrovic wrote: On 9/6/11, Jonathan M Davis wrote: > Why would you > ever try and use an object that had been cleared? TDPL, that's why. Things might have changed

Default argument for template tuple function parameter

2011-09-06 Thread Vladimir Panteleev
AddressInfo[] getAddressInfo(T...)(string node, string service = null, T options) DMD complains: "default argument expected for options". What's the syntax for an empty tuple? -- Best regards, Vladimirmailto:vladi...@thecybershadow.net

Re: What does ref means

2011-09-06 Thread bearophile
malio: > Okay, thanks bearophile. But I currently doesn't exactly understand what's > the difference between "ref" and "const ref"/"immutable ref". If "ref" is > syntactic > sugar for pointers only (like your first example), does it also create a copy > of the parameters which are marked as "re

Re: What does ref means

2011-09-06 Thread malio
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel > malio: > > I'm a bit confused what exactly ref means and in which cases I definitely > > need this keyword. > ref is not too much hard to understand. This is a simple usage example: > import std.stdio; > void inc(ref int x) { > x+

Re: What does ref means

2011-09-06 Thread bearophile
malio: > I'm a bit confused what exactly ref means and in which cases I definitely > need this keyword. ref is not too much hard to understand. This is a simple usage example: import std.stdio; void inc(ref int x) { x++; } void main() { int x = 10; writeln(x); inc(x); write

What does ref means

2011-09-06 Thread malio
Hi guys, I'm a bit confused what exactly ref means and in which cases I definitely need this keyword. Thanks for any reply!

Re: Doesn't std.signal completely miss the point?

2011-09-06 Thread Johannes Pfau
Andrej Mitrovic wrote: >On 9/5/11, Johannes Pfau wrote: >> I started a std.signal rewrite ~1 year ago: This is what I came up >> with: >> http://dl.dropbox.com/u/24218791/d/src/signals.html >> https://gist.github.com/1194497 > >This actually works great for me since it supports lambdas, I've tried

Re: Doesn't std.signal completely miss the point?

2011-09-06 Thread Johannes Pfau
Andrej Mitrovic wrote: >Well it seems I can't use this with freeform delegates that are not >class fields. This could definitely use some improvement. You're talking about phobos std.signals, not my implementation, right? Last time I asked on the mailing list I was told that std.signals was writte