----- Original Message -----
> From: "Niko Matsakis" <[email protected]>
> To: [email protected]
> Sent: Tuesday, December 20, 2011 2:13:49 PM
> Subject: [rust-dev] names needed for function types
> Per recent conversations, my current plan with regard to function
> types
> is to pare us back to three:
> 
> - Unique closures (currently written "sendfn"), which can only close
> over sendable state, which is either copied or moved into the closure;
> - Shared closures (currently written "lambda" or "fn@"), which can
> copy
> or move arbitrary state off the stack frame and access it;
> - Blocks (currently written "block"), which access state from their
> creator's stack frame by reference and therefore cannot be used once
> their creator returns.

This will mean 'fn' can't be used as a type, unless it means two different 
things - I don't think it should both mean 'shared closure' and this non-type 
thing that can be instantiated as any type of closure. It's a shame that we 
have to think of a different name for the most common function type, but maybe 
not a big problem since you often want to use it as a block.

> 
> The question is: what should we call the various closure types? I
> think
> we need both good prose names and good keywords, ideally those are the
> same.
> 

Rename 'block' to 'fn'. Reason: this is the type that most higher order 
functions take; it has symmetry with your proposal for fn declarations, in that 
fn declarations can be instantiated as either shared closures or unique 
closures. In common practice you would write 'fn' most everywhere. Only when 
you need to put a closure into a data structure or send it would you have to be 
more specific about the type.

Still thinking about the other two.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to