A couple of decades ago, I remember using the with statement in Pascal. I 
have since wished for it in several languages, but I guess in Julia, it 
would probably be feasible without altering the language?

Basically, it'd be something like

type Foo
    a
end

foo = Foo(42)

@with foo do
    a = 1
    b = "frozzbozz"
    # ...
end

# foo.a is now 1

That is, let the fields of a composite type be available (syntactically) as 
local variables.

Now, hacking together something like this wouldn't be hard – but making it 
really work (without weirdness or performance degradation) seems harder. 
And maybe it's a bad idea to begin with. Or maybe someone has already done 
it?-)



Reply via email to