[J3] Why is += missing?
Van Snyder
van.snyder at sbcglobal.net
Wed Aug 25 17:49:22 UTC 2021
On Wed, 2021-08-25 at 13:27 +0000, Jeff Hammond via J3 wrote:
> I will argue that it is syntactic sugar in the same sense that
> multidimensional arrays are. Below is the perfectly functional C
> code I wrote to match my Fortran years ago (because computer
> scientists don’t know their history). There is no actual need for
> multidimensional arrays in Fortran, just the practical difficulty of
> not having them.
>
> // t3(h3,h2,h1,p6,p5,p4)+=t1(p4,h1)*v2(h3,h2,p6,p5);
> t3[h3+h3u*(h2+h2u*(h1+h1u*(p6+p6u*(p5+p5u*p4))))] += t1[p4+p4u*h1] *
> v2[h3+h3u*(h2+h2u*(p6+p6u*p5))];
Here's another perfectly clear C program. Compile and run it. You'll
get a pleasant surprise.
#include <stdio.h>
main(t,_,a)
char *a;
{
return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)):
1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+
,/#\
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw'
i;# \
){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n'
')#\
}'+}##(!!/")
:t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
:0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
"!ek;dc i at bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m
.vpbks,fxntdCeghiry"),a+1);
}
> I think the relative usage of +=, -=, *=, ÷=, and **= if they were
> added justifies the pragmatic solution of just doing += and -=, which
> are more likely to have hardware support anyways.
>
> Jeff
>
> From:J3 <j3-bounces at mailman.j3-fortran.org> on behalf of Steve Lionel
> via J3 <j3 at mailman.j3-fortran.org>
> Date: Wednesday, August 25, 2021 at 4:13 PM
> To: j3 at mailman.j3-fortran.org <j3 at mailman.j3-fortran.org>
> Cc: Steve Lionel <steve at stevelionel.com>
> Subject: Re: [J3] Why is += missing?
> External email: Use caution opening links or attachments
>
> On 8/25/2021 8:07 AM, Jeff Hammond via J3 wrote:
> > After 15 years as a Fortran programmer, I am still annoyed on a
> > daily basis about the tedium imposed on me because Fortran lacks
> > +=.
> This was considered - there were a few requests for it in the 202X
> survey we ran 2017-2018. I suspect it fell off the list because of
> 1) it is "syntactic sugar", not adding any new capability and 2) the
> existing use of /= requiring some complicated exceptions. It could be
> done, sure, but the demand seems low. We'll soon start the process
> for 202Y features - feel free to put it forward then.
>
> Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210825/a2639d69/attachment-0001.htm>
More information about the J3
mailing list