On 22. Jun 2011, at 17:30, Daniel Pfeifer wrote: >>> Both createRenderer() and createViewData() return (dumb) pointers. I am not >>> suggesting to replace RefPtr by shared_ptr. I am suggesting to use (really) >>> smart pointers where dumb pointers are used currently. >> >> Smart pointers are useful if the ownership of an object is not >> clearly defined. They tend to encourage people to not think about >> ownerships and therefore can lead to bad design. I don't see what >> value a smart_ptr brings here. > > Exactly what you said. The pointers returned from the above functions do not > have a clearly defined ownership (the factory should be able to create and > forget them), which makes them perfect candidates for smart pointers.
They have a clearly defined ownership (Application and View, respectively). The factory can create and forget them. It *might* want to override the destroy precisely in the case that it uses whichever smart pointer implementation for whatever reason. > If an object has a clearly defined ownership, pointers would bring no value > (smart or dumb), you also could use references in that case. Correct, except that they are not set in the ctor and reference member variables can't be reset. One could reference and dereference the pointer accordingly to use a reference in the API - but what would be the point in that? >> ... you hide the >> complexity in the bind which makes it harder to use and understand for >> mere mortals. You, and to a certain degree I, have no problem writing >> and understanding this, but *imo* it adds nothing in clarity or >> accessibility. I guess we'll never reach stable ground on this type of >> discussion, but that doesn't mean that we have a stalemate. > > C'mon, this is not some Voodoo like Boost.Proto or Boost.Fusion, this is just > a lambda. Students learn stuff like that on the Bachelor level nowadays. How > low does the entry level need to be? (This is a serious question, not meant > to offend anybody.) Sure, no offense taken. I value these discussion since they are very helpful for me. The average level is lower then you think. Right now I work in a project where Neuroscientist do programming. I agree that this should not be the case - but it's reality. Another example is HPC, where *some* people work at a lower level for performance reasons. MPI is still a C API, after all. And yes, I've heard about boost::mpi. ;) Cheers, Stefan. _______________________________________________ eq-dev mailing list [email protected] http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev http://www.equalizergraphics.com

