On Thu, Mar 30, 2017 at 7:49 AM, Manlio Perillo
<manlio.peri...@gmail.com> wrote:
> Il giorno giovedì 30 marzo 2017 01:21:14 UTC+2, Ian Lance Taylor ha scritto:
>>
>> On Wed, Mar 29, 2017 at 2:29 PM, Manlio Perillo
>> <manlio....@gmail.com> wrote:
>> > Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha
>> > scritto:
>> >>
>> >> On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo
>> >> <manlio....@gmail.com> wrote:
>> >> > In a program I have a function that formats the time in Italian date
>> >> > format:
>> >> > dd/mm/yyyy, but, due to an oversight, I wrote the layout string as
>> >> > "02/02/2006", instead of "02/01/2006".
>> >> > This caused all the dates to be incorrectly formatted.
>> >> >
>> >> > IMHO, this is a nasty behavior.  The layout is clearly incorrect and
>> >> > the
>> >> > implementation should report an error, instead of returning an
>> >> > incorrectly
>> >> > formatted time.
>> >>
>> >> I think it would be difficult to define "clearly incorrect" in a way
>> >> that does not introduce any false negatives while remaining useful.
>> >
>> >
>> > In my case I specified stdZeroDay twice.
>> >
>> > The AppendFormat function can define some additional boolean variables:
>> >     hasYear, hasMonth, hasDay, ...
>> > and return an error if a variable is set to true more than one time.
>>
>> But it's not clearly incorrect to write
>>
>> "2006-01-02 or Jan 02, 2006"
>>
>
> I'm probably missing something, but "2006-01-02" is a valid time layout
> string.

I'm presenting that entire string as a valid time layout format.  It
is valid today, but would be invalid under your proposed change.

My point is to repeat what I said before: it is difficult to define
"clearly incorrect."

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to