Re: Can vibe d leverage existing web technologies?

2016-09-13 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 23:45:18 UTC, Intersteller wrote: vibe.d does not have much lateral support as the most commons web technologies do. Can vibe.d leverage pre-existing techs such as php, ruby/rails, etc? Starting from scratch and having to build a robust and secure framework is

zip: why isn't requireSameLength the default?

2016-09-13 Thread Timothee Cour via Digitalmars-d-learn
in zip: why isn't requireSameLength the default? This is the most common case and would fit with the goal of being safe by default.

Can vibe d leverage existing web technologies?

2016-09-13 Thread Intersteller via Digitalmars-d-learn
vibe.d does not have much lateral support as the most commons web technologies do. Can vibe.d leverage pre-existing techs such as php, ruby/rails, etc? Starting from scratch and having to build a robust and secure framework is really not the way to go.

Re: Copy a struct and its context

2016-09-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/13/16 5:01 PM, Yuxuan Shui wrote: For example, a common use case might be I want to capture everything by value. In stead of adding all the fields by hand and passing them to the constructor, I want the compiler to do it for me. i.e. I wish I could (borrowing C++ syntax): struct A[=] {

Re: Copy a struct and its context

2016-09-13 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 20:36:22 UTC, Steven Schveighoffer wrote: On 9/13/16 4:11 PM, Yuxuan Shui wrote: On Tuesday, 13 September 2016 at 20:00:40 UTC, Steven Schveighoffer wrote: Not familiar with C++ lambda. You can always "specify" how to capture the data by directly declaring it:

Re: pure functions

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 20:08:22 Patrick Schluter via Digitalmars-d- learn wrote: > On Tuesday, 13 September 2016 at 06:59:10 UTC, Jonathan M Davis > > wrote: > > On Tuesday, September 13, 2016 03:33:04 Ivy Encarnacion via > > > > Digitalmars-d- learn wrote: > > A pure function cannot call

Re: Copy a struct and its context

2016-09-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/13/16 4:11 PM, Yuxuan Shui wrote: On Tuesday, 13 September 2016 at 20:00:40 UTC, Steven Schveighoffer wrote: Not familiar with C++ lambda. You can always "specify" how to capture the data by directly declaring it: auto foo() { int x; static struct S { int x; } r

Re: pure functions

2016-09-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/13/16 4:08 PM, Patrick Schluter wrote: On Tuesday, 13 September 2016 at 06:59:10 UTC, Jonathan M Davis wrote: On Tuesday, September 13, 2016 03:33:04 Ivy Encarnacion via Digitalmars-d- learn wrote: A pure function cannot call any function that is not pure [...] I've read that a lot but

Re: Discarding all forum drafts at once

2016-09-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 18:15:56 UTC, Nordlöw wrote: I have lots of unsent drafts I would like to discard all at once. Is this possible somehow? Delete the cookies.

Re: Copy a struct and its context

2016-09-13 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 20:00:40 UTC, Steven Schveighoffer wrote: On 9/13/16 3:42 PM, Yuxuan Shui wrote: [...] There's nothing in the language to prevent this optimization. [...] Again, could be clearer. But the fact that both the function and the struct affect the same data kind

Re: pure functions

2016-09-13 Thread Patrick Schluter via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 06:59:10 UTC, Jonathan M Davis wrote: On Tuesday, September 13, 2016 03:33:04 Ivy Encarnacion via Digitalmars-d- learn wrote: A pure function cannot call any function that is not pure [...] I've read that a lot but it's not true. A pure function can call imp

Re: Copy a struct and its context

2016-09-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 01:32:19 UTC, Steven Schveighoffer wrote: On 9/12/16 4:11 PM, Ali Çehreli wrote: On 09/10/2016 10:44 PM, Yuxuan Shui wrote: I recently noticed nested struct capture its context by reference (which, BTW, is not mentioned at all here: https://dlang.org/spec/struc

Re: Copy a struct and its context

2016-09-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/13/16 3:42 PM, Yuxuan Shui wrote: On Tuesday, 13 September 2016 at 01:32:19 UTC, Steven Schveighoffer wrote: On 9/12/16 4:11 PM, Ali Çehreli wrote: On 09/10/2016 10:44 PM, Yuxuan Shui wrote: I recently noticed nested struct capture its context by reference (which, BTW, is not mentioned at

Re: Copy a struct and its context

2016-09-13 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 01:32:19 UTC, Steven Schveighoffer wrote: On 9/12/16 4:11 PM, Ali Çehreli wrote: On 09/10/2016 10:44 PM, Yuxuan Shui wrote: I recently noticed nested struct capture its context by reference (which, BTW, is not mentioned at all here: https://dlang.org/spec/struc

Discarding all forum drafts at once

2016-09-13 Thread Nordlöw via Digitalmars-d-learn
I have lots of unsent drafts I would like to discard all at once. Is this possible somehow?

Re: How to check member function for being @disable?

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 17:59:09 Adam D. Ruppe via Digitalmars-d-learn wrote: > On Tuesday, 13 September 2016 at 17:52:48 UTC, Jonathan M Davis > > wrote: > > It's really intended for disabling features that would normally > > be there. I don't know why it would ever make sense to @disable

Re: How to check member function for being @disable?

2016-09-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 17:52:48 UTC, Jonathan M Davis wrote: It's really intended for disabling features that would normally be there. I don't know why it would ever make sense to @disable a normal function. Consider the case of `alias this` or a mixin template. You might make a wra

Re: How to check member function for being @disable?

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 17:29:26 Uranuz via Digitalmars-d-learn wrote: > OK. Seems that there is nothing that I could do more about my > example code.. So the best way to be sure if something is > assignable property is to try assign to it and test whether it > compiles. The question was bec

Re: How to check member function for being @disable?

2016-09-13 Thread Uranuz via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 15:32:57 UTC, Jonathan M Davis wrote: On Tuesday, September 13, 2016 08:28:10 Jonathan M Davis via Digitalmars-d- learn wrote: On Tuesday, September 13, 2016 04:58:38 Uranuz via Digitalmars-d-learn wrote: > In my code I iterate in CT over class methods marked as

Re: Confusion over what types have value vs reference semantics

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 15:27:07 Neurone via Digitalmars-d-learn wrote: > On Sunday, 11 September 2016 at 16:14:59 UTC, Mike Parker wrote: > > On Sunday, 11 September 2016 at 16:10:04 UTC, Mike Parker wrote: > >> And here, no memory is allocated. barSlice.ptr is the same as > >> bar.ptr and

Re: How to check member function for being @disable?

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 08:28:10 Jonathan M Davis via Digitalmars-d- learn wrote: > On Tuesday, September 13, 2016 04:58:38 Uranuz via Digitalmars-d-learn wrote: > > In my code I iterate in CT over class methods marked as @property > > and I have a probleme that one of methods is @disable.

Re: Confusion over what types have value vs reference semantics

2016-09-13 Thread Neurone via Digitalmars-d-learn
On Sunday, 11 September 2016 at 16:14:59 UTC, Mike Parker wrote: On Sunday, 11 September 2016 at 16:10:04 UTC, Mike Parker wrote: And here, no memory is allocated. barSlice.ptr is the same as bar.ptr and barSlice.length is the same as bar.length. However, if you append a new element: barSlic

Re: How to check member function for being @disable?

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 04:58:38 Uranuz via Digitalmars-d-learn wrote: > In my code I iterate in CT over class methods marked as @property > and I have a probleme that one of methods is @disable. So I just > want to skip @disable members. I found possible solution, but > it's interesting to

Re: Fiber Concurrency Showcase

2016-09-13 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 10:02:28 UTC, Andrea Fontana wrote: Check this: http://ddili.org/ders/d.en/fibers.html Further, are we forced to use the GC for Fiber allocation or can a sub-class of Fiber implement its own allocation strategy?

Re: Fiber Concurrency Showcase

2016-09-13 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 10:02:28 UTC, Andrea Fontana wrote: Check this: http://ddili.org/ders/d.en/fibers.html Thanks! I would like to make use of message passing between Fibers aswell. Any code example for this? Specifically: Should the call to `new Fiber()` take all the TId's of i

Re: Fiber Concurrency Showcase

2016-09-13 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 10:02:28 UTC, Andrea Fontana wrote: On Tuesday, 13 September 2016 at 09:46:46 UTC, Nordlöw wrote: I would like to experiment with Fibers/Coroutines in D/vibe.d. I'm missing a code example in std.concurrency that highlights an example of using Fibers for massive

Re: Fiber Concurrency Showcase

2016-09-13 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 09:46:46 UTC, Nordlöw wrote: I would like to experiment with Fibers/Coroutines in D/vibe.d. I'm missing a code example in std.concurrency that highlights an example of using Fibers for massive concurrency. Could anybody show me such a code example or link to a

Re: Fiber Concurrency Showcase

2016-09-13 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 09:46:46 UTC, Nordlöw wrote: I would like to experiment with Fibers/Coroutines in D/vibe.d. I'm missing a code example in std.concurrency that highlights an example of using Fibers for massive concurrency. Could anybody show me such a code example or link to a

Fiber Concurrency Showcase

2016-09-13 Thread Nordlöw via Digitalmars-d-learn
I would like to experiment with Fibers/Coroutines in D/vibe.d. I'm missing a code example in std.concurrency that highlights an example of using Fibers for massive concurrency. Could anybody show me such a code example or link to a more descriptive tutorial?

Re: Binary heap: obtain a _reference_ to the front of the heap

2016-09-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 08:19:04 UTC, Johan Engelen wrote: In the binary heap documentation, I read that `BinaryHeap.front()` "Returns a copy of the front of the heap". [1] Is there no function to access the front of the heap without a copy? (micro-optimization) Thanks, Johan [1]

Binary heap: obtain a _reference_ to the front of the heap

2016-09-13 Thread Johan Engelen via Digitalmars-d-learn
In the binary heap documentation, I read that `BinaryHeap.front()` "Returns a copy of the front of the heap". [1] Is there no function to access the front of the heap without a copy? (micro-optimization) Thanks, Johan [1] https://dlang.org/phobos/std_container_binaryheap.html#.BinaryHeap.

Re: pure functions

2016-09-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 13, 2016 03:33:04 Ivy Encarnacion via Digitalmars-d- learn wrote: > Can pure functions throw exceptions on its arguments? Also, how > can it perform impure operations? Yes, as long as the exception's constructor is pure, a pure function can throw an exception. However, whethe