[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] string formatting notation



> So I’m not sure why you think there’s no solution in SC. Unless you want this sort of thing (which you can do in some languages)

Yes, that's what I meant. This is what I mean by my terminology (it seems to be fairly standard):

string formatting: printf-style or relaxed printf style. printf("Error '%s' on line %d\n", err, line);
string interpolation: directly inserting variable names into a string literal. "Probably not in $systemsLanguage because of performance concerns."

> You can probably guess the problem: If that happens automatically it hoses any existing code that happens to use that character pattern. (e.g. to create a shell script).

See the f-string idea from Python linked by Stefaan above: https://www.python.org/dev/peps/pep-0498/

AFAICT that exact solution would work with no problem in SC. e.g.: f"That is some good ${expletive}". Variable-name immediately followed by a string literal (or literal of any kind IIRC) is currently ill-formed, so there is no contention with code that is meant to say

f = 3;
f "this piece";

> As a start: value conversion methods should be lowercase and fromto. FWIW, that’s not what I might pick if we were starting from scratch, but it’s well established.

I happen to agree. (Sorry Nathan)

-Brian

On Fri, Dec 22, 2017 at 9:45 AM, <i@xxxxxxxxxxxxxx> wrote:

On 22 Dec 2017, at 15:10, brianlheim@xxxxxxxxx wrote:

Feel free to propose some. It would be great if we could have some guiding principles for language evolution. I don't suggest these sorts of language changes very often so I don't have strong opinions yet.

This would be a good project, but a big one. As a start: value conversion methods should be lowercase and fromto. FWIW, that’s not what I might pick if we were starting from scratch, but it’s well established.

S.