Get name of enum val at compile-time?

2012-01-15 Thread Nick Sabalausky
Is there a way to get the name of an enum value at compile-time? For instance: import std.stdio; enum Foo { hello } void main() { writeln(Foo.hello); } That prints hello. But what I need is to get hello into a string at compile-time. Of course, I could just manually write a ctfe-able

Re: Get name of enum val at compile-time?

2012-01-15 Thread Jonathan M Davis
On Sunday, January 15, 2012 03:53:09 Nick Sabalausky wrote: Is there a way to get the name of an enum value at compile-time? For instance: import std.stdio; enum Foo { hello } void main() { writeln(Foo.hello); } That prints hello. But what I need is to get hello into a string at

Re: Fixed matrix rows joining

2012-01-15 Thread Peter Alexander
On 15/01/12 2:19 AM, Andrej Mitrovic wrote: I guess join() could be specialized for static arrays and then just do a dup and a cast? Would that work ok? There should be no need to allocate extra memory to do this.

output minimal .di files?

2012-01-15 Thread F i L
Given the code, test.d: import std.stdio; export void test() { writeln(Test); } compiled with: # dmd -lib -H test.d I end up with test.lib (good so far), and test.di: import std.stdio; export void test() { writeln(Test); } wtf? why is test() fully

Re: output minimal .di files?

2012-01-15 Thread Jonathan M Davis
On Sunday, January 15, 2012 12:53:05 F i L wrote: Given the code, test.d: import std.stdio; export void test() { writeln(Test); } compiled with: # dmd -lib -H test.d I end up with test.lib (good so far), and test.di: import std.stdio; export void

Re: output minimal .di files?

2012-01-15 Thread F i L
Jonathan M Davis wrote: http://stackoverflow.com/questions/7720418/whats-not-in-an-interface-file I see. Thanks again, Jonathan. I know this has been said before, but these sorts of explanations really should be part of the documentation.

Re: Constant function/delegate literal

2012-01-15 Thread Vladimir Matveev
Thanks, that was very helpful. Module initializer works like a charm. Shame I didn't find it in the documentation. Thanks again. Best regards, Vladimir.

std.mathspecial conflicts with std.math

2012-01-15 Thread Jun
It seems here isn't write place for posting this, but my phone always fail to load digitalmars.D html page. (I cannot use my computer right now.) I was making a simple program and I had to use erfc() function, which is in std.mathspecial. I needed some functions in std.math. After importing it,

Re: MX records

2012-01-15 Thread Bystroushaak
Bump with tits: (o )( o) On 5.1.2012 23:00, Bystroushaak wrote: Hi. Is there any way how to get MX records for given domain? I don't want to implement whole RFC 1034/5. I've looked at std.net.isemail, but it doesn't looks like what I need :/

Re: Fixed matrix rows joining

2012-01-15 Thread Timon Gehr
On 01/15/2012 02:38 AM, bearophile wrote: If I have a simple fixed-size matrix and I need to linearize (flatten) it, the function join() seems to not not work: import std.array: join; void main() { int[4][4] table; join(table); } test.d(4): Error: template std.array.join(RoR,R) if

Re: Constant function/delegate literal

2012-01-15 Thread H. S. Teoh
On Sun, Jan 15, 2012 at 02:21:04PM +, Vladimir Matveev wrote: Thanks, that was very helpful. Module initializer works like a charm. Shame I didn't find it in the documentation. Thanks again. [...] It's discussed briefly in Andrei's book (section 11.3, p.356). T -- If it's green, it's

Re: std.algorithm.startsWith with maximal matching

2012-01-15 Thread H. S. Teoh
On Sat, Jan 14, 2012 at 07:53:10PM -0800, Jonathan M Davis wrote: [...] Actually, if the word has to match exactly, then startsWith isn't going to cut it. What you need to do is outright strip the punctuation from both ends. You'd need something more like word =

Re: Constant function/delegate literal

2012-01-15 Thread Timon Gehr
On 01/14/2012 07:13 PM, Vladimir Matveev wrote: Hi, Is there a reason why I cannot compile the following code: module test; struct Test { int delegate(int) f; } Test s = Test((int x) { return x + 1; }); void main(string[] args) { return; } dmd 2.057 says: test.d(7): Error:

Re: std.mathspecial conflicts with std.math

2012-01-15 Thread bearophile
Jun: Hope it get fixed soon :D Hoping is not enough. Are you able to show us a small test case that gives this conflict problem? Bye, bearophile

Re: Get name of enum val at compile-time?

2012-01-15 Thread Nick Sabalausky
Jonathan M Davis jmdavisp...@gmx.com wrote in message news:mailman.388.1326617938.16222.digitalmars-d-le...@puremagic.com... On Sunday, January 15, 2012 03:53:09 Nick Sabalausky wrote: Is there a way to get the name of an enum value at compile-time? For instance: import std.stdio; enum Foo

Re: Get name of enum val at compile-time?

2012-01-15 Thread Nick Sabalausky
Timon Gehr timon.g...@gmx.ch wrote in message news:jevefv$2je6$1...@digitalmars.com... On 01/15/2012 09:34 PM, Nick Sabalausky wrote: import std.conv; enum Foo { hello } enum x = to!string(); enum x = to!string(Foo.hello); Goddamnnit, what the fuck is wrong with me? Yes that works :)

Re: Get name of enum val at compile-time?

2012-01-15 Thread Timon Gehr
On 01/15/2012 10:02 PM, Nick Sabalausky wrote: Timon Gehrtimon.g...@gmx.ch wrote in message news:jevefv$2je6$1...@digitalmars.com... On 01/15/2012 09:34 PM, Nick Sabalausky wrote: import std.conv; enum Foo { hello } enum x = to!string(); enum x = to!string(Foo.hello); Goddamnnit, what

Re: Get name of enum val at compile-time?

2012-01-15 Thread Philippe Sigaud
On Sun, Jan 15, 2012 at 22:19, Timon Gehr timon.g...@gmx.ch wrote: Nick: Goddamnnit, what the fuck is wrong with me? Yes that works :) I suspect a better error message would have prevented this. DMD still has some potential of improvement in that area. =) In that case, to!(Origin, Target)

Re: Get name of enum val at compile-time?

2012-01-15 Thread Peter Alexander
On 15/01/12 10:29 PM, Philippe Sigaud wrote: On Sun, Jan 15, 2012 at 22:19, Timon Gehrtimon.g...@gmx.ch wrote: Nick: Goddamnnit, what the fuck is wrong with me? Yes that works :) I suspect a better error message would have prevented this. DMD still has some potential of improvement in that

Re: std.algorithm.startsWith with maximal matching

2012-01-15 Thread Jonathan M Davis
On Sunday, January 15, 2012 11:23:04 H. S. Teoh wrote: On Sat, Jan 14, 2012 at 07:53:10PM -0800, Jonathan M Davis wrote: [...] Actually, if the word has to match exactly, then startsWith isn't going to cut it. What you need to do is outright strip the punctuation from both ends. You'd

Re: output minimal .di files?

2012-01-15 Thread Jonathan M Davis
On Sunday, January 15, 2012 11:16:51 H. S. Teoh wrote: On Sun, Jan 15, 2012 at 01:39:05PM +0100, F i L wrote: Jonathan M Davis wrote: http://stackoverflow.com/questions/7720418/whats-not-in-an-interface-f ile I see. Thanks again, Jonathan. I know this has been said before, but these

OOP Windows

2012-01-15 Thread DNewbie
Is there a D version of this type of tutorial? https://www.relisoft.com/win32/index.htm