Re: Circular Buffer

2014-02-09 Thread Chris Cain
On Monday, 10 February 2014 at 03:14:31 UTC, Jonathan Dunlap wrote: (disclaimer: I'm new around here) Is it possible to cycle backwards? If not, what's the best approach? Example of some ideal "takeBack" function: data = cycle([1,2,3][]) take(data, 4) is [1,2,3,1][] takeBack(data, 4) would be

Re: Circular Buffer

2014-02-09 Thread Jonathan Dunlap
(disclaimer: I'm new around here) Is it possible to cycle backwards? If not, what's the best approach? Example of some ideal "takeBack" function: data = cycle([1,2,3][]) take(data, 4) is [1,2,3,1][] takeBack(data, 4) would be [1,3,2,1][] Thoughts?

Re: "Global" imports vs scoped imports

2014-02-09 Thread Jeremy DeHaan
On Monday, 10 February 2014 at 00:30:14 UTC, Jonathan M Davis wrote: On Sunday, February 09, 2014 19:18:05 Dicebot wrote: Usage of selective imports is also encouraged. Not so much. At least, not right now. They don't work right and tend to cause symbol conflicts: https://d.puremagic.com/is

Re: pure vs writeln debugging

2014-02-09 Thread Jesse Phillips
On Sunday, 9 February 2014 at 00:18:28 UTC, Nick Sabalausky wrote: On 2/8/2014 5:30 PM, Adam D. Ruppe wrote: On Saturday, 8 February 2014 at 22:27:39 UTC, Nick Sabalausky wrote: Is there some way to poke enough of a hole in "pure" to get some writeln debugging statements in? literally write

Re: Check if path is child of directory

2014-02-09 Thread Jesse Phillips
On Sunday, 9 February 2014 at 21:02:59 UTC, Jeroen Bollen wrote: I'm building a webserver using the Vibe.d library. Whenever the user requests a page inside my /images/ folder; I want them to output this file. Because there will be a lot of images present, and because these are likely to chan

Re: Check if path is child of directory

2014-02-09 Thread Jonathan M Davis
On Sunday, February 09, 2014 21:09:51 Jeroen Bollen wrote: > On Sunday, 9 February 2014 at 21:02:59 UTC, Jeroen Bollen wrote: > > I'm building a webserver using the Vibe.d library. Whenever the > > user requests a page inside my /images/ folder; I want them to > > output this file. > > > > Because

Re: "Global" imports vs scoped imports

2014-02-09 Thread Jonathan M Davis
On Sunday, February 09, 2014 19:18:05 Dicebot wrote: > Usage of selective imports is also encouraged. Not so much. At least, not right now. They don't work right and tend to cause symbol conflicts: https://d.puremagic.com/issues/show_bug.cgi?id=314 https://d.puremagic.com/issues/show_bug.cgi?id=

Re: "Global" imports vs scoped imports

2014-02-09 Thread Jonathan M Davis
On Sunday, February 09, 2014 19:12:19 Jeremy DeHaan wrote: > I am working on a library, and I put all imports at the top of my > source files under the module declaration. I was starting to > think that it might be a good idea to start scoping some imports > to reduce the number that might be used

Re: Check if path is child of directory

2014-02-09 Thread Jeroen Bollen
On Sunday, 9 February 2014 at 21:02:59 UTC, Jeroen Bollen wrote: I'm building a webserver using the Vibe.d library. Whenever the user requests a page inside my /images/ folder; I want them to output this file. Because there will be a lot of images present, and because these are likely to chan

Check if path is child of directory

2014-02-09 Thread Jeroen Bollen
I'm building a webserver using the Vibe.d library. Whenever the user requests a page inside my /images/ folder; I want them to output this file. Because there will be a lot of images present, and because these are likely to change in the future, I would like to just get the URL from the reque

Re: "Global" imports vs scoped imports

2014-02-09 Thread Dicebot
On Sunday, 9 February 2014 at 19:12:21 UTC, Jeremy DeHaan wrote: I am working on a library, and I put all imports at the top of my source files under the module declaration. I was starting to think that it might be a good idea to start scoping some imports to reduce the number that might be use

"Global" imports vs scoped imports

2014-02-09 Thread Jeremy DeHaan
I am working on a library, and I put all imports at the top of my source files under the module declaration. I was starting to think that it might be a good idea to start scoping some imports to reduce the number that might be used by a giving project, but how beneficial is this? Are there any

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Jakob Ovrum
On Sunday, 9 February 2014 at 13:48:36 UTC, Philippe Sigaud wrote: callbacks[attribute.Name] = mixin("&" ~ symbol); callbacks[attribute.Name] = &mixin(symbol);

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Philippe Sigaud
On Sun, Feb 9, 2014 at 2:10 PM, Tim Volckmann wrote: > That's also possible... but how can I find all functions with MyUDA? Here is a possibility: *** module myUDAFunctions; import std.stdio; struct MyUDA { string Name; } @MyUDA("Function1") string myFirstUdaFunction(string myStri

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Philippe Sigaud
On Sun, Feb 9, 2014 at 2:48 PM, Philippe Sigaud wrote: > import std.stdio; > import std.traits; > import std.typetuple; Hmm, std.typetuple is not necessary. And std.traits is used only to import `isCallable`.

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Jakob Ovrum
On Sunday, 9 February 2014 at 13:10:14 UTC, Tim Volckmann wrote: That's also possible... but how can I find all functions with MyUDA? There is no global list of symbols with a given UDA, you have to search using __traits(allMembers) and such. the allMembers trait can be used on modules. If

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Tim Volckmann
On Sunday, 9 February 2014 at 13:03:47 UTC, Jakob Ovrum wrote: On Sunday, 9 February 2014 at 12:48:36 UTC, Tim Volckmann wrote: Any way to do something like this? No, associative arrays cannot be transferred from compile-time to runtime yet, due to implementation issues. The next best thing

Re: Resolve function pointers using UDA during CT

2014-02-09 Thread Jakob Ovrum
On Sunday, 9 February 2014 at 12:48:36 UTC, Tim Volckmann wrote: Any way to do something like this? No, associative arrays cannot be transferred from compile-time to runtime yet, due to implementation issues. The next best thing you can do is to use a module constructor with a generated body

Resolve function pointers using UDA during CT

2014-02-09 Thread Tim Volckmann
Hi guys, is there any way to create an function-array during CT using UDAs like the following: module myUdaFunctions; struct MyUDA { string Name; } @MyUDA("Function1") string myFirstUdaFunction(string myString) { // ... do something } @MyUDA("Function2") string mySecondUdaFunction(str

Re: Avoiding allocation in broadcast server

2014-02-09 Thread Casper Færgemand
On Saturday, 8 February 2014 at 17:49:24 UTC, Kagamin wrote: Client reads from the client? And what does the server? Server reads from client and broadcasts to clients.