September 26, 2014
On 9/26/2014 2:24 AM, "Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang@gmail.com>" wrote:
> On Friday, 26 September 2014 at 08:59:04 UTC, po wrote:
>>> - RAII makes most sense if you have exceptions.
>>   RAII is orthogonal to exceptions, so his claim is nonsense.
>
> Just a note: this isn't really true. RAII was initially used to deal with
> exceptions.

RAII existed in C++ years before exceptions.

September 26, 2014
On 9/26/2014 4:02 AM, Paulo Pinto wrote:
> On Friday, 26 September 2014 at 10:01:32 UTC, Ola Fosheim Grøstad wrote:
>> On Friday, 26 September 2014 at 09:41:09 UTC, Paulo  Pinto wrote:
>>> This is completely not true, we were using RAII in C++ before any compiler
>>> had real support for exceptions.
>>
>> Well, I haven't read the 1990 edition of the annotated C++ reference by
>> Stroustrup and Ellis since the mid 90s so my memory may be clouded, but that
>> is how I remember it.
>>
>> And wikipedia says the same:
>>
>> «The technique was developed for exception-safe resource management in C++[3]
>> during 1984–89»
>>
>> http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
>
> I don't care what Wikipedia says, I was there in the early C++ days happily
> using Turbo and Borland C++ in MS-DOS.

I wrote a C++ compiler in 1987. Nobody had ever heard of exceptions. Bjarne's 1986 "The C++ Programming Language" does not mention RAII or exceptions, but does say on pg. 158:

"Calling constructors and destructors for static objects serves an extremely important function in C++. It is the way to ensure proper initialization and cleanup of data structures in libraries."

September 26, 2014
Am 26.09.2014 20:46, schrieb Walter Bright:
> On 9/26/2014 4:02 AM, Paulo Pinto wrote:
>> On Friday, 26 September 2014 at 10:01:32 UTC, Ola Fosheim Grøstad wrote:
>>> On Friday, 26 September 2014 at 09:41:09 UTC, Paulo  Pinto wrote:
>>>> This is completely not true, we were using RAII in C++ before any
>>>> compiler
>>>> had real support for exceptions.
>>>
>>> Well, I haven't read the 1990 edition of the annotated C++ reference by
>>> Stroustrup and Ellis since the mid 90s so my memory may be clouded,
>>> but that
>>> is how I remember it.
>>>
>>> And wikipedia says the same:
>>>
>>> «The technique was developed for exception-safe resource management
>>> in C++[3]
>>> during 1984–89»
>>>
>>> http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
>>
>> I don't care what Wikipedia says, I was there in the early C++ days
>> happily
>> using Turbo and Borland C++ in MS-DOS.
>
> I wrote a C++ compiler in 1987. Nobody had ever heard of exceptions.
> Bjarne's 1986 "The C++ Programming Language" does not mention RAII or
> exceptions, but does say on pg. 158:
>
> "Calling constructors and destructors for static objects serves an
> extremely important function in C++. It is the way to ensure proper
> initialization and cleanup of data structures in libraries."
>

This is what happens when people take for granted what Wikipedia says.

At least in this regard, there are still people alive that lived through the events.

--
Paulo
September 26, 2014
On Fri, Sep 26, 2014 at 08:50:06PM +0200, Paulo Pinto via Digitalmars-d wrote:
> Am 26.09.2014 20:46, schrieb Walter Bright:
> >On 9/26/2014 4:02 AM, Paulo Pinto wrote:
> >>On Friday, 26 September 2014 at 10:01:32 UTC, Ola Fosheim Grøstad wrote:
> >>>On Friday, 26 September 2014 at 09:41:09 UTC, Paulo  Pinto wrote:
> >>>>This is completely not true, we were using RAII in C++ before any compiler had real support for exceptions.
> >>>
> >>>Well, I haven't read the 1990 edition of the annotated C++ reference by Stroustrup and Ellis since the mid 90s so my memory may be clouded, but that is how I remember it.
> >>>
> >>>And wikipedia says the same:
> >>>
> >>>«The technique was developed for exception-safe resource management in C++[3] during 1984–89»
> >>>
> >>>http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
> >>
> >>I don't care what Wikipedia says, I was there in the early C++ days happily using Turbo and Borland C++ in MS-DOS.
> >
> >I wrote a C++ compiler in 1987. Nobody had ever heard of exceptions. Bjarne's 1986 "The C++ Programming Language" does not mention RAII or exceptions, but does say on pg. 158:
> >
> >"Calling constructors and destructors for static objects serves an extremely important function in C++. It is the way to ensure proper initialization and cleanup of data structures in libraries."
> >
> 
> This is what happens when people take for granted what Wikipedia says.
> 
> At least in this regard, there are still people alive that lived through the events.
[...]

Then wikipedia should be edited to be more accurate, while said people are still alive!! Otherwise the distorted version of the events will come to be regarded as fact.


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln
September 26, 2014
On Friday, 26 September 2014 at 18:46:19 UTC, Walter Bright wrote:
> I wrote a C++ compiler in 1987. Nobody had ever heard of exceptions. Bjarne's 1986 "The C++ Programming Language" does not mention RAII or exceptions, but does say on pg. 158:

Exceptions is chapter 15 in the 1990 edition. I should have it somewhere, a small brown hardcover and expensive!
September 26, 2014
On 9/26/2014 11:52 AM, H. S. Teoh via Digitalmars-d wrote:
> Then wikipedia should be edited to be more accurate, while said people
> are still alive!! Otherwise the distorted version of the events will
> come to be regarded as fact.


I've been banned from editing Wikipedia for some reason. Someone else will have to do it :-(
September 26, 2014
On Fri, Sep 26, 2014 at 12:33:06PM -0700, Walter Bright via Digitalmars-d wrote:
> On 9/26/2014 11:52 AM, H. S. Teoh via Digitalmars-d wrote:
> >Then wikipedia should be edited to be more accurate, while said people are still alive!! Otherwise the distorted version of the events will come to be regarded as fact.
> 
> 
> I've been banned from editing Wikipedia for some reason.

What, why?


> Someone else will have to do it :-(

I would, except that right now I'm working on a dmd PR. ;-) Do you have references to back up your claims (references deemed acceptable by WP)? Otherwise whatever I (or anyone else) put on there will just get reverted by the editors. Unfortunately, there are a few WP editors around who are overly draconian about deleting "unreferenced" material. (Got burned by them myself a few times -- drove me to put stuff on my own website instead, and then I discovered other people adding links to my website from WP and adding the stuff back on my behalf. Ahhh, sweet revenge. :-P)


T

-- 
Be in denial for long enough, and one day you'll deny yourself of things you wish you hadn't.
September 26, 2014
On Friday, 26 September 2014 at 18:54:14 UTC, H. S. Teoh via Digitalmars-d wrote:
> Then wikipedia should be edited to be more accurate, while said people
> are still alive!! Otherwise the distorted version of the events will
> come to be regarded as fact.

Stroustrup was planning for exceptions up till ARM in 1990 and RAII become an idiom through his writings. C++ compilers had ARM exception support at least by 1992/1993: HP, IBM, DEC, maybe SGI.  (ARM is the base document for the ISO standard and was regarded as the c++ bible.)

Those are not facts?
September 26, 2014
Am 26.09.2014 22:10, schrieb Ola Fosheim Grostad:
> On Friday, 26 September 2014 at 18:54:14 UTC, H. S. Teoh via
> Digitalmars-d wrote:
>> Then wikipedia should be edited to be more accurate, while said people
>> are still alive!! Otherwise the distorted version of the events will
>> come to be regarded as fact.
>
> Stroustrup was planning for exceptions up till ARM in 1990 and RAII
> become an idiom through his writings. C++ compilers had ARM exception
> support at least by 1992/1993: HP, IBM, DEC, maybe SGI.  (ARM is the
> base document for the ISO standard and was regarded as the c++ bible.)
>
> Those are not facts?

Yes Stroustroup was planning for exceptions and maybe there were even some articles flying around in C++ Report and The C Users Journal.

However, we were using MS-DOS systems networked via Novell Netware.

I started coding C++ on MS-DOS in 1993 with Turbo C++ 1.0 all the way up to Turbo C++ 1.5 for Windows 3.x. Also used Borland C++ occasionally.

I cannot remember any longer which version eventually added support for exceptions, but it was already a Windows 3.x version I would say.

The early 90's in Portugal, meant no Internet and no BBS access outside Porto and Lisbon.

We just learned on our own, by ourselves, reading books, magazines that sometimes lost their way into our small town or talking with our peers.

RAII just seemed a natural way to use destructors. Specially since I was already using this pattern in Turbo Pascal 6.0.

--
Paulo
September 26, 2014
On Friday, 26 September 2014 at 18:46:19 UTC, Walter Bright wrote:
> I wrote a C++ compiler in 1987. Nobody had ever heard of exceptions.

Lisp had exceptions in the 60s. In the 80s exception handling was fashionable in language design. :)

> Bjarne's 1986 "The C++ Programming Language" does not mention RAII or exceptions, but does say on pg. 158:
>
> "Calling constructors and destructors for static objects serves an extremely important function in C++. It is the way to ensure proper initialization and cleanup of data structures in libraries."

I would not call this RAII, but Simula67 did have the block prefixing idiom which I presume Stroustrup knew about.

http://www.olejohandahl.info/papers/Birth-of-S.pdf

RAII is a natural extension of block prefixing IMO. BETA, the follow up language to Simula, was developed in the 70s/80s and support RAII-style prefixing through the "inner"-statement. You can probably find many RAII-like idioms in various languages if you dig back in time, though.