Could really do with a Delphi "WITH" equivalent

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I don't think he is above the law. His opinion counts like any other. He is quipping my generalizations and he makes a good point.

Sure, it is possible the With - End With could be used in a manner that made it ugly to read. But, the language as it is now could also be done ugly.

Just because it has the possibility to be used poorly doesn't mean it always will, just as the features of the language that could be used now to do poor code are there.

Truthfully, which is easier to read:

MyType.MyObject.MYOtherObject.x = 100
MyType.MyObject.MYOtherObject.y = 200
MyType.MyObject.MYOtherObject.Velocity = Sqr(MyType.MyObject.MYOtherObject.x*MyType.MyObject.MYOtherObject.x+MyType.MyObject.MYOtherObject.y*MyType.MyObject.MYOtherObject.y)
MyType.MyObject.MYOtherObject.Mytext = "Hello"
MyType.MyObject.MYOtherObject.dothis()


or

With MyType.MyObject.MYOtherObject
.x = 100
.y = 200
.Velocity = Sqr(.x * .x + .y * .y)
.Mytext = "Hello"
.dothis()
end with