What about it? I don't think there's anything like this in Parameters. On Sun, Oct 9, 2016 at 1:27 PM, Chris Rackauckas <rackd...@gmail.com> wrote:
> What about Parameters.jl <https://github.com/mauro3/Parameters.jl>? > > > On Wednesday, September 7, 2016 at 7:23:47 AM UTC-7, Tom Breloff wrote: >> >> Hey all... I just threw together a quick macro to save some typing when >> working with the fields of an object. Disclaimer: this should not be used >> in library code, or in anything that will stick around longer than a REPL >> session. Hopefully it's self explanatory with this example. Is there a >> good home for this? Does anyone want to use it? >> >> julia> type T; a; b; end; t = T(0,0) >> T(0,0) >> >> julia> macroexpand(:( >> @with t::T begin >> a = 1 >> b = 2 >> c = a + b - 4 >> d = c - b >> a = d / c >> end >> )) >> quote # REPL[3], line 3: >> t.a = 1 # REPL[3], line 4: >> t.b = 2 # REPL[3], line 5: >> c = (t.a + t.b) - 4 # REPL[3], line 6: >> d = c - t.b # REPL[3], line 7: >> t.a = d / c >> end >> >> julia> @with t::T begin >> a = 1 >> b = 2 >> c = a + b - 4 >> d = c - b >> a = d / c >> end >> 3.0 >> >> julia> t >> T(3.0,2) >> >>