lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 08/08/2013 0.40, Rena wrote:
> On Tue, Aug 6, 2013 at 10:54 AM, Craig Barnes <craigbarnes85@gmail.com
> <mailto:craigbarnes85@gmail.com>> wrote:
> 
>     On 6 August 2013 15:23, Miles Bader <miles@gnu.org
>     <mailto:miles@gnu.org>> wrote:
>     >
>     > Nasty...  Go is like a bundle of bad decisions all nicely packaged for
>     > convenient use. ><
>     >
>     > -miles
> 
>     Semicolon insertion is the only obviously ugly thing I've found with
>     Go so far. What else is there?
> 
> 
> Check out how it handles dates: http://golang.org/src/pkg/time/format.go
> 
> -- 
> Sent from my Game Boy.

Ah! Yes!

I never looked at the implementation, but the way you specify dates is
*WEIRD*.

I've always thought it was difficult to remember all those C time format
strings (%H, %Y, %whatever...) ... until I saw Go time package!
At least most C placeholders make sense.

I remember I spent half an hour to try to understand why a stupid
20-liner didn't work - then I reread very carefully the docs just to
discover that I gave for granted they used C-like format strings (mental
note to myself ALWAYS RTFM - you really *never* know :-)

I had to reread the API docs of Time.Format a couple of times before my
brain accepted the fact that they wanted me to remember a SPECIFIC date
(wait, ... was it 5 seconds or 5 minutes? And the year? ugh!)

Let alone all those magic numbers sprinkled all over the code!!!
The rationale behind that choice is utterly incomprehensible to me. What
should the advantage be of writing:

fmt.Println(time.Now().Format("2006-01-02 03:04"))

instead of say (made up syntax):

fmt.Println(time.Now().Format("%Y-%m-%d %H:%M"))

Supposed readability? For an absolute newbie in programming maybe, but
any mediocre programmer should be well aware of the meaning and
advantages of symbolic representations.

<hyperbole> That's even worse than sprinkling math code with 3.14
numbers instead of some PI constant. In this latter case, at least, 3.14
is a well known beast. </hyperbole> :-)


WEIRD!


-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments