January 07, 2008
Don Clugston pisze:
> But a solution to the literal problem would be impressive.

Interesting... So it seems that its time for user defined literals? I saw another post in D.learn about big int literals. Also it would much nicer to initialize Date with human readable format....

Maybe something like this:

---

// l denotes literal or even without l{}
Date date = l{2008-01-07};

---
class Date {
	Date literal(string) {
		Date result;
		//... do the job on compile time:
		//parse and create proper class
		return result
	}
}

---

... when class defines compile time constructor function it tries to apply it for user literal.

Just quick idea without deeper analysis...

What do you think?

BR
Marcin Kuszczak