[haiku-commits] Re: haiku: hrev45604 - src/kits/interface headers/os/interface

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Fri, 3 May 2013 12:49:41 -0400

On Fri, May 3, 2013 at 12:31 PM, Urias McCullough <umccullough@xxxxxxxxx> wrote:
> On Fri, May 3, 2013 at 9:20 AM, John Scipione <jscipione@xxxxxxxxx> wrote:
>> It's so much simpler to say, hey I need a BMessage, I need a BRect,
>> and I need a BPoint than just blindly guess that those classes have
>> been declared somewhere else and wait for the compiler to correct me.
>>
>> Is there nobody who can see where I'm coming from here?
>
> If you're going to follow that line of logic, then you should include
> a full list of all headers your code might depend on in every file
> where they're used - rather than relying on the headers you include to
> already have included them. After all, header guards should
> potentially prevent any issues right? However, this would likely be an
> absolute nightmare to deal with later when someone needs to start
> refactoring/changing headers around.

No no no no no no, don't twist my words, I never said that. Doing that
would include the entire header file because an #include is just a
text expansion macro. The headers guards would allow the compiler to
eliminate the code in the end, but, it still has to parse all the text
first. That is not the same thing as what I'm advocating, in fact it's
quite the opposite.

> I believe the simplicity you're referring to isn't exactly what most
> developers view as simplicity. Encouraging every code file to "stand
> alone" is pretty much going in the opposite direction of code reuse
> and modularity that most people strive for.

I disagree, for something like BRect it's overkill, odds are that will
be included, but what about something more exotic like BShape or
BEntry? Those might be included only by happenstance. You use them,
the compiler doesn't complain so you go about your day. Then later on
somebody comes along and changes things and then BOutlineListView all
of a sudden breaks even thought they were touching a complete
unrelated class. Where do you draw the line? For me it's simple,
declare what you use and everything works, don't, and you roll the
dice.

> Anyhow, I'll stop responding on this thread now, as it's become a bit
> abusive of the commits list :)

seems to happen a lot...

Other related posts: