www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RAII -- a misnomer?

reply Georg Wrede <georg.wrede nospam.org> writes:
IMHO, RAII (Resource Acquisition Is Initialization) is

THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!

The name seems to refer to the beginning of resource usage _only_.

At the same time it seems that RAII is _exclusively_ about resource 
release. Grrrrrrrrrrrrr. Somebody please shoot the name inventor!!

---

My opinion: Since resources are acquired anyhow (with or without RAII) 
when they are needed, the A-word should not even exist in the name.

The term is misleading (pompous and bureaucratic) to such an extent that 
when a programmer hears it for the first time, he thinks "arrghh, 
another sick acronym: probably it's something conceptually trivial, but 
it sounds too hard to check out today". Well, time passes and he stays 
confused. (Happened to me the year I saw it in this newsgroup. Took me 
at least a couple of months before I got fed up and dug to the bottom of 
it. Geez!)

Suppose it was called RR (for Resource Release)?
================================================

I bet most anybody would grok it at first sight. Half the guys wouldn't 
even need an explanation!

((I sure hope Herb Sutter wasn't the one who invented the term. For if 
it was, then I'd accuse him of being an old man who wants to make his 
writing seem more important than it is. (Not that he'd have to, but old 
people in this proffession do end up doing that, sooner or later.)))

---

"Does your language support RR?"
"What's that?"
"Resource Release."
"Huh?"
"That resources, like files and stuff, get released when they go out of 
scope."
"Ah, sure! I use D!"

*versus*

"Does your language support RAII?"
"What's that?"
"Resource Acquisition Is Initialization."
"What the f**k???"
"Not sure, but you have to have it to be cool. Wikipedia explains it as 
'a technique that combines acquisition and release of resources with 
initialization and uninitialization of variables'".
"Oh. Sounds like some M$ s**t, maybe C# or CLI stuff?" (Too embarrassed 
to name his own language, in case it doesn't support this buzzword.)
Jan 25 2006
next sibling parent kris <fu bar.org> writes:
Well said, Georg.

Given that D is a grass-roots effort, you'd think it would avoid such 
elitisms :)


Georg Wrede wrote:
 IMHO, RAII (Resource Acquisition Is Initialization) is
 
 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!
 
 The name seems to refer to the beginning of resource usage _only_.
 
 At the same time it seems that RAII is _exclusively_ about resource 
 release. Grrrrrrrrrrrrr. Somebody please shoot the name inventor!!
 
 ---
 
 My opinion: Since resources are acquired anyhow (with or without RAII) 
 when they are needed, the A-word should not even exist in the name.
 
 The term is misleading (pompous and bureaucratic) to such an extent that 
 when a programmer hears it for the first time, he thinks "arrghh, 
 another sick acronym: probably it's something conceptually trivial, but 
 it sounds too hard to check out today". Well, time passes and he stays 
 confused. (Happened to me the year I saw it in this newsgroup. Took me 
 at least a couple of months before I got fed up and dug to the bottom of 
 it. Geez!)
 
 Suppose it was called RR (for Resource Release)?
 ================================================
 
 I bet most anybody would grok it at first sight. Half the guys wouldn't 
 even need an explanation!
 
 ((I sure hope Herb Sutter wasn't the one who invented the term. For if 
 it was, then I'd accuse him of being an old man who wants to make his 
 writing seem more important than it is. (Not that he'd have to, but old 
 people in this proffession do end up doing that, sooner or later.)))
 
 ---
 
 "Does your language support RR?"
 "What's that?"
 "Resource Release."
 "Huh?"
 "That resources, like files and stuff, get released when they go out of 
 scope."
 "Ah, sure! I use D!"
 
 *versus*
 
 "Does your language support RAII?"
 "What's that?"
 "Resource Acquisition Is Initialization."
 "What the f**k???"
 "Not sure, but you have to have it to be cool. Wikipedia explains it as 
 'a technique that combines acquisition and release of resources with 
 initialization and uninitialization of variables'".
 "Oh. Sounds like some M$ s**t, maybe C# or CLI stuff?" (Too embarrassed 
 to name his own language, in case it doesn't support this buzzword.)

Jan 25 2006
prev sibling next sibling parent Sean Kelly <sean f4.ca> writes:
Georg Wrede wrote:
 IMHO, RAII (Resource Acquisition Is Initialization) is
 
 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!
 
 The name seems to refer to the beginning of resource usage _only_.
 
 At the same time it seems that RAII is _exclusively_ about resource 
 release. Grrrrrrrrrrrrr. Somebody please shoot the name inventor!!
 
 ---
 
 My opinion: Since resources are acquired anyhow (with or without RAII) 
 when they are needed, the A-word should not even exist in the name.
 
 The term is misleading (pompous and bureaucratic) to such an extent that 
 when a programmer hears it for the first time, he thinks "arrghh, 
 another sick acronym: probably it's something conceptually trivial, but 
 it sounds too hard to check out today". Well, time passes and he stays 
 confused. (Happened to me the year I saw it in this newsgroup. Took me 
 at least a couple of months before I got fed up and dug to the bottom of 
 it. Geez!)
 
 Suppose it was called RR (for Resource Release)?

Or perhaps Value-Based Resource Management, Scoped Resource Management, etc. RAII is only a useful term because people know what it refers to, not because it is in itself particularly meaningful. Sean
Jan 25 2006
prev sibling next sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
Totally agree, man!!


Georg Wrede wrote:
 IMHO, RAII (Resource Acquisition Is Initialization) is
 
 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!
 
 The name seems to refer to the beginning of resource usage _only_.
 
 At the same time it seems that RAII is _exclusively_ about resource 
 release. Grrrrrrrrrrrrr. Somebody please shoot the name inventor!!
 
 ---
 
 My opinion: Since resources are acquired anyhow (with or without RAII) 
 when they are needed, the A-word should not even exist in the name.
 
 The term is misleading (pompous and bureaucratic) to such an extent that 
 when a programmer hears it for the first time, he thinks "arrghh, 
 another sick acronym: probably it's something conceptually trivial, but 
 it sounds too hard to check out today". Well, time passes and he stays 
 confused. (Happened to me the year I saw it in this newsgroup. Took me 
 at least a couple of months before I got fed up and dug to the bottom of 
 it. Geez!)
 
 Suppose it was called RR (for Resource Release)?
 ================================================
 
 I bet most anybody would grok it at first sight. Half the guys wouldn't 
 even need an explanation!
 
 ((I sure hope Herb Sutter wasn't the one who invented the term. For if 
 it was, then I'd accuse him of being an old man who wants to make his 
 writing seem more important than it is. (Not that he'd have to, but old 
 people in this proffession do end up doing that, sooner or later.)))
 
 ---
 
 "Does your language support RR?"
 "What's that?"
 "Resource Release."
 "Huh?"
 "That resources, like files and stuff, get released when they go out of 
 scope."
 "Ah, sure! I use D!"
 
 *versus*
 
 "Does your language support RAII?"
 "What's that?"
 "Resource Acquisition Is Initialization."
 "What the f**k???"
 "Not sure, but you have to have it to be cool. Wikipedia explains it as 
 'a technique that combines acquisition and release of resources with 
 initialization and uninitialization of variables'".
 "Oh. Sounds like some M$ s**t, maybe C# or CLI stuff?" (Too embarrassed 
 to name his own language, in case it doesn't support this buzzword.)

Jan 25 2006
prev sibling next sibling parent reply Don Clugston <dac nospam.com.au> writes:
Georg Wrede wrote:
 IMHO, RAII (Resource Acquisition Is Initialization) is
 
 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!
 
 The name seems to refer to the beginning of resource usage _only_.
 
 At the same time it seems that RAII is _exclusively_ about resource 
 release. Grrrrrrrrrrrrr. Somebody please shoot the name inventor!!

I agree. I could never understand why the term "destructor" was inadequate to describe it. Especially since "put it back when you've finished with it" is a concept which is hundreds of years old, Mind you, there have been some other dreadful misnomers in computer language history.
Jan 25 2006
parent Sean Kelly <sean f4.ca> writes:
Don Clugston wrote:
 
 I agree. I could never understand why the term "destructor" was 
 inadequate to describe it. Especially since "put it back when you've 
 finished with it" is a concept which is hundreds of years old,

Maybe if the name were changed it would encourage the programmers at work to put milk back in the refrigerator when they're finished with it. That's a cause I could stand behind! ;-) Sean
Jan 26 2006
prev sibling parent reply Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Georg Wrede wrote:
 IMHO, RAII (Resource Acquisition Is Initialization) is
 
 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!
 

I do agree it's a misnomer, however, it may have it's reasons to be so. I did a quick look at it's wikipedia entry, and I suspect it's called that because RAII actually means: "The acquisition is bound to the construction (initialization) whereas the release is bound to the destruction (uninitialization) of the variable", which is not the same as automatic variables, altough it has everything to do with that. In fact, under that definition RAII is a programming idiom/pattern, not a language feature (like auto variables). RAII seems useless without auto variables, though, so people blend the two concepts together. Perhaps a more experienced developer can confirm this. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
Jan 29 2006
next sibling parent Mike Capp <mike.capp gmail.com> writes:
In article <drigjt$2b80$1 digitaldaemon.com>, Bruno Medeiros says...
[RAII] is not the same as automatic variables, altough it has 
everything to do with that. In fact, under that definition RAII is a 
programming idiom/pattern, not a language feature (like auto variables). 
RAII seems useless without auto variables, though, so people blend the 
two concepts together. Perhaps a more experienced developer can confirm 
this.

Auto variables (in the C/C++ sense) are only half the story. The other half is the problem of composition - if your A contains a B which owns an array of polymorphic pointers to C-derived classes which could contain nasal demons for all you know, then being able to call A's destructor when it goes out of scope doesn't really cut it. You also need to know that any important resources managed by the B or C-derived objects get released. It's really not something you want to have to do (or maintain) manually. Aside from awkward hybrids like C++/CLI, I've yet to see a garbage-collected language that can tell a good story here. Which isn't to say that it's impossible, ("We'll never survive!" "Nonsense; you're only saying that because no-one ever has.") but it does support my prejudice that GC languages aren't a good fit for domains/apps where resource management is a big deal. cheers Mike
Jan 29 2006
prev sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Bruno Medeiros wrote:
 Georg Wrede wrote:
 
 IMHO, RAII (Resource Acquisition Is Initialization) is

 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!

I do agree it's a misnomer, however, it may have it's reasons to be so. I did a quick look at it's wikipedia entry, and I suspect it's called that because RAII actually means: "The acquisition is bound to the construction (initialization) whereas the release is bound to the destruction (uninitialization) of the variable", which is not the same as automatic variables, altough it has everything to do with that. In fact, under that definition RAII is a programming idiom/pattern, not a language feature (like auto variables). RAII seems useless without auto variables, though, so people blend the two concepts together. Perhaps a more experienced developer can confirm this.

Isn't that what a minsomore is? instead of statically allocated arrays, we could say - Hey, my language supports CTMSA!! -- what the **** is that? - compile time memory space allocation!! -- gimme a break! Plus, RAII is still meaningless, just because the initialization is the acquisition, it doesn't mean that the destruction of the objects will release any resources!! Total nonsense, man .. total nonsense ..
Jan 30 2006
parent James Dunne <james.jdunne gmail.com> writes:
Hasan Aljudy wrote:
 Bruno Medeiros wrote:
 
 Georg Wrede wrote:

 IMHO, RAII (Resource Acquisition Is Initialization) is

 THE WORST MISNOMER IN COMPUTER LANGUAGE HISTORY !!!

I do agree it's a misnomer, however, it may have it's reasons to be so. I did a quick look at it's wikipedia entry, and I suspect it's called that because RAII actually means: "The acquisition is bound to the construction (initialization) whereas the release is bound to the destruction (uninitialization) of the variable", which is not the same as automatic variables, altough it has everything to do with that. In fact, under that definition RAII is a programming idiom/pattern, not a language feature (like auto variables). RAII seems useless without auto variables, though, so people blend the two concepts together. Perhaps a more experienced developer can confirm this.

Isn't that what a minsomore is? instead of statically allocated arrays, we could say - Hey, my language supports CTMSA!! -- what the **** is that? - compile time memory space allocation!! -- gimme a break! Plus, RAII is still meaningless, just because the initialization is the acquisition, it doesn't mean that the destruction of the objects will release any resources!! Total nonsense, man .. total nonsense ..

I've also come to find the word 'professional' a huge misnomer. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James Dunne
Jan 31 2006