It might be good to revisit proc syntax, but I don't think that it's yet time for that. There's a nebulous plan in the works involving reimplementing closures as traits (or... something?) and how that shakes out would likely impact the syntax that we want to provide.
On Mon, Feb 3, 2014 at 11:26 AM, Jake Kerr <[email protected]> wrote: > Hello rust-dev, > > I imagine there are reasons I've not considered for why proc > declaration syntax is the way it is, but I couldn't find any > discussion on this list or in the issues so thought I'd make a > proposal. > > I think it would be nice if procs and closures had a more similar syntax. > Specifically I'd like to see proc loose it's function like () > parameter list and gain the block like || params list as closures > have. > > So rather than the current: > spawn(proc(x,y) { /* Do some work. */ }); > > We would write: > spawn(proc |x,y| { /* Do some work. */ }); > > A minor change, for sure, but I find the later easier to visually > parse and recognize as a closure. With the current syntax I find that > for a split second it looks to me like a function call to some > function "proc" with a block after it. > I thought for a moment that maybe proc was a function with a > final hidden block argument and that this was a magic syntactic sugar > for giving this "proc" function a block (kind of like the old do > syntax) but then I read the parser and learned that proc is in fact part > of the syntax. > > There are probably some caveats that I haven't considered since I'm not > 100% familiar with all of the closure types. If there is a glaring > reason why this is a bad idea please do tell; else let's discuss. > > Thanks for reading! > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
