Boost logo

Boost :

From: Justin M. Lewis (boost_at_[hidden])
Date: 2003-04-24 11:26:52


No, I'm not assuming that.
Again, I think the point here is being missed. I can't make anyone do much
of anything in their code, that's why we have functions that go on for 10k
lines.

I CAN however specify in my code what types of params will be taken by MY
functions, so at the very least, the USE of my stuff is clear when someone
else is using it. It's by no means perfect, but it IS helpful. And, again,
if you just declare functions like
void myfunc(int &x, int const &y);

I STILL have to go track down that declaration to find out what's happening
there, because at the point of invocation all I see is
myfunc(x, y);

Now, you have 10's of different functions being called on x, and you KNOW x
is changing, the question now is WHERE is it changing, so now I have to go
track down every single function prototype that is called on x to see which
one is the problem.

Now, if I write all of the libraries using my wrapper class, someone else
comes along to debug some code that's using my library, it's OBVIOUS where x
is being changed.

And, sure, you don't HAVE to change x in the function, but, you don't HAVE
to change x when you have
void myfunc(int &x, int const &y);
either.

Obviously at some point you need someone writing code conforming to some
kind of guidelines. I'm happy to do that, the problem is that so few others
are, which makes maintaining the code I've currently got at work a
NIGHTMARE. So, my theory in the creation of this wrapper was that I can
enforce the use of this class, so, as long as I'm writing the libraries to
be used by everyone else, everyone else's code will be at least a little
more clear.

----- Original Message -----
From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Thursday, April 24, 2003 8:39 AM
Subject: Re: [boost] Re: class proposal

> "Justin M. Lewis" wrote:
> >
> > I diagree with this. The code I've written using this looks more like
> >
> > void add_char( in_out<std::string> str, char ch)
> > {
> > std::string &s = str;
> > s += ch;
> > }
>
> I think you're assuming everyone will code the way you want. If you're
> going to force everyone to code this way, why not just have them code
> like:
>
> void add_char( std::string& str_, char ch_ )
> {
> str += ch;
> }
>
> int len( std::string const& str )
> {
> return str.length();
> }
>
> What is the added value of the proposed class? It's not that it forces
> people to change the value if it's used:
>
> int len( in_out< std::string > str )
> {
> return static_cast< std::string& >( str ).length();
> }
>
> Noel
> --
> NOTICE: If received in error, please destroy and notify sender. Sender
> does not waive confidentiality or privilege, and use is prohibited.
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk