Literals starting with 0 will not work with UFCS

Jonathan M Davis jmdavisProg at gmx.com
Wed Jul 4 16:55:03 PDT 2012


On Thursday, July 05, 2012 01:44:19 Jonathan Andrew wrote:
> The one exception I found to starting literals with 0 is when
> using dates - using the DateTime module (excellent write-up,
> btw!) and having to pass dates like 07/04/09 as 7, 4, 9 without
> the leading 0 is kind of awkward, for me at least. Minor gripe.

Yeah. I ended using leading 0's in that code all over the place without even 
thinking about it, since it's so natural to do with dates, but it works fine as 
long as you don't need 08 or 09. I believe that that's the only place that 
I've really used numeric literals with a leading 0 though. I don't remember 
why 08 and 09 aren't legal though, since they clearly aren't octal literals. 
Oh well, it's a bit annoying, but as you say, it's a minor gripe.

And yay, someone who's actually happy with std.datetime! Actually, several 
people have been quite happy with it, but with all things, it's the complaints 
that people generally bother to voice, and as simple and std.datetime is to 
use, it's a lot to take in. I really need to split it up into separate modules 
so that the documentation is easier to digest, but I'd like something like DIP 
15 or 16 implemented before doing that (which would make it possible to split 
up std.datetime into a std.datetime package with std.datetime.systime, 
std.datetime.date, etc. without breaking code, whereas right now, they have to 
go in a new package). I also need to finish revising the unit tests. So much to 
do...

Oh well, it works great as it is now, and it's good to hear that my article on 
std.datetime helped you understand it. Actually, I think that the questions on 
std.datetime have gone down considerably since I wrote it, so I guess that 
it's doing its job.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list