Re: Mac OS crash, details inside...

2013-06-14 Thread Jacob Carlborg
On 2013-06-13 19:42, Gary Willoughby wrote: I get a program crash each time running the following code on MacOS 10.8 (Lion). It seems to run ok on Ubuntu 12.04: import core.sys.posix.sys.stat; import core.sys.posix.unistd; import std.c.stdio; import std.c.stdlib; import std.process; import

Re: Unqual fails with pointer?

2013-06-14 Thread Namespace
Thank you.

Re: Mac OS crash, details inside...

2013-06-14 Thread Gary Willoughby
You do know that you usually don't have a /home/ directory on Mac OS X? On Mac OS X it's called /Users/. Yeah, that was me running the same code on Ubuntu. BTW, running that on Mac OS X 10.6.3 does not cause a crash. Although it doesn't seem to print or write anything. That's the problem i

Re: Mac OS crash, details inside...

2013-06-14 Thread Gary Willoughby
In fact i have the same problem reading files too. It only reads files up to a certain amount of bytes then crashes in the same manner explained above. Again this only happens when the program runs as a daemon.

Re: List all enum in a class

2013-06-14 Thread Bruno Deligny
On Thursday, 13 June 2013 at 17:13:26 UTC, Adam D. Ruppe wrote: On Thursday, 13 June 2013 at 17:05:43 UTC, Bruno Deligny wrote: i tried your test and it doesn't print test. Maybe we have different versions of the compiler (I think this behavior recently changed). Try running dmd without

Re: List all enum in a class

2013-06-14 Thread Bruno Deligny
On Friday, 14 June 2013 at 11:44:45 UTC, Bruno Deligny wrote: On Thursday, 13 June 2013 at 17:13:26 UTC, Adam D. Ruppe wrote: On Thursday, 13 June 2013 at 17:05:43 UTC, Bruno Deligny wrote: i tried your test and it doesn't print test. Maybe we have different versions of the compiler (I think

[Doubt] Variadic arguments as reference (Possible?)

2013-06-14 Thread MattCoder
Hi, I want to know if there is a way to pass variadic arguments as reference? DMD says no! I wrote the snippet code below, but what I want to do in fact is assign the sum back to respective variables to use somewhere else. http://dpaste.dzfl.pl/515edfb8 or import std.stdio; import

Re: [Doubt] Variadic arguments as reference (Possible?)

2013-06-14 Thread Regan Heath
On Fri, 14 Jun 2013 13:55:29 +0100, MattCoder mattco...@gmail.com wrote: I want to know if there is a way to pass variadic arguments as reference? DMD says no! import std.stdio; import std.conv; void sum(double value, double*[] numbers ...){ foreach(ref num; numbers)

Re: [Doubt] Variadic arguments as reference (Possible?)

2013-06-14 Thread MattCoder
On Friday, 14 June 2013 at 13:20:26 UTC, Regan Heath wrote: import std.stdio; import std.conv; void sum(double value, double*[] numbers ...){ foreach(ref num; numbers) *num = *num + value; } void main(){ double a = 1, b = 2, c = 3; sum(10, a, b, c);

Re: [Doubt] Variadic arguments as reference (Possible?)

2013-06-14 Thread MattCodrr
On Friday, 14 June 2013 at 13:24:18 UTC, bearophile wrote: One way to do it, but beware of template bloat: import std.stdio; void sum(TArgs...)(double value, ref TArgs numbers) { foreach (ref num; numbers) // Note: this is a static foreach. num += value; } void main() {

Re: Strange seg fault

2013-06-14 Thread Ali Çehreli
On 06/13/2013 09:11 AM, Ali Çehreli wrote: On 06/12/2013 11:56 PM, gedaiu wrote: How should i submit this bug? You can reduce it to a minimal program first and then submit at http://d.puremagic.com/issues/ Thank you for submitting it:

Re: Error: cannot uniquely infer foreach argument types

2013-06-14 Thread Agustin
On Friday, 14 June 2013 at 17:17:46 UTC, bearophile wrote: Agustin: Hello, i'm trying to create a library with utilities classes like containers using Java API. The problem with this is that most Phobos works with ranges... Could anyone help me? Maybe your code has multiple problems. If

Re: A little of coordination for Rosettacode

2013-06-14 Thread bearophile
There is also one D entry in need to be fixed (with Phobos): http://rosettacode.org/wiki/Distributed_programming#D Bye, bearophile

Re: A little of coordination for Rosettacode

2013-06-14 Thread Adam D. Ruppe
On Friday, 14 June 2013 at 22:17:16 UTC, bearophile wrote: http://rosettacode.org/wiki/Distributed_programming#D It kinda sounds like the description calls for something like what web.d does: server: import arsd.web; class Foo : ApiProvider { export string hello(string name) { return

Re: A little of coordination for Rosettacode

2013-06-14 Thread bearophile
Adam D. Ruppe: This actual example here uses several thousand lines of library code but if you think it would fit the description, I'm sure I can do a basic demo in far fewer lines using nothing but phobos. I think Rosettacode accepts code that uses libraries that are free. Take a look at

Clash between functions that shouldn't be in the same partial ordering set

2013-06-14 Thread TommiT
I'm pretty sure the following is a compiler bug, right? (using DMD 2.063) - module a; void foo(char) { } - module b; enum MyEnum : int { _ } void foo(MyEnum) { } - module main; import a; import b; void main() { foo(char.init); foo(MyEnum.init); // [1] }

[Sharing]Tuple to variables (My Function)

2013-06-14 Thread MattCoder
Hi, Sooner I asked about this ([Doubt] Variadic arguments as reference (Possible?) - - http://forum.dlang.org/thread/jwujjhjizkovvmbeg...@forum.dlang.org). In fact my intend was to recreate a feature that I like in Python, where you can assign variables from a tuple, e.g.: pos = (10, 20)

Re: A little of coordination for Rosettacode

2013-06-14 Thread Adam D. Ruppe
On Friday, 14 June 2013 at 22:44:40 UTC, bearophile wrote: So if you think this task can be implemented quickly using web.d, then use it :-) I just think it is really cool that D can do that kind of thing, so a brief implementation might be good to show people how it is done. I'll see

Re: A little of coordination for Rosettacode

2013-06-14 Thread bearophile
Adam D. Ruppe: I'll see about slapping something together over the weekend and posting it here. If you use a library, please also give the link to the library, so I can create a nearly empty page on Rosettacode about it. It's kind of needed. Bye, bearophile

Re: [Sharing]Tuple to variables (My Function)

2013-06-14 Thread bearophile
MattCoder: void tupleToVar(A, T...)(A inTuple, ref T listParams){ I think in the C++11 STL a similar function is named tie. if(!(iinTuple.length)) break; You have to verify in the function constraint that the lengths match. It would be nice if it could appear more like

Re: [Sharing]Tuple to variables (My Function)

2013-06-14 Thread MattCoder
On Saturday, 15 June 2013 at 00:47:01 UTC, bearophile wrote: You have to verify in the function constraint that the lengths match. In fact that was intentional, because sometimes I just want few items from a tuple not all. For example: auto RGB = tuple(255, 125, 50); Variant r,g;

Re: Error: cannot uniquely infer foreach argument types

2013-06-14 Thread Ali Çehreli
On 06/14/2013 10:25 AM, Agustin wrote: int opApply(int delegate(ref int, ref E) delegation); Works!, thanks. I have just completed the translation of the foreach with Structs and Classes chapter: http://ddili.org/ders/d.en/foreach_opapply.html Ali

Automatic Equation and Inequation evaluation.

2013-06-14 Thread Carlos
I'm interested in this kind of functionalities does D have something on this ? I thought about something like a eval function that would use specified algorithms. something likes this import std.stdio, std.math, atd.eval; eval(Real a+b+c^^x=56){ algor.brute; writeln(Real, , Positive

Re: Automatic Equation and Inequation evaluation.

2013-06-14 Thread Carlos
On Saturday, 15 June 2013 at 01:31:23 UTC, Carlos wrote: I'm interested in this kind of functionalities does D have something on this ? I thought about something like a eval function that would use specified algorithms. something likes this import std.stdio, std.math, atd.eval; eval(Real

Re: Clash between functions that shouldn't be in the same partial ordering set

2013-06-14 Thread Jonathan M Davis
On Saturday, June 15, 2013 01:09:28 TommiT wrote: I'm pretty sure the following is a compiler bug, right? (using DMD 2.063) - module a; void foo(char) { } - module b; enum MyEnum : int { _ } void foo(MyEnum) { } - module main; import a; import

how should I implement this list?

2013-06-14 Thread Bedros
I'm converting some code into D while learning D and need some help to implement this I have a node of struct { ulong mask; ulong value}; now I need to create a list and insert that node; but first I don't need duplicates, so, I first check if node already exists in list. I also need to

Re: Clash between functions that shouldn't be in the same partial ordering set

2013-06-14 Thread TommiT
On Saturday, 15 June 2013 at 02:39:31 UTC, Jonathan M Davis wrote: On Saturday, June 15, 2013 01:09:28 TommiT wrote: I'm pretty sure the following is a compiler bug, right? (using DMD 2.063) - module a; void foo(char) { } - module b; enum MyEnum : int { _ } void foo(MyEnum)