Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Quantified Expressions #15

Open
pjljvandelaar opened this issue Jun 7, 2022 · 1 comment
Open

Use Quantified Expressions #15

pjljvandelaar opened this issue Jun 7, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@pjljvandelaar
Copy link

Dear Developers,

Why don't you use Quantified Expressions at the following locations?

-      for R of VS loop
-         if not Satisfies (V, R) then
-            return False;
-         end if;
-      end loop;
-
-      return True;
+      return (for all R of VS => Satisfies (V, R));
             when Anded =>
                return OK : Boolean := True do
                   Trace ("AND children count:" & Trees.Child_Count (Pos)'Img);
-                  for Child in VS.Set.Iterate_Children (Pos) loop
-                     OK := OK and then Is_In (Child);
-                  end loop;
+                  OK :=
+                    OK
+                    and then
+                    (for all Child in VS.Set.Iterate_Children (Pos) =>
+                       Is_In (Child));
                end return;

Note that further simplifications are still possible ;-)

             when Ored =>
                return OK : Boolean := False do
                   Trace ("OR children count:" & Trees.Child_Count (Pos)'Img);
-                  for Child in VS.Set.Iterate_Children (Pos) loop
-                     OK := OK or else Is_In (Child);
-                  end loop;
+                  OK :=
+                    OK
+                    or else
+                    (for some Child in VS.Set.Iterate_Children (Pos) =>
+                       Is_In (Child));
                end return;

Note that also in this case further simplifications are still possible ;-)

Greetings,
Pierre

@mosteo
Copy link
Member

mosteo commented Jun 7, 2022

Because that code will likely be older than qualified expressions being generally available, or before they entered my mind as a valid possibility :-)

@mosteo mosteo added the enhancement New feature or request label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants