Skip to content

Relax the statement order for symbol/$-variable declarations#296

Open
tueda wants to merge 1 commit into
form-dev:masterfrom
tueda:loosedecl
Open

Relax the statement order for symbol/$-variable declarations#296
tueda wants to merge 1 commit into
form-dev:masterfrom
tueda:loosedecl

Conversation

@tueda

@tueda tueda commented Oct 26, 2018

Copy link
Copy Markdown
Collaborator

From a forgotten Issue #188. We don't need to follow the FORTRAN style for symbol/$-variable declaration:

CF f;
L F = f(3);
S n;
id f(n?) = n;
P;
.end

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 48.242% when pulling a175d69 on tueda:loosedecl into 07cce53 on vermaseren:master.

@benruijl

benruijl commented Jul 7, 2022

Copy link
Copy Markdown
Collaborator

In issue #188 you mention wanting to put ModuleOption noparallel anywhere, but noparallel is not in the allowed list of this commit. Is there a problem with that option?

@tueda

tueda commented Jul 7, 2022

Copy link
Copy Markdown
Collaborator Author

Maybe I just forgot to add noparallel, or maybe some problem; I don't remember exactly. For consistency, other module options could be added, too.

On the other hand, if in one module both local and noparallel are specified, then it indicates some conflicts between a part that should be parallelized and a part that should be executed in the non-parallel mode. Errors/warnings could be useful in such cases.

@benruijl

benruijl commented Jul 7, 2022

Copy link
Copy Markdown
Collaborator

Can we simply allow all ModuleOptions to be specified anywhere in the module?

@tueda

tueda commented Jul 11, 2022

Copy link
Copy Markdown
Collaborator Author

Maybe it would not be a problem if we give warnings/errors for inconsistent use of ModuleOptions, for example using both local and noparallel or polyratfun twice with different functions/options. The latter is dangerous because it occurs when two subroutines (procedures called in a module) assume different polyratfuns and probably leads to a wrong result.

@jodavies

Copy link
Copy Markdown
Collaborator

What is actually inconsistent about using both local and noparallel? This should be in the end equivalent to running the code with form or tform -w1 should it not?

@tueda

tueda commented Jul 11, 2022

Copy link
Copy Markdown
Collaborator Author

Yes, you are right. But this potentially indicates a performance issue (parallel part and no-parallel part in a module mistakenly), which is easily found if one has to write ModuleOptions only at the end of a module while may be difficult to recognize when ModuleOptions are distributed over a big module, especially inside procedures.

@jodavies

jodavies commented Nov 7, 2024

Copy link
Copy Markdown
Collaborator

I think it would be interesting to resurrect this for v5?

@tueda

tueda commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator Author

Actually, which ordering relaxations should we include in version 5? Do we have consensus?

@jodavies

Copy link
Copy Markdown
Collaborator

Certainly the dollar-related moduleoptions were a request at the workshop. What does your code comment mean by "mixed statements"?

@vermaseren

vermaseren commented Jun 20, 2025 via email

Copy link
Copy Markdown
Collaborator

@tueda

tueda commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator Author

@jodavies, by "mixed statements", I meant statements with the MIXED flag. One problem is that we now also have the MIXED2 flag.

@vermaseren, you mean all declarations and all moduleoptions are free to be relocated?? Or are exceptions only between declarations and moduleoptions? (But it is not so useful...)

@jodavies

Copy link
Copy Markdown
Collaborator

OK, so this means only print and printtable? The MIXED2 flag does not appear to have any associated statements?

@tueda

tueda commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator Author

Yes. So the question is the purpose of MIXED2. Maybe it was created for these declarations and module options?

@jodavies jodavies added this to the v5 milestone Sep 30, 2025
@tueda

tueda commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator Author

I will open a follow-up PR that only relaxes the allowed positions of ModuleOption for $-variables (e.g., ModuleOption local). This could be adopted in version 5.

@jodavies jodavies removed this from the v5 milestone Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants