Re: fuction Return function

2014-07-26 Thread Meta via Digitalmars-d-learn
On Saturday, 26 July 2014 at 20:49:30 UTC, seany wrote: Can a function return a function in D? Sorry if i missed the answer somewhere Yup, you can return functions, delegates, or function pointers. int function(int) returnsFunc1() { return function(int n) { return n; }; } int function

Re: fuction Return function

2014-07-26 Thread sigod via Digitalmars-d-learn
On Saturday, 26 July 2014 at 20:49:30 UTC, seany wrote: Can a function return a function in D? Sorry if i missed the answer somewhere Just alias your function signature: ```d alias MyFunctionType = void function(int); ``` Example from my own code: ```d alias DeserializeBody = TLObject functio

fuction Return function

2014-07-26 Thread seany via Digitalmars-d-learn
Can a function return a function in D? Sorry if i missed the answer somewhere

Re: myrange.at(i) for myrange.dropExactly(i).front

2014-07-26 Thread monarch_dodra via Digitalmars-d-learn
On Saturday, 26 July 2014 at 00:28:32 UTC, Ary Borenszweig wrote: No, the OP said the meaning was `myrange.dropExactly(i).front`, which is not a random access. Sometimes you *do* want the n-th element of a range even if the range is not a random access. What he did also say is he wanted the

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: > Hmmm... thinking about it, is this possible? > > 1. Remove the constraints to match anything. > 2. Inside the template, have some construct that enumerates all possible > overloads and UFCS functions that are visible at the

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread via Digitalmars-d-learn
Hmmm... thinking about it, is this possible? 1. Remove the constraints to match anything. 2. Inside the template, have some construct that enumerates all possible overloads and UFCS functions that are visible at the point of instantiation. 3. If this set contains only the current template, use

Re: dual with statement

2014-07-26 Thread Jay Norwood via Digitalmars-d-learn
On Friday, 25 July 2014 at 21:10:56 UTC, monarch_dodra wrote: Functionally nothing more than an alias? EG: { alias baz = foo.bar; ... } Yes, it is all just alias. So with ( (d,e,a,b,c) as (ar.rm.a, ar.rm.b, ar.r.a, ar.r.b, ar.r.c)){ d = a + c; e = (c==0)?0:(a+b)/c; } could

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread Trass3r via Digitalmars-d-learn
Yeah that's the price we pay for the simplicity. Also most constraints directly or indirectly consist of a complex boolean expressions and you don't get any hint which part failed and why.

ddoc and CODE_HIGHLIGHT macro

2014-07-26 Thread Nick Treleaven via Digitalmars-d-learn
Hi, Ddoc doesn't seem to expand a macro near top of http://dlang.org/hash-map.html: // The $(CODE_HIGHLIGHT KeyType) is string Which is weird because it expands it for 'remove' on this line not far below it: b.remove("hello"); Maybe a bug in dmd? Also, I build some dlang.org docs individu

using pipeprocess on non-applications

2014-07-26 Thread Sean Campbell via Digitalmars-d-learn
is there any way to detect if a file is a binary executable that is cross platform or a way to detect whether pipeprocss failed to execute a file if it wasn't executable.

Re: D JSON (WAT?!)

2014-07-26 Thread Kagamin via Digitalmars-d-learn
AFAIK, Variant is not transparent. You can't write parsed["field1"]["field2"], it should be parsed["field1"].get!(Variant[string])["field2"].