Hello! Sometimes I have to use "If" or "case" comparing the same property on different objects. Now it may look cumbersome, for example:
If (obj1.Caption=...) and (obj2.Caption=...) and (obj3....)and...
In Pascal there is a "set of", but it does not work for multiple change or comparison. I would like to have such a design:
If [Obj1, Obj2, Obj3...].Caption=... then... - here the Caption property of each object is compared with the specified value. If they are all equal, then the condition is satisfied. Each object in the set must have a "Caption" property of the same type.
More example:
[Obj1, Obj2, Obj3...].Caption:= 'Yes' - here the "Caption" property of all objects is changed.
Also, it would be great to be able to call functions and procedures, for example:
[Form1, Form2, Form3].Show -- this replaces:
Form1.Show; Form2.Show; Form3.Show
"set of case" would also be useful in "case of", for example:
Case [Form1, Form2, Form3].Top of
10: a:=10;
15..20: a:=20;
end;
Now it looks like this:
Case Form1.Top of
10: a:=10;
15..20: a:=20;
end;
Case Form2.Top of
10: a:=10;
15..20: a:=20;
end;
Case Form3.Top of
10: a:=10;
15..20: a:=20;
end;
This would be useful for variables of the same type, for example:
[a, b, c]:=10; -- this is the same as now:
a:=10; b:=10; c:=10;
The quadrad brackets [] should read as "Union action".
For the "union action" to work, need two or more objects or vars. Also, there should be no characters before "[" (variable names, for example), otherwise it will be considered as a reference to a variable or property array. It may make sense to introduce other restrictions to use this.
Thank you, I hope my suggestions will be useful for the development of the programming language.