Could really do with a Delphi "WITH" equivalent

BlitzMax Forums/BlitzMax Programming/Could really do with a Delphi "WITH" equivalent

Yes, of course :D that's how object instancing works.

Just a little example:
Type Obj1
	Field Objfield:Obj2 = New Obj2
End Type
Type Obj2
	Field OtherObject:Obj3 = New Obj3
End Type
Type Obj3
	Field X:Int
	Field Y:Int
	Field T:String
End Type

Global MyInstance:Obj1 = New Obj1

'Test1:
MyInstance.Objfield.OtherObject.X = 100
MyInstance.Objfield.OtherObject.Y = 200
MyInstance.Objfield.OtherObject.T = "Hello!"

Print MyInstance.Objfield.OtherObject.X
Print MyInstance.Objfield.OtherObject.Y
Print MyInstance.Objfield.OtherObject.T

'Test2:
Local MyVar:Obj3 = MyInstance.Objfield.OtherObject
MyVar.T = "Good Bye!"
MyVar.X = -1000
MyVar.Y = -5000

Print MyInstance.Objfield.OtherObject.X
Print MyInstance.Objfield.OtherObject.Y
Print MyInstance.Objfield.OtherObject.T
This is the output you would get:
100
200
Hello!
-1000
-5000
Good Bye!