Timeline for Generic Calculator and Generic Number
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 10, 2013 at 19:28 | comment | added | Jesse C. Slicer |
@MartinMulder it's looser - not completely decoupled. The key is creating an interface out of Calculator . My line private static readonly ICalculator<T> defaultCalculator = Calculator<T>.Instance; is what keeps it coupled to the implementation.
|
|
May 10, 2013 at 19:25 | comment | added | Martin Mulder |
@Jesse: Thank for you review. I greatly appreciate it. I also though about put the struct as a contraint. But what if somebody decides to create his own numeric class (like a vector, or complex or whatever. And he does not create a struct but a class. Than this system would not work anymore. So I left it out, because it costs only one compare with null (if I remember correctly). Can you please explain to me how your code is losely coupled?
|
|
May 10, 2013 at 19:19 | history | edited | Jesse C. Slicer | CC BY-SA 3.0 |
removed mention of monad.
|
May 10, 2013 at 19:18 | comment | added | Jesse C. Slicer | @svick you're right. | |
May 10, 2013 at 17:21 | comment | added | svick |
Monad? I don't see any monad in there. The definition of monad is that it has bind and return functions that behave in a specific way and there is nothing like that here.
|
|
May 10, 2013 at 15:40 | history | answered | Jesse C. Slicer | CC BY-SA 3.0 |