Javascript / Unityscript 'with' keyword

So I'm trying to take advantage of Unity3's new JS feature, function types. My code is basically trying to do something like this:

class MyClass {
var myVar:int;
var func: function();
}

what I want to do is be able to change `myVar` from inside whichever function I assign to `func`. I need it to act just like it would when using `this.member` from within a method, because my class has multiple such members and multiple such methods (function members, really).

I found this link which in the real JavaScript would likely work for this purpose.

But it doesn't work here though, the compiler keeps expecting colons and semicolons. Either the `with` keyword works differently here or it just doesn't really work yet. I think I can technically do this in C# with `using`, but I figure now that we have more JS functionality I would give it a try.

Hope I'm being clear enough in what I'm trying to do. I'll revise this if more info is needed.

Sigh. nice response typed up and IE got all screwed up. Here goes: answering question now that I can and don't remember why I needed this in the first place, for the sake of it not being unanswered anymore.

Using C# instead of JS.

`
public delegate int MyDelegate();
public class MyClass
{
int m_myVar;
public MyDelegate Del;

public void SetMyVar() { if (Del != null) m_myVar = Del(); else m_myVar = 0; }

}

// in another script: MyClass mc = new MyClass(); mc.Del += new MyDelegate(DoSomething); mc.SetMyVar();

public int DoSomething() { return 5; }

`