-
Notifications
You must be signed in to change notification settings - Fork 19
Initial draft of conditional expression intrinsic paper #213
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f8e4edc
Initial draft of cond. expr. intrinsic paper
certik 3344ade
Add a missing reference
certik e11bafd
Better formulation
certik 4841b4a
Update proposals/conditional_expressions/cond.txt
certik eea6edb
Update proposals/conditional_expressions/cond.txt
certik 02aecf4
Update proposals/conditional_expressions/cond.txt
certik 0d6f5ea
Update proposals/conditional_expressions/cond.txt
certik 80c211e
Add answers to objections
certik 7e39090
Update proposals/conditional_expressions/cond.txt
certik ec3361e
Update proposals/conditional_expressions/cond.txt
certik 1e1355c
Use the upload template
certik cf8b86f
Make every line shorter than 75
certik 7c64eab
Add the actually uploaded paper
certik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
To: J3 J3/XXX | ||
From: Ondrej Certik | ||
Subject: Conditional expressions using intrinsic function | ||
References: 21-157, 21-159 | ||
Date: 2021-June-26 | ||
|
||
Paper 21-157 proposes two syntactic forms for | ||
conditional expressions. The paper 21-159 proposes | ||
an alternative form. This paper proposes to implement | ||
conditional expressions using intrinsic functions | ||
|
||
The syntactics forms in 21-157 is too verbose, as argued in 21-159. The form in | ||
certik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
21-159 is concise, but based on the poll [1], it is not the most popular | ||
either. | ||
|
||
We propose the following syntactic form | ||
|
||
<cond-expr> is ifthen( predicate, consequent, | ||
[ ifthen( predicate, consequent, ]* | ||
alternative) [)]* | ||
certik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
where the predicates are scalar logical expressions | ||
and the consequents and alternative are compatible | ||
expressions. The number of `)` must match the number of `ifthen(` used. | ||
|
||
Examples: | ||
|
||
ifthen(x >= 0.0, sqrt(x), -0.0) | ||
|
||
ifthen(present(x), a, ifthen(present(b), b, 0)) | ||
certik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
References: | ||
|
||
[1] https://fortran-lang.discourse.group/t/poll-fortran-202x-conditional-expressions-syntax/1425 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.