Link Details

Link 100154 thumbnail
User 111696 avatar

By bloid
via theserverside.com
Published: Aug 01 2008 / 17:03

What if you want to add one more day? Usually, you can't, and you may say: "why would I want to do that?". Well, let's say we just want to. If you are interested about my use case, see at the end.
  • 9
  • 2
  • 1919
  • 452

Comments

Add your comment
User 191349 avatar

raveman replied ago:

0 votes Vote down Vote up Reply

unit testing for enums will be crazy.

User 187417 avatar

sproketboy replied ago:

0 votes Vote down Vote up Reply

"Why would I want to do that?. Well, let's say we just want to."

Huh? The author provides no reason to do this except for hack effect. 22 lines of code written to subvert the type safe enum pattern and it gets 7 up votes? People - work with me here.

Instead of hacking - if you have a List of things that might be variable you might try using - say - a List? Just a suggestion.

User 321431 avatar

fluminis replied ago:

0 votes Vote down Vote up Reply

I don't understand why he woud do such a thing.

By definition a Enum is something which is finite and that will not change. The developer is going to use it and this allow him not to use another value than the one define in the enum...

I can't see the point, adding a value dynamicly during at execution time.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (9)



Voters Against This Link (2)