On Mon, Aug 30, 2010 at 7:06 PM, Graydon Hoare <[email protected]> wrote:

> On 10-08-28 02:33 PM, Sebastian Sylvan wrote:
>
>  Let me first say that the only reason I write this is because I really
>> like
>> Rust. It seems to get a lot of things really right, and I'd like it to
>> become successful! With that said, here's one issue. I have more, and I
>> may
>> write more about that later, but I figured I start with this one because
>> it
>> actually ends with a suggestion!
>>
>
> Hi,
>
> First, I'd like to remind you of the conduct guidelines for this community.
> While not quite venturing into the "abusive" or "flaming" category, for an
> introductory post/proposal your tone is needlessly provocative and filled
> with loaded terminology ("hijacking", "kludge", "severely crippled"). We aim
> for decorum here, please try to respect that. I had to rewrite my response a
> few times to ensure that I was not escalating the tone, and I don't enjoy
> spending work hours on such exercises.
>

I apologize if I came off abrasive, that certainly wasn't my intent, and not
the "tone" I was going for. I was trying to be clear and direct, not
provocative.

As I said, I really quite like Rust, and there's only a few things I would
do differently, so I'm in no way trying to be hostile or overly critical.

I realise written dialogue sometimes comes across differently to the reader
than was intended by the writer. I shall try harder.


W.r.t. the "kludge" comment, I was really intending to refer only to when
RAII is used for generic scope-control, rather than managing resources. E.g.
it's common for people to use RAII to take locks for the duration of a
scope, which means that they have to create a dummy object on the stack that
actually holds no resources but is used purely a mechanism for getting some
custom code to run at the beginning and end of a scope. In practice this
leads to situations where variables get named things like "dummy" (or even
writing C preprocessor macros to auto-generate a name using __COUNTER__).
That seems to be beyond the spirit of RAII, and hurts readability IMO.

I have no beef with constructors/destructors for, e.g., allocating and
deallocating resources that actually belong to that object.

 Destructors and RAII
>    encapsulate the initialization state of a resource and its
>    sub-resources, such that only those resources acquired wind up being
>    released. To mimic this in try/finally blocks is verbose and
>    error-prone
>

You may want to consider a "scope" feature like D has, which allows you to
put code at the end of the current scope (regardless of how it leaves it).
My "transaction" example would work just as well, better actually,  and
would certainly be a lot cleaner than with the try/finally stuff in there.


-- 
Sebastian Sylvan
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to