Re: How to override impure function from pure function

2016-12-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 05:13:01 UTC, Nikhil Jacob wrote: I mistook the original statement to mean that an impure function can be called from a pure function with some manual overrides. Thank you for the clarification. Yeah you can't do that, except in a debug statement. You can

Re: How to override impure function from pure function

2016-12-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 04:48:11 UTC, Nikhil Jacob wrote: In the D spec for pure functions it says that a pure function can override "can override an impure function, but an impure function cannot override a pure one" Can anyone help me how to do this ? what this means is class

Re: How to override impure function from pure function

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 05:10:02 UTC, Nicholas Wilson wrote: On Tuesday, 13 December 2016 at 04:48:11 UTC, Nikhil Jacob wrote: In the D spec for pure functions it says that a pure function can override "can override an impure function, but an impure function cannot override a pure

How to override impure function from pure function

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
In the D spec for pure functions it says that a pure function can override "can override an impure function, but an impure function cannot override a pure one" Can anyone help me how to do this ?

Re: Error and Exception chaining

2016-12-12 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 00:33:58 UTC, Yuxuan Shui wrote: On Monday, 12 December 2016 at 22:35:22 UTC, Yuxuan Shui wrote: On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote: On 12/12/2016 02:08 PM, Yuxuan Shui wrote: > [...] wrote: >> [...] Error.bypassedException >> [...]

Re: arsd.cgi - maximum length of form post

2016-12-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 00:48:44 UTC, bachmeier wrote: a range violation error core.exception.RangeError@test.d(109): Range violation What's that line of your code too?

Re: arsd.cgi - maximum length of form post

2016-12-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 00:48:44 UTC, bachmeier wrote: Is there a way to increase the maximum post size? The second argument to GenericMain is the max content length, it has a default of 5,000,000. http://dpldocs.info/experimental-docs/arsd.cgi.GenericMain.html

arsd.cgi - maximum length of form post

2016-12-12 Thread bachmeier via Digitalmars-d-learn
I'm using arsd.cgi, and have a form set up to take input. I get a range violation error core.exception.RangeError@test.d(109): Range violation when using the embedded server. It appears to be because the input is too large (about 3900 characters). When I cut the input to 3000 characters, there

Re: Error and Exception chaining

2016-12-12 Thread Yuxuan Shui via Digitalmars-d-learn
On Monday, 12 December 2016 at 22:35:22 UTC, Yuxuan Shui wrote: On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote: On 12/12/2016 02:08 PM, Yuxuan Shui wrote: > [...] wrote: >> [...] Error.bypassedException >> [...] mechanism, >> [...] Error." >> [...] Exception, >> [...] otherwise

Re: Error and Exception chaining

2016-12-12 Thread Yuxuan Shui via Digitalmars-d-learn
On Monday, 12 December 2016 at 22:13:59 UTC, Ali Çehreli wrote: On 12/12/2016 02:08 PM, Yuxuan Shui wrote: > [...] wrote: >> [...] Error.bypassedException >> [...] mechanism, >> [...] Error." >> [...] Exception, >> [...] otherwise >> [...] original >> [...] is the Error. > [...] Exception to >

Re: help on cartesianProduct()

2016-12-12 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 12 December 2016 at 14:27:07 UTC, Orut wrote: The code works beautifully! Thank you very much. Will certainly acknowledge you as source of this code if this becomes of part of a bigger project. I hope others searching this forum would also discover this code. It could probably

Re: Error and Exception chaining

2016-12-12 Thread Ali Çehreli via Digitalmars-d-learn
On 12/12/2016 02:08 PM, Yuxuan Shui wrote: > Thanks a lot for the explanation! > > On Monday, 12 December 2016 at 22:01:54 UTC, Ali Çehreli wrote: >> (Note: Looks like there is a bug regarding Error.bypassedException >> member. Would others please confirm.) >> >> On 12/12/2016 01:15 PM, Yuxuan

Re: Error and Exception chaining

2016-12-12 Thread Yuxuan Shui via Digitalmars-d-learn
Thanks a lot for the explanation! On Monday, 12 December 2016 at 22:01:54 UTC, Ali Çehreli wrote: (Note: Looks like there is a bug regarding Error.bypassedException member. Would others please confirm.) On 12/12/2016 01:15 PM, Yuxuan Shui wrote: > [...] that Error > [...] vague, and I'm >

Error and Exception chaining

2016-12-12 Thread Yuxuan Shui via Digitalmars-d-learn
I read https://dlang.org/spec/statement.html, which told me that Error is different in the way it's chained. But that is pretty vague, and I'm still confused. Can someone explain that using examples? Thanks.

Re: Trying to understand something about UDAs.

2016-12-12 Thread Kevin Balbas via Digitalmars-d-learn
On Monday, 12 December 2016 at 19:56:27 UTC, Adam D. Ruppe wrote: But the static if(is(UDA)) is probably what you actually want. That's exactly what I was looking for, thanks. I'm not sure I ever would've figured out that one on my own.

Re: Trying to understand something about UDAs.

2016-12-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 12 December 2016 at 19:37:42 UTC, Kevin Balbas wrote: I'm trying to figure out how to test whether a UDA struct was initialized with arguments (and change the behavior of the surrounding code if it was. Easy solution: test the type. @Attr is setting the type as a UDA,

Trying to understand something about UDAs.

2016-12-12 Thread Kevin Balbas via Digitalmars-d-learn
I'm trying to figure out how to test whether a UDA struct was initialized with arguments (and change the behavior of the surrounding code if it was. While I was tinkering around with test files, I came up with this little gem: import std.traits; struct Attr { string str; }

Re: arsd.dom appenChild method gives assertion message

2016-12-12 Thread Erdem via Digitalmars-d-learn
On Sunday, 11 December 2016 at 22:11:51 UTC, Adam D. Ruppe wrote: On Sunday, 11 December 2016 at 17:52:29 UTC, Erdem wrote: [...] Try something like: content.appendChild(firstElements[0].removeFromTree()); Thanks this method also works. foreach (element; firstElements) {

Re: Sanitizing forms in vibe.d. How?

2016-12-12 Thread Bauss via Digitalmars-d-learn
On Monday, 12 December 2016 at 10:25:05 UTC, aberba wrote: On Monday, 12 December 2016 at 00:42:54 UTC, Nicholas Wilson wrote: On Sunday, 11 December 2016 at 18:30:54 UTC, aberba wrote: You can enforce that the string that you receive is an email address with `isEmail` from `std.net.isemail`

Re: help on cartesianProduct()

2016-12-12 Thread Orut via Digitalmars-d-learn
On Sunday, 11 December 2016 at 23:07:16 UTC, Era Scarecrow wrote: On Sunday, 11 December 2016 at 18:05:19 UTC, Era Scarecrow wrote: On Sunday, 11 December 2016 at 16:34:38 UTC, Orut wrote: I need to be able to vary the number of ranges to feed into cartesianProduct() at run time. Hmmm...

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 12 December 2016 at 12:30:42 UTC, Jacob Carlborg wrote: On 2016-12-12 12:15, Nicholas Wilson wrote: there is the pure function attribute, how ever this still allows you to use globals *if you pass them as parameters to the function*. And it can access immutable global data.

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-12-12 12:15, Nicholas Wilson wrote: there is the pure function attribute, how ever this still allows you to use globals *if you pass them as parameters to the function*. And it can access immutable global data. -- /Jacob Carlborg

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 12 December 2016 at 11:37:04 UTC, Nikhil Jacob wrote: On Monday, 12 December 2016 at 11:15:28 UTC, Nicholas Wilson wrote: On Monday, 12 December 2016 at 11:02:21 UTC, Nikhil Jacob wrote: Is there any way to check whether a function/delegate passed to a function uses any shared or

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 12 December 2016 at 11:15:28 UTC, Nicholas Wilson wrote: On Monday, 12 December 2016 at 11:02:21 UTC, Nikhil Jacob wrote: Is there any way to check whether a function/delegate passed to a function uses any shared or global variables ? I could not find any in std.traits. there is

Re: Sanitizing forms in vibe.d. How?

2016-12-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 12 December 2016 at 10:25:05 UTC, aberba wrote: On Monday, 12 December 2016 at 00:42:54 UTC, Nicholas Wilson wrote: On Sunday, 11 December 2016 at 18:30:54 UTC, aberba wrote: You can enforce that the string that you receive is an email address with `isEmail` from `std.net.isemail`

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 12 December 2016 at 11:02:21 UTC, Nikhil Jacob wrote: Is there any way to check whether a function/delegate passed to a function uses any shared or global variables ? I could not find any in std.traits. there is the pure function attribute, how ever this still allows you to use

Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
Is there any way to check whether a function/delegate passed to a function uses any shared or global variables ? I could not find any in std.traits.

Re: Sanitizing forms in vibe.d. How?

2016-12-12 Thread aberba via Digitalmars-d-learn
On Monday, 12 December 2016 at 00:42:54 UTC, Nicholas Wilson wrote: On Sunday, 11 December 2016 at 18:30:54 UTC, aberba wrote: You can enforce that the string that you receive is an email address with `isEmail` from `std.net.isemail` Nice. What sql library are you using? there is probably

Re: function is not callable using argument types ()

2016-12-12 Thread Bauss via Digitalmars-d-learn
On Saturday, 10 December 2016 at 08:41:56 UTC, Suliman wrote: import std.stdio; import std.concurrency; void main() { void sp(int i) { receive((int i) { writeln("i: ", i); }); } auto r = new Generator!int( { foreach(i; 1