Re: [julia-users] Re: scope of do block, generalization to for block

2016-06-21 Thread Stefan Karpinski
Yes, although I think we should perhaps return a single object that holds both the fd and the process object. On Tue, Jun 21, 2016 at 4:34 PM, David van Leeuwen < david.vanleeu...@gmail.com> wrote: > Another case for open()!, I suppose, is the construction > > fd, process = open(`command`) > >

Re: [julia-users] Re: scope of do block, generalization to for block

2016-06-21 Thread David van Leeuwen
Another case for open()!, I suppose, is the construction fd, process = open(`command`) which I wasn't able to fit in the do-block construction. ---david On Tuesday, June 21, 2016 at 5:43:36 PM UTC+2, Stefan Karpinski wrote: > > I was not aware that you could do multiple `as` clauses on a

Re: [julia-users] Re: scope of do block, generalization to for block

2016-06-21 Thread Stefan Karpinski
I was not aware that you could do multiple `as` clauses on a single `with` line – that makes the construct considerably more useful since it reduces the indentation. However, it still doesn't address cases where you don't want to give the object to be finalized a name, e.g.

Re: [julia-users] Re: scope of do block, generalization to for block

2016-06-21 Thread David van Leeuwen
Hello, On Monday, June 20, 2016 at 5:38:04 PM UTC+2, Stefan Karpinski wrote: > > The reason as Cedric points out is that the do block syntax is just sugar > for an anonymous function body. There is a plan to provide a more > convenient mechanism for ensuring finalization: #7721 >

[julia-users] Re: scope of do block, generalization to for block

2016-06-20 Thread Cedric St-Jean
I'm not sure why assignments are local, but I'd guess that it's for consistency. function foo(x, y) ... end is syntactic sugar for foo = (x,y)->..., and likewise do syntax is also sugar for creating a function and passing it as the first argument. Since function foo(x) a = x end does not