We've been here a few times, as I recall:
- Next Friday the 13th and my own
- Day of the week of the next Feb 29th
- How much snow did you get? and my own
All of those solutions may or may not fail, depending on the user's locale when executing them. I for one strive to solve problems that are robust under those assumptions, but is it viable to assume some common execution environment for golfing?
The problem then is that you can offload quite a bit to your locale – I'm using German with ISO-8601 date format, so I usually cannot use format strings to output fractional numbers, but I can just use the short date format {0:d}
to output dates in YYYY-MM-DD
which obviously is a slight advantage when that's the desired output format for a program. I suffer again with days of the week which come out as Montag
instead of Monday
but that's fine since I have enumeration values in English handy.
Of course, such things could be handled in the individual tasks, but maybe a general guideline would be better.
Another way to circumvent this would probably be to restrict oneself to exact string output or integral numbers (floating-point numbers may be given in a variety of formats with ,
as the decimal point or some languages might do scientific notation with e+25
by default, so they may require some working around in some cases). To put all date solutions on a common ground this might call for a very custom format, made-up names of the days or just the day number.
Or we could just say that all solutions are expected to be run in a en-US
locale.
Am I seeing problems where none are? :-)
It's just that I find solutions that require different degrees of preconditions hard to compare with each other.