Re: SourceComment: BItem hierarchy - Removing needless code…

Hi Atul, you are perfectly right about this refactoring!

If we go a step further we can get rid of type() altogether and use the RTTI instead. For example:

if (typeid (*item) != typeid (BString))
...

I guess that typeid() is just like a virtual call anyway, so it will not be less efficient. We can get rid of type() functions in a number of classes ;-)

Is there something with typeid() I’m missing? Let me know what you think?

Best regards,

Peter

atul wrote:Dear all

While reading BDecoder code, I came upon this class. I think we are storing redundant type info here….

Here is a patch that removes a lot of code

Let me know..

Btw, I generated the patch thru bzr… This is a superb tool, thanks Peter for introducing me to it… I am going to try the vimdiff plugin today some time… ;-)

—cheers atul

Would you like to post a relpy?


This post is a reply to:
SourceComment: BItem hierarchy - Removing needless code…
Dear all While reading BDecoder code, I came upon this class. I think we are storing redundant type info here.... Here is a patch that removes a lot of code Let me know.. Btw, (more...)

Follow-ups:
Re: Re: SourceComment: BItem hierarchy - Removing needless code…
Hi Peter I think depending on types is going against the OO grain. Then how could we design BItem? Here is one idea... 1. Push the parsing to BItem concrete classes ( So (more...)