On 4/28/14, 12:53, Simon Byrne wrote:


On Monday, 28 April 2014 17:06:37 UTC+1, Simon Byrne wrote:

    My own perspective is that this is due to two reasons

    1) `do` is the only (non-macro) construction that rewrites
    expressions i.e.

    open("outfile", "w") do f
       write(f, data)
    end

    does not (directly at least) call the method `open("outfile", "w")`


Also, the fact that rewriting occurs due to a term that appears *after*
a completed expression I think adds to the confusion. Perhaps this would
be less confusing if some indicator had to appear before the `open`
statement. For example, we could have a macro:

@do open("outfile", "w") f begin
   write(f, data)
end

Then we're almost to the python syntax:

with open("outfile", "w") as f:
    f.write(data)

Jason

Reply via email to