I think that is not a good idea.
First of all, I can't define these consts everywhere,so I have to create a 
new package(eg:mytime) to define them.
And then, client package may use like this:
import(
"time"
".../mytime"
)
dur2WeeksAnd7Hours := mytime.Week*2+time.Hour*7
I think this code may make the clients crazy...

在 2016年9月26日星期一 UTC+8上午12:21:55,Jan Mercl写道:
>
> On Sun, Sep 25, 2016 at 6:07 PM Ally Dale <vip...@gmail.com <javascript:>> 
> wrote:
>
> > Exactly, I desired my extension code can be like this:
> type Duration time.Duration
> const Duration.Day = Duration(time.Duration.Hour*24)
> const Duration.Week = Duration(Duration.Day*7) 
>
> I'm perhaps missing something, but you can simply define your own typed 
> constants (of type time.Duration) w/o "extending" type time.Duration.
>
>         const (
>                 Day = time.Hour*24
>                 Week = Day*7
>         )
>
> BTW: Note that the above values of Day and Week constants are incorrect. 
> That's why they do not exist in package time.
>
> -- 
>
> -j
>

-- 
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