Breaking up is hard to do (to member functions)
Want to bounce this off some other coders before I make a language-change proposal of it:
C#’s “partial” class type lets you spread a class definition across multiple files. But mostly people use it as a way to make private code definitions private – split large functions up into little nuggets that don’t get exposed in the primary API while still having membership status to access member variables, etc.
The downside is: it actually lets you add crap to the class in your own definitions, forming part of the need for the “sealed” accessor type in C#.
In C++ your choice is (a) huge member functions, (b) Pimpls, (c) classes that list zillions of private members in their public API.
Seems to me, a simple combination of existing keywords would let you create non-public, compilation-unit scoped temporary member functions so you can break a large member function up without all the hassles that come from breaking a member function into private local non-member functions.
Specifically the term “private”.
By marking them this way, the following constraints/restrictions/behaviors would naturally fall out of the current language definition:
- Cannot be virtual (if it goes in the vtable, it goes in the ‘class’ def,
- Cannot be abstract (since you’d have to declare it in the class),
- Cannot share a name with a well-defined member function or variable,
- Not visible to derived classes even if they are in the same compilation unit, (as applies to any ‘private’ member)
- Cannot be an operator, (that could lead to some nightmare situations)
Cannot be static(static members aren’t limited to ‘public’ access, so there are actually good use cases for ‘private static’)
/// Header file Foo.h
class Foo {
public:
Foo() : m_bar(“”), m_i(0) {}
void bigFunction();
void otherFunction();
private:
void privateFunction();
};
/// Foo1.cpp
#include “Foo.h”
private void Foo::helper1() {
m_bar = “hello”;
m_i = 1;
}
private inline void Foo::helper42() const; // prototype variant.
void Foo::bigFunction() {
helper1(); // member call
…
helper42(); // member call
}
void Foo::helper42() const {
m_bar = “world”;
m_i = 42;
}
class Bar : public Foo {
…
void barMember() {
helper42(); // Error: it was private to Foo.
}
};
/// Foo2.cpp
#include “Foo.h”
private void Foo::helper1() {
// Legal, because helper1() was private-unit-scoped in Foo1.cpp and is thus not visible here.
}
private void Foo::privateFunction(const char* const message) {
// ERROR: The finger print is different but the name conflicts with an established
// ERROR: member function name, so this isn't legal.
}
void Foo::otherFunction() {
helper1(); // Invokes the helper1() declared in Foo2.cpp above.
…
helper42(); // Error: helper42 is only unit-visible in CPP file #1.
}
Have you ever EOLd an SSD?
I’ve heard and read various things about how SSDs die. But how do they actually die? The failure process seems like it should be more methodical than spindle drives, given less factors, so if you have X many of the same SSD drive and none of them suffer manufacturing defects, if you repeat the same series of operations on them they should all die around the same time.
If that’s correct, then what happens to SSDs in RAID? A mirror configuration isn’t necessarily going to result in the exact same sequences of write operations – which means that, at some point, your drives might become out of sync in-terms of volume sizing. Stripe, at least, has some chance of distributing the wear.
But has anyone actually deliberately EOLd SSDs in various configurations to see whether they die with dignity (and manageable degradation rates) or are people in for a shock when one day they find their SSD raid array is down to 70% capacity and is going to be dead in the water before replacements can arrive?
Windows Phone conclusion
Some time ago, I wrote about my transition from Android to Windows Phone. I don’t regret having gotten a Windows 7 Phone, but I do resent having one. Allow me to explain…
FYI: Edit&Continue was fixed in VS 2010 SP1
I was lucky enough to catch the near-footnote mention when I read the Visual Studio 2010 Service Pack 1 patch notes last year, but I’ve noticed quite a few programmers missed it – perhaps still being grief stricken at the loss of one of the greatest feature of Visual Studio ever in un-patched 2010.
Remember to turn on Incremental Linking. (See also: Linker Options that Disable Edit and Continue)
If you find it flaky, try turning on the C/C++ and Linker hotpatch options.
Caveat: It’s not supported for 64 bit.
Decent coding laptop?
My last laptop purchase was a big mistake, my Toshiba Satellite L505. Lets start with the searing heat it puts out, proceed to one of the worst laptop-mousepad designs ever and then explode in a frenzied rage and call it quits.
No – let me make it simpler. I hate this laptop with such an aggravated passion that I deliberately upgraded this non-touch device to Windows 8 Beta. I am currently between homes so the laptop is all I have at home. Fingers crossed that my fiancee, who is now also finding herself forced to use Windows 8, won’t kill me before we get settled into our permanent housing and get our desktop PCs back.
What I want, though, is a laptop that does a decent job of running Win 7 and some Linux flavor (Ubuntu/Mint; and actually runs well on Linux rather than this thing which turns the satellite into a furnace) has a decent pointer control (I’ll plug a mouse in when I play WoW) but will be comfortable to plug away on from the couch and/or bed when I get the midnight coding-munchies. (Right now I want to fiddle around with GCC 4.7 and C++11 templates to try compile-time hashing, again).
Suggestions?
“Cougamers”
Watching the Nerdist tribute to Nerd Girls with my gf, she asks “Is there a celebration of us less young gamer chicks”? I replied “cougamers” and then realized I was supposed to say “What? I’m sure Felicia Day is older than you”. But, I’ve had a lot on my mind. What with the moving from Texas to Irvine, making my first commit to WoW at my new job this week, and everything!
TV Studios: Please take my money?
I’m looking at you: HBO, Bad Robot, Frank Darabont…
You’re not getting my money thru TV companies who want me to pay for 150+ foreign language channels I can’t understand, sports and religious channels I actively do not want. Not just because they think repeating channels in different resolutions and then charging me for both somehow adds value, or because they consider 190 “on demand” channels which all just access the same service is somehow added value. But because when you guys try to make great quality shows, they struggle to get the funding they need to meet the standards of quality I expect in my entertainment because so much of that money is being spread out to those foreign-language/sports/religious channels that don’t need the money nearly so much.
So, please, guys; go google “kickstarter” or “indiegogo”. Get your heads together, hire some web geeks, and build a service that lets me pay you to entertain me with the awesome shows you’ve been trying to make for years, without the damn money-sucking middleman who blatantly fails to get what you do and what I enjoy.
I suspect I’m not alone, over 400,000 US homes have dumped pay TV this year – and it’s not about parting with some money for our shows, it’s about feeling ripped off having to spend money on crap we don’t want in return for having the quality we do want cancelled.

Recent Comments