Hi,

Is there anything in Julia similar to Python's "with context" (or using 
with-open-file in lisp, or similar)?  To automate closing files after 
opening them, for example.

The reason I ask is that I'm sitting here listening to Miles give a talk on 
JuMP and looking at code like:

```
m = Model()
@addconstraint(m, ...)
@something(m, ...)
```

and it seems like it would be nicer to have a protocol of some kind that 
enabled: 

```
with Model()
   @addconstraint(...)
   @something(...)
```

(where the first argument is implicit)

Perhaps that's a bit too much syntactic sugar? Or perhaps too much like 
single dispatch OO?

I have a feeling there is something vaguely similar, but I can't remember 
what (sorry).

Thanks, Andrew

Reply via email to