News for hackers. Stuff that matters.
Re:Decimal BASIC:a tool for calculation and investigation by zozbot234 on Tuesday October 10, 2023 @02:11PM (#37835454)
You can think of the f" token as entering a special syntax environment where the {} characters (along with possibly other format specifiers) have that special meaning. Ultimately it's just a bit of syntactic sugar, since to do it "properly" via explicit pretty-printing and string concatenation would get rather tedious. Many varieties of BASIC have their own support for formatted output, usually via a PRINT USING statement.
Re:Decimal BASIC:a tool for calculation and investigation by lproven on Tuesday October 10, 2023 @02:29PM (#37835661)
But this is exactly the sort of thing that my point is about.

The Unix/C family has the habit of inserting what looks like random line noise into its output statements, which do special stuff depending on what order they're in and where they appear relative to other line noise.

Python fans think it's an easy, clear and obvious language, and as such, it's not only a suitable replacement for BASIC but a better choice.

But it's not as obvious as it looks to people who grew up in the Linux world and know little else. Such as this example: `f` before the string does something totally different to `f` after the string, and there's nothing to mark or indicate that. You just have to know that and remember where it goes.

> via a PRINT USING statement.

For me, something like that is preferable. There is one command that does unformatted output, and a different one that formats it. That's clear. With either, what's in quotes is what comes out. If it's inside quotes, it's demarcated and it's special: the human put this in there, and don't mess with it, just do what you're told.

Whereas with C, and in a different way with Python, the language does whatever it feels like with the stuff in quotes, and the human has to do extra work remembering that some stuff is magic and some isn't.

I am not attempting some full language critique here... merely reporting some of my own personal experiences.