Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread Jacob Carlborg
On 2014-01-07 21:44, H. S. Teoh wrote: If you have a good motivating use case in favor of this addition that can be used in a DIP, I'd vote for it. I'm usually not good at these arguments. I mean, it would be nice to have but I don't have any strong arguments for it. It's just syntax sugar.

Re: dirEntries throws exception on broken symlinks

2014-01-07 Thread Timothee Cour
I reported this here some time ago: http://d.puremagic.com/issues/show_bug.cgi?id=11501 (dup of http://d.puremagic.com/issues/show_bug.cgi?id=8298) and there's a pull request ready, not sure why it isn't being merged On Sun, Jan 5, 2014 at 10:20 PM, dennis wrote: > On Sunday, 5 January 2014 at

Re: segfault when using std.parallelism and std.process.executeShell

2014-01-07 Thread Kelet
On Tuesday, 7 January 2014 at 23:12:09 UTC, Ali Çehreli wrote: don't know the original problem but that program works without any problem with the current dmd on github. Works for me on dmd v2.064 (current stable) on Windows.

Re: segfault when using std.parallelism and std.process.executeShell

2014-01-07 Thread Ali Çehreli
On 12/12/2013 08:33 PM, Nikhil Padmanabhan wrote: Hi, The following code dies with a segfault : import std.stdio, std.parallelism, std.process; void main() { auto a=["hello","world","goodbye"]; foreach(s; parallel(a,1)) { auto ls=executeShell("echo "~s); writeln(ls.

Re: Foreach loop behaviour and manipulation

2014-01-07 Thread H. S. Teoh
On Tue, Jan 07, 2014 at 09:38:34PM +, Binarydepth wrote: > > >or ... for(count=1;count>0 && count<100 || count>999 && > >count<1 || etc...; count++ ) > > That won't work. It's better separate foreach loops. Y'know, this code snippet really reminds me of why Jackson Structured Progra

Re: Simplest way to create an array from an associative array which its contains keys and values?

2014-01-07 Thread Jakob Ovrum
On Tuesday, 7 January 2014 at 20:38:11 UTC, Craig Dillabaugh wrote: Saves a few lines of code, and looks cooler, it seems that the trivial foreach loop version is very easy: string[] array; foreach (key, value; aa) { array ~= key; array ~= value; } Assuming the return value o

Re: Simplest way to create an array from an associative array which its contains keys and values?

2014-01-07 Thread Andrej Mitrovic
On 1/7/14, Craig Dillabaugh wrote: > In other words while: > > auto range = aa.byKey.map!(a => chain(a.only, aa[a].only)); > string[] array = range.join; > > Saves a few lines of code, and looks cooler, it seems that the > trivial foreach loop version is very easy: > > string[] array; >

Re: Foreach loop behaviour and manipulation

2014-01-07 Thread Binarydepth
or ... for(count=1;count>0 && count<100 || count>999 && count<1 || etc...; count++ ) That won't work. It's better separate foreach loops.

Re: Simplest way to create an array from an associative array which its contains keys and values?

2014-01-07 Thread Craig Dillabaugh
On Tuesday, 7 January 2014 at 20:52:40 UTC, H. S. Teoh wrote: On Tue, Jan 07, 2014 at 08:38:10PM +, Craig Dillabaugh wrote: [...] As someone with little experience with functional programming, I am just curious - having browsed through the thread - if the various solutions proposed here wo

Re: Foreach loop behaviour and manipulation

2014-01-07 Thread Binarydepth
On Thursday, 28 November 2013 at 23:45:26 UTC, H. S. Teoh wrote: On Fri, Nov 29, 2013 at 12:36:18AM +0100, Binarydepth wrote: Hi guys I'm having some problems. Calculations are not working as expected and I get segmentation fault. I used the 2.059 version and it runs after compilation on compi

Re: Simplest way to create an array from an associative array which its contains keys and values?

2014-01-07 Thread H. S. Teoh
On Tue, Jan 07, 2014 at 08:38:10PM +, Craig Dillabaugh wrote: [...] > As someone with little experience with functional programming, I am > just curious - having browsed through the thread - if the various > solutions proposed here would really be considered more 'idiomatic' > D. Or if they wer

Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread H. S. Teoh
On Tue, Jan 07, 2014 at 09:18:48PM +0100, Jacob Carlborg wrote: > On 2014-01-07 16:58, H. S. Teoh wrote: > > >Y'know, I've always wanted "trailing delegate syntax": > > > > func(x, y, z; p, q, r) { > > // body > > } > > > >gets translated into: > > > > func(p, q, r, (x, y,

Re: Simplest way to create an array from an associative array which its contains keys and values?

2014-01-07 Thread Craig Dillabaugh
On Friday, 3 January 2014 at 17:38:16 UTC, Gary Willoughby wrote: Simplest way to create an array from an associative array which its contains keys and values? For example if i have an associative array like this: ["one":"1", "two":"2"] What's the easiest way to create a dynamic array that lo

Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread Jacob Carlborg
On 2014-01-07 16:58, H. S. Teoh wrote: Y'know, I've always wanted "trailing delegate syntax": func(x, y, z; p, q, r) { // body } gets translated into: func(p, q, r, (x, y, z) => /* body */); Since we already have UFCS, which translates a leading fragme

Re: dub and ddox

2014-01-07 Thread Kelet
Also, I cannot find any documentation on ddox arguments (ddoxFilterArgs). Is this currently not available? I had to look through the source code and vibe.d to figure them out. Regards, Kelet

dub and ddox

2014-01-07 Thread Kelet
Hello, I'm working on a library, and I'm trying to write the documentation with Sönke's ddox software[1]. As I understand, it works with the Ddoc documentation format[2]. The first problem I came across is that documented unit tests weren't being converted into examples like in [2]. I came t

Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread H. S. Teoh
On Tue, Jan 07, 2014 at 03:35:43PM +0100, Jacob Carlborg wrote: > On 2014-01-07 13:22, Philippe Sigaud wrote: > > >What about: > > > >void loop(void delegate() dg); > > > >loop({ > >... > > > >}); > > > >Since any block is a void delegate(). > > That's what we have now, and that doesn't look like

Re: libphobos.so and loading libraries at runtime

2014-01-07 Thread Dicebot
On Sunday, 5 January 2014 at 20:47:44 UTC, FreeSlave wrote: But why does dmd use static linking by default? Is shared version of phobos still experimental? It is. It works pretty good in practice but Martin wanted to improve provided utilities for library/symbol loading before announcing it a

Re: libphobos.so and loading libraries at runtime

2014-01-07 Thread Sean Kelly
On Sunday, 5 January 2014 at 20:47:44 UTC, FreeSlave wrote: import core.runtime; int main() { Runtime.loadLibrary("does not care"); Runtime.unloadLibrary(null); return 0; } When I try to compile this code with 'dmd main.d', I get errors main.o: In function `_D4core7runtime7Runtime

Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread Jacob Carlborg
On 2014-01-07 13:22, Philippe Sigaud wrote: What about: void loop(void delegate() dg); loop({ ... }); Since any block is a void delegate(). That's what we have now, and that doesn't look like a built-in statement ;) -- /Jacob Carlborg

Re: Is it possible to handle 'magic' property assignments a'la PHP?

2014-01-07 Thread Philippe Sigaud
On Tue, Jan 7, 2014 at 8:50 AM, Jacob Carlborg wrote: > I would like to have that in D as well, but with braces instead: > > void loop (void delegate () dg); > > loop { > // endless loop > } What about: void loop(void delegate() dg); loop({ ... }); Since any block is a void delegate().