[J3] [EXTERNAL] [BULK] Re: A couple more ideas for features
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Thu Apr 6 15:02:48 UTC 2023
Hi Katherine,
Lots of programming languages use carat for exponentiation. And it is more common for text-based mathematical notation than “**”. In any event, I am _not_ advocating that it be tied to exponentiation. (User could define it that way themselves though, of course.) I just gave the history of the suggestion, which involved that precursor.
Cheers,
* Tom
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Thursday, April 6, 2023 at 10:53 AM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: "Holcomb, Katherine A (kah3f)" <kah3f at virginia.edu>
Subject: [EXTERNAL] [BULK] Re: [J3] A couple more ideas for features
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
I’m not a member, just an observer, but I’m also not sure why the individual would want to use ^ as an exponentiation operator unless he’s a Matlab user (or maybe R) so he’s more accustomed to it. Python uses ** as well so Fortran isn’t alone here (though I assume Python got it from Fortran). If you were to introduce ^ I can think of better uses than exponentiation, e.g. maybe a bitwise operation.
If he wants the Matlab operator I suppose I should demand “break” as a synonym for “exit” since I keep typing “break” in Fortran.
Lots of languages don’t have a repeat/until (or do/until)…but it can be emulated easily with
do
Stuff
If (condition) exit
enddo
That ensures the loop will be executed at least once, which as noted below is the purpose of the repeat/until construct.
Katherine Holcomb
UVA Research Computing https://www.rc.virginia.edu<https://www.rc.virginia.edu/>
kah3f at virginia.edu<mailto:kah3f at virginia.edu> 434-982-5948
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of ian.chivers--- via J3
Sent: Thursday, April 6, 2023 10:49 AM
To: 'General J3 interest list' <j3 at mailman.j3-fortran.org>
Cc: ian.chivers at chiversandbryan.co.uk
Subject: Re: [J3] A couple more ideas for features
I assume that the proposed syntax for DO UNTIL()
Is
DO
Block of statements
UNTIL()
Which is what I’m familiar with from Pascal and Modula 2,
and would be a 1 trip loop, i.e. the block of statements is
executed at least once.
From: J3 <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>> On Behalf Of Brad Richardson via J3
Sent: Thursday, April 6, 2023 3:02 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc: Brad Richardson <everythingfunctional at protonmail.com<mailto:everythingfunctional at protonmail.com>>
Subject: Re: [J3] A couple more ideas for features
I don't see any reason to define "^" to be exponentiation, as we already have an operator for that, "**". Would the proposal be to allow "^" as a user defined operator? I suspect that would preclude us from using it for some intrinsic operation later, so I'm not sure if it's a good idea. I don't have a strong opinion though. While we're on the subject of operators though, is there a reason "_" is not allowed in user defined operators?
For DO UNITL(...), I like the expressive/readability aspect of it, but why is DO WHILE (.not. ...) insufficient?
Regards,
Brad
On Thu, 2023-04-06 at 13:53 +0000, Clune, Thomas L. \(GSFC-6101\) via J3 wrote:
Someone in the NASA community recently reached out to me with a few questions about the standard and potential new features. After disabusing him of the ones that seemed non starters, I’m left with 2 that I feel obligate to float with the committee.
The first is a request to allow “^” as on operator. The individual actually wanted to use it for numerical exponentiation, but I considered that to be a small benefit. But it is true that Fortran has a relative paucity of symbols that can be used as operators, and most of those cannot be repurposed for use with intrinsics. I suspect with generics, there may even be increased usage of user-defined operators, but admittedly this is purely conjectural. I know we are frugal with allowing new characters, but maybe others have some solid use cases waiting to throw at this?
The other request was for a DO … UNTIL(cond) to complement DO WHILE(cond) … I have no doubt that this request has come up before, so someone can quickly rattle off why it was not pursued?
His other requests were all either outside the standard (command line flag to change default behavior) or were features we actually already have and the user was merely unaware.
Cheers,
· Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230406/8cf68a4e/attachment-0001.htm>
More information about the J3
mailing list