>> The syntax was pioneered before the RFC process was in effect, so it
>> may not have an official grammar, but it looks something like:
>>
>>     expr := 'box' expr | 'box' '(' expr ')' expr
>>
>> The first form is "rewritten" as `box(::std::owned::HEAP) expr` and
>> the second form (the more general) specifies that the second
>> expression should be placed into the first.
>
> Hmm.  So in 'box(RC) expr', RC is an allocator?  I must be
> misunderstanding something, because I don't see how it knows from
> that:
> a) That it should create an Rc
> b) How to work with and initialize the Rc struct properly

The current design hasn't been written up into an RFC, but the current
thinking is documented in the last work week's minutes [1]. They're a
little messy, but they should be faithful to what we're thinking!

The general idea was that RC isn't actually an allocator per-se, but
rather a "boxer" which knows how to create an Rc<T> from a T. The
"boxer" could be parameterized over an actual allocator which would
dictate where memory comes from, but by the default allocator would
still be the jemalloc heap. We found that the distinction between an
allocator and a boxer gave you a bit more flexibility when it came to
allocators in terms of re-use between pointers such as Rc, Arc, and
Box.

[1]: 
https://github.com/rust-lang/meeting-minutes/blob/master/workweek-2014-08-18/box-and-allocators.md
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to