Jul
28
comment Why doesn't narrowing conversion used with curly-brace-delimited initializer cause an error?
Which version of g++ are you using? Mine is `g++ (Debian 4.9.2-10) 4.9.2'.
Jul
28
asked Why doesn't narrowing conversion used with curly-brace-delimited initializer cause an error?
Jul
23
accepted How to disable right justification in the entire document including tabularx environment?
Jul
23
asked Is it possible in Linux to have the two connections from the same client port to different server ports?
Jul
22
awarded Popular Question
Jul
20
awarded Yearling
Jul
20
awarded Yearling
Jul
20
asked How to disable right justification in the entire document including tabularx environment?
Jul
20
accepted How to align the left edge of text in table with the section heading?
Jul
20
asked How to align the left edge of text in table with the section heading?
Jun
27
accepted Simplified visitor pattern
Jun
26
comment Simplified visitor pattern
I am a little confused about how visitor pattern makes it any more harder to modify the hierarchy of visitable classes than non-visitor pattern (i.e. operations such as evaluate(), print(), etc. defined in visitable classes) does. In a non-visitor pattern, if the hierarchy between visitables change, then each operation method defined in each affected visitable has to be modified. In a visitor pattern, in each visitor class, the visit() method for each affected visitable needs to be modified. Sounds like equal amount of work in both cases.
Jun
26
revised Simplified visitor pattern
added 617 characters in body
Jun
26
comment Simplified visitor pattern
Thank you for your answer. I have now edited the code to throw an exception in the else part to account for unsupported node types. So now if we introduce a SubtractNode, the code would still continue to compile although it would throw an exception at runtime if SubtractNode is encountered. But the fact that it would still continue to compile seems like a good point that demonstrates that the simplified version is difficult to maintain as compared to the apply()-visit() pattern.
Jun
26
revised Simplified visitor pattern
deleted 24 characters in body
Jun
26
revised Simplified visitor pattern
deleted 24 characters in body
Jun
26
asked Simplified visitor pattern
Jun
21
accepted Why are dependency graphs not represented as bi-directional acyclic graphs?
Jun
21
revised What magic does staticmethod() do, so that the static method is always called without the instance parameter?
added 2 characters in body
Jun
21
accepted How to trim leading and trailing whitespaces from a string value in a variable?
1 2 3 4 5