with Object do
Posted: Thu Mar 20, 2008 6:10 am
I would really love a feature like the "with .. do" feature of Object Pascal.
It takes an Object as an argument and works more or less in the "Namespace" of this object
for example instead of
you can write
It would be even cooler if you could do something like "with myObject1 myOtherObject do" so that both namespaces would be mixed.
The problem is that the code would be a bit less readable with that And there will be Problems if 2 or more methods share the same signature...
It takes an Object as an argument and works more or less in the "Namespace" of this object
for example instead of
- Code: Select all
myObject.colour := clRed;
myObject.size := 23.5;
myObject.name := 'Fred';
you can write
- Code: Select all
With myObject do
begin
colour := clRed;
size := 23.5;
name := 'Fred';
end;
It would be even cooler if you could do something like "with myObject1 myOtherObject do" so that both namespaces would be mixed.
The problem is that the code would be a bit less readable with that And there will be Problems if 2 or more methods share the same signature...