On Tue, 23 Apr 2024, at 11:25, Rony G. Flatscher wrote:

> The nice thing is that Rexx allows different variants of string 
> concatenations and one is free to use what seems to be the
> "easiest", the "safest". Personally I use blank concatenations
> by default and abuttal or || only if there really should not be
> a single blank between the concatenated strings which is 
> very rarely the case. Again, YMMV.

I find it usually depends on whether I'm building error messages
from fragmentary values & phrases, when something like

   errmsg = funcname atline part1 part2

seems clear enough to me, and (eg) building filenames when
I'm likely to use eg

 fyle = dq || frm || "\" || mac ||     "\" || "no.such" || dq     /* test - 
leafname error */
 fyle = dq || frm || "\" || mac || "FAIL\" || "ok.txt"  || dq     /* test - 
path     error */

 fyle = dq || frm || "\" || mac ||     "\" || "ok.txt"  || dq     /* should 
work */
 
I usually put literal single or double quotes into vars named sq & dq, as I 
find it easier not to see quotes which are part of a final value jumbled up
with those that need to be around literals ... and I don't like mixing "'" & 
'"' on one line of code.


Also - as you'll see if you read this in a monospace font - I tend to space
out parts of /sets/ of related statements like the ones above so that one
can see they all do the same thing, ie I don't write

 fyle = dq || frm || "\" || mac || "\" || "no.such" || dq
 fyle = dq || frm || "\" || mac || "FAIL\" || "ok.txt" || dq

 fyle = dq || frm || "\" || mac || "\" || "ok.txt" || dq
 

I almost never space-out parameters on function calls, but sometimes 
do, eg the space after c2x(   and those before the final closing bracket
in these lines

op = op c2x( "basic vb vbs"    copies(" ", 10 + gutr)  "built-in:  pqr"       )
op = op c2x( "html"            copies(" ", 23 + gutr)  "built-in:  stuv"      )
op = op c2x( "perl"            copies(" ", 25 + gutr)  "mine:      perl"      )
op = op c2x( "plain text"      copies(" ", 15 + gutr)  "mine:      plaintext" )
op = op c2x( "shell scripts"   copies(" ", 11 + gutr)  "mine:      shellscrp" )

- which is building a string of values each 'word' of which is a phrase,
in hex so that it can be passed somewhere & hacked apart easily. The
copies() calls are because I'm stretching the middle of each phrase so
that the texts (regrettably going to be displayed in a proportional
font) will still more or less be presented in sensible columns - tabs
don't work in the target application.

Sometimes I choose space concatenation or || in different parts of
a long expression because I think (with syntax colouring & vertical 
alignment) one's eye is drawn to different sections of the whole 
expression according to how the ||-delimited bits are syntax-
coloured.

Here, || shows up in bright yellow on a black background so
tends to draw attention to what's near it.


-- 
Jeremy Nicoll - my opinions are my own.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to