On Tuesday, 25 April 2017 23:25:14 UTC+3, Tong Sun wrote:
>
>
> On Tue, Apr 25, 2017 at 3:42 PM, Egon wrote:
>
> I think the extra "enum" package would reduce readability. The code you 
>> are putting into package is ~10 lines of code... so the extra package 
>> doesn't reduce much typing, but it also loses enum typing... Depending on 
>> the enum, you may want to have different properties as well...
>> I chose the name "ciota" because of "custom-iota", in practice you would 
>> want something more descriptive such as "NewWeekday". 
>
>
> So the solution is easy, don't create a general purpose package for it :D
>>
>
> OK. 
>
> If going that route, and I have several enum series to define, I need to 
> define a series of almost identical functions, right? Hmm..., that'd be 
> really messy.
>

It depends what you need to do... I've shown in this thread multiple 
approaches. There probably are much more. Without knowing the context, it 
would be difficult to recommend a better one.

For example, you could define a DSL or custom generator or use some tool... 
 

+ Egon

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