12,717 reputation
11847
bio website
location
age
visits member for 3 years
seen 7 hours ago

Nov
11
comment Unit testing to prove balanced tree
The appropriate invariant of red-black tree is "Every path from a given node to any of its descendant leaves contains the same number of black nodes." And only that many red nodes, because red node may only have black children.
Nov
8
comment Side effect-free interface on top of a stateful library
Well, if the state exists, it won't go away. The trick is to create something that will keep track of the dependency. The standard Haskell answer is "monads" or the more advanced "arrows". They are a bit hard to wrap your head around and I never really did, so somebody else would have to try explaining them.
Oct
24
revised What's is the point of PImpl pattern while we can use interface for the same purpose in C++?
added 80 characters in body
Oct
24
comment What's is the point of PImpl pattern while we can use interface for the same purpose in C++?
@ThomasEding: Difference between P1 and I1 is, that is pimpl case the wrapper method in the public class is non-virtual (and adding even virtual method on the pimpl itself is ok; it's not part of the ABI), while all public methods of an interface are virtual (that's a definition of interface) and those can't be added without breaking the ABI. You are right about P2.
Oct
23
awarded  Nice Answer
Oct
22
comment Is “Free for non-commercial use” license compatible with GNU GPLv3 license?
@DougM: Those are not two separate cases. Work under GPL cannot be combined with work licensed "non-commercial", ever, in any way, at all, period.
Oct
22
revised The balance between client and server functionality
Typography. Always make space after interpunction.
Oct
22
comment Why do programming languages allow shadowing/hiding of variables and functions?
@Ӎσᶎ The problem is not that it could't fail, but that such language would not be usable. Because projects do need to upgrade their dependencies.
Oct
22
comment Why do programming languages allow shadowing/hiding of variables and functions?
While formally the IEnumerable<T>.GetEnumerator() hides the IEnumerable.GetEnumerator(), this is only because C# does not have covariant return types when overriding. Logically it is an override, fully in line with LSP. Hiding is when you have local variable map in function in file that does using namespace std (in C++).
Oct
22
comment Why do programming languages allow shadowing/hiding of variables and functions?
@Giorgio: Would you make your comment into an answer? It seems to be the only really relevant point around.
Oct
22
comment Why do programming languages allow shadowing/hiding of variables and functions?
Overriding is not hiding. I don't agree with @Phil that this addresses the question.
Oct
18
comment Macro vs. Static functions in Header
I would actually suspect most of these are historical reasons. Ages ago, the C compilers didn't inline functions at all. So people used macros for things they wanted inlined. C code is usually unusually long-lived.
Oct
18
answered TotalPhase Aardvark driver's GPL license
Oct
16
comment How to maintain a forked git repo with feature branches that upstream won't pull?
@alexgray: That's why I am not writing it as answer, but as comment.
Oct
16
comment How to maintain a forked git repo with feature branches that upstream won't pull?
Gratuitous changes to formatting are not going to be accepted to any single project I've ever heard of and if you insist on keeping them in your repository, welcome to your little personal well deserved merging hell. If you just cleaned up warnings, most probably it would be accepted, though you might still be asked to send it split to reasonably sized chunks. Even changes to make formatting self-consistent might be accepted. But changes that change formatting to different one never are. Because everybody else is used to the current formatting and because it will cause problems with merging.
Oct
16
revised Strategy for code review before merge to master from feature branches
minor grammar nit
Oct
16
comment Strategy for code review before merge to master from feature branches
@michipili: I understand it. But a random beginner looking for guidance won't. Please, clarify it in the answer itself.
Oct
15
comment Strategy for code review before merge to master from feature branches
@stijn: --no-ff has it's up and downsides. I personally find it more noise than anything. YMMV.
Oct
15
revised Strategy for code review before merge to master from feature branches
more about how it works in Linux
Oct
15
revised Strategy for code review before merge to master from feature branches
added 552 characters in body