Talk:Discordian date: Difference between revisions

+ D entry section
(→‎Leap Years: Do it the easy way!)
(+ D entry section)
Line 20:
 
: Match the Gregorian year definition, as trying to deal with other kinds of calendar turns the task into a ridiculously awkward one. –[[User:Dkf|Donal Fellows]] 09:30, 21 January 2011 (UTC)
 
== D Entry ==
 
Some rationale for the changes in the D entry:
 
- For browser screens with a not high resolution it's better to keep lines of code short. For Rosettacode code I use about 72-73 chars max for line.
 
- To keep code readable it's usually better to keep the then/else clauses on their own lines.
 
- Variables should be immutable (or const, where immutable is not possible) unless they have to mutate or unless some compiler bug (or the design of ranges) makes immutable/const unusable.
 
- The scope of variables should be minimized. So arrays like 'seasons' can go in the function scope and avoid polluting the module namespace.
 
- Some variable names like dYear now have an upper case in the middle to underline their inner words. It's normal D style.
 
- Currently the format() function is not pure nor nothrow, but maybe in future it will become pure. So I keep some commented out code like /*pure*/ that are meant to be replaced by code in future if and when Phobos improves (I replace such comments all the time in Rosettacode entries because Phobos keeps improving).