Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread Kagamin
shd Wrote: 2011/7/12 Kagamin s...@here.lot: You want an IOC container like Unity? exactly And you want the interface-to-class mapping to be configurable externally rather than version out these classes directly in source? like version(UseGL) { �static import wrappers.gl;

Re: This seems like what could be a common cause of bugs

2011-07-13 Thread Kagamin
Steven Schveighoffer Wrote: On Tue, 12 Jul 2011 11:07:57 -0400, Kagamin s...@here.lot wrote: Steven Schveighoffer Wrote: Yes, but this is getting into territory where the false positive rate might get high. I bet it will be difficult to find a real-world example of this false

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread shd
2011/7/13 Kagamin s...@here.lot: Hmm... If you have wrappers/gl/guiImpl/... and wrappers/what/guiImpl/... and conditionally add them to includes for example with -I wrappers/gl you should be able to import guiImpl; and use guiImpl.Window. If it's -I wrappers/what, guiImpl.Window is still

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread shd
2011/7/13 Jesse Phillips jessekphillip...@gmail.com: After reading Kagamin's response, I'm not sure I understand you still. You want to have code reuse, you want to have run-time and compile-time configuration, but you don't want to make use of the technologies/techniques/patterns which

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread Dmitry Olshansky
On 13.07.2011 15:39, shd wrote: I hope i didn't bored you too much with my imagination because there is something more i don't like. Directory hierarchy :) It's not D-related though. Understanding a risk of going completely OT: you are not alone on this one :) Time ago I thought of something

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Trass3r
Anybody an idea?

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Stephan
On 12.07.2011 15:06, Trass3r wrote: Is this a bug? If not, how do you make it work? void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { } } void main() { Bla b = new Bla(); b.blub(); } test.d(18): Error: template instance cannot use local 'f' as

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Steven Schveighoffer
On Tue, 12 Jul 2011 09:06:56 -0400, Trass3r u...@known.com wrote: Is this a bug? If not, how do you make it work? void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { } } void main() { Bla b = new Bla();

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Trass3r
Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer schvei...@yahoo.com: void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { g(); } } As a workaround, is there a reason you need blub to be

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/13/2011 11:35 PM, Trass3r wrote: Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer schvei...@yahoo.com: void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { g(); } } As a workaround, is there a reason you need blub to be

Re: Declaring a D pointer to a C function

2011-07-13 Thread Daniel Murphy
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.1569.1310506439.14074.digitalmars-d-le...@puremagic.com... Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback is expected should be an error, and this is like the 10th

Re: Declaring a D pointer to a C function

2011-07-13 Thread Andrej Mitrovic
On 7/13/11, Daniel Murphy yebbl...@nospamgmail.com wrote: Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.1569.1310506439.14074.digitalmars-d-le...@puremagic.com... Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Trass3r
Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(typeof(f) g = f)

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Trass3r
I've seen this error before... *searches memory and old code* Here you go: http://d.puremagic.com/issues/show_bug.cgi?id=3051 I think this is yet another issue. The inner template argument is not something on the stack but it is a template argument.

Re: Declaring a D pointer to a C function

2011-07-13 Thread Daniel Murphy
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.1607.1310570915.14074.digitalmars-d-le...@puremagic.com... Thanks! I've literally lost an entire day once when I was just starting using D and C together and had a calling convention mismatch. :x It's worse than just

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread Jesse Phillips
shd Wrote: 2011/7/13 Jesse Phillips jessekphillip...@gmail.com: You say no to libraries That's not true! I'm not sure how did you came up to this conclusions, but i love libraries for applications same as command-line programs (like ffmpeg) for GUI apps. It comes from, and APIs are not

Re: Declaring a D pointer to a C function

2011-07-13 Thread Steven Schveighoffer
On Wed, 13 Jul 2011 11:32:50 -0400, Daniel Murphy yebbl...@nospamgmail.com wrote: Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message news:mailman.1607.1310570915.14074.digitalmars-d-le...@puremagic.com... Thanks! I've literally lost an entire day once when I was just starting using

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread shd
2011/7/13 Dmitry Olshansky dmitry.o...@gmail.com Time ago I thought of something more like tag based file system, where filetypes and e.g. date of modification are just that  - one of myriad of tags, besides any additional that are user/system defined. Though I have never reached any more or

Re: Centralizable configured compile-time class instantiation

2011-07-13 Thread shd
2011/7/13 Jesse Phillips jessekphillip...@gmail.com: shd Wrote: 2011/7/13 Jesse Phillips jessekphillip...@gmail.com: You say no to libraries That's not true! I'm not sure how did you came up to this conclusions, but i love libraries for applications same as command-line programs (like

Re: String Appender Fails (Memory Allocation Failure)

2011-07-13 Thread Loopback
On 2011-07-14 01:11, Loopback wrote: Hello! I've been working on a project where I had to do all memory handling explicitly because no destructors were called. When I got too tired of the explicit memory handling I decided to trace what was causing this error. After hours of code stripping I

String Appender Fails (Memory Allocation Failure)

2011-07-13 Thread Loopback
Hello! I've been working on a project where I had to do all memory handling explicitly because no destructors were called. When I got too tired of the explicit memory handling I decided to trace what was causing this error. After hours of code stripping I had gotten myself a small concrete

Re: String Appender Fails (Memory Allocation Failure)

2011-07-13 Thread David Nadlinger
On 7/14/11 1:11 AM, Loopback wrote: Now the program calls Runtime.terminate, which is supposed to take care of the memory garbage and etc. This does not work. The terminate function call throws an Error, Memory Allocation Failure. This failure originates in the 'Foo' destructor, which in turn

Re: String Appender Fails (Memory Allocation Failure)

2011-07-13 Thread Loopback
On 2011-07-14 01:17, David Nadlinger wrote: Currently, no memory can be allocated at all during garbage collection runs, which is where destructors are usually called. David That explains it. Do you know when this feature will be available, if at all? Here is another interesting case, where

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/14/2011 12:24 AM, Trass3r wrote: Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f) {

Re: template instance cannot use local 'f' as parameter to non-global template

2011-07-13 Thread Tyro[a.c.edwards]
On 7/14/2011 12:24 AM, Trass3r wrote: Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f) {

tiny web server in D

2011-07-13 Thread Dr.Smith
While the following D program runs without compiler error, it seems unable to serve a web page. Is there a better way? import std.socket, std.string; void main() { Socket listener = new TcpSocket; assert(listener.isAlive); listener.bind(new InternetAddress(8080));

Re: tiny web server in D

2011-07-13 Thread Jos van Uden
On 14-7-2011 5:48, Dr.Smith wrote: import std.socket, std.string; void main() { Socket listener = new TcpSocket; assert(listener.isAlive); listener.bind(new InternetAddress(8080)); listener.listen(10); string webpage = index.html; Socket currSock; uint