On 05/12/2014 10:36 PM, Walter Bright wrote:
It's been brought up more than once that the 'scope' storage class is an
unimplemented borrowed pointer. But thinking a bit more along those lines,
actually 'ref' fills the role of a borrowed pointer.
One particularly apropos behavior is that struct member functions pass 'this'
by ref, meaning that members can be called without the inc/dec millstone.
ref is still incomplete as far as this goes, but we can go the extra distance
with it, and then it will be of great help in supporting any ref counting
solution.
What it doesn't work very well with are class references. But Andrei suggested
that we can focus the use of 'scope' to deal with that in an analogous way.
What do you think?
I think everything should be treated uniformly. But a storage class is
not sufficient.
Anyone want to enumerate a list of the current deficiencies of 'ref' in
regards to this, so we can think about solving it?
Eg:
- Cannot make tail const. / Cannot be reassigned.
- Cannot store in data structures.
- Cannot borrow slices of memory.
- Closures?
- (Probably more)