upvote
At a glance, the string templating system they were trying out looked pretty good to me.

And clearly a lot of work and time went into it with the previews.

The fact that they pulled it back suggests they looked down deep into an abyss that looked back at them, and what they saw scared them.

I don't know if there has been a published deep dive post mortem on the whole string templating thing, but I am quite comfortable with the team yanking it out if they felt it wasn't right.

reply
To me they felt overengineered, with all the customisation points that were to be available, and the way to use them.

Maybe there is something on the mailing lists.

reply
Honestly, I still write a lot of perl, and while interpolation is nice and good to have for simple things, I find myself using sprintf more and more in production code, especially in the cases the examples always show off, such as needing to alter the variable, add two together, etc. I assume those are just shown to illustrate you you can do that, and not imply you should, because commonly using arbitrary code execution within interpolation is something I'd feel compelled to beat out of my coworkers if I encountered it regularly.
reply
The point of (sane) string interpolation is that it runs at compile time, which helps prevent people from inventing crazy template systems at runtime. And you automatically get things like safe SQL queries with parameter binding instead of injection vulnerabilities.
reply
> The point of (sane) string interpolation is that it runs at compile time, which helps prevent people from inventing crazy template systems at runtime.

It's the trivial cases that are compile time. The interesting templating is done with input that isn't defined within the source, and those can't be run entirely at compile time.

> And you automatically get things like safe SQL queries with parameter binding instead of injection vulnerabilities.

That's been solved for decades with parameterized queries (binding variables), and doesn't require interpolation in any way (at least not in the context we're using it here, but probably not at all in most DB drivers and engines). In fact, I would go so far as to say if someone is trying to use string interpolation instead of parameterized queries to avoid SQL injection, they've fundamentally misunderstood the problem and are trying to solve it at the wrong layer.

Also, if the string interpolation for the query is done at compile time, what type of content known at compile time is something that we'd be worried about SQL injection being in?

reply
The "trivial" cases are also the cases people actually need like structured logging, sanitized HTML, and SQL.

SQL doesn't require interpolation, but it's much cleaner to write it that way and not have to explicitly do binding. It's not an "instead." Like I said, what the interpolator does is automatic safe binding with interpolation syntax.

The content known at compile time is the query template that you're binding. The point is a compile-time interpolator turns e.g. `sql"""select * from users where name=$name"""` into `Statement("select * from users where name=?").bind(name)`.

You can also have macro fragments as "inline def" functions in e.g. Scala so that they compose naturally. c.f. Quill[0].

[0] https://zio.dev/zio-quill/extending-quill

reply
SQL parameter bindings solve only one part of the problem, that of putting variables into value positions. They don't solve the problem of putting variables into name positions (you cannot "SELECT FROM ?" or anything like it), and they certainly don't solve the problem of dynamic SQL. This is somewhat orthogonal to the topic at hand, but the mentality should be that the problem space is still quite open, with the existing solution being a starting point, not an ending point.
reply
Interesting point - syntax sugar was nice when writing code by hand. Now we'd be fine if no such sugar was added anymore ever again.
reply
Syntax sugar still matters if you need to review the code. It was always about reading, not writing. Actually macros are even more powerful with LLMs. Metaprogramming has always been difficult for many (most?) programmers, but LLMs have no issue with it, and it's mostly doing the kinds of manipulations where as long as it compiles, it's correct, so you don't really need to review it in the same way.
reply
The LLM itself is the metaprogramming, eventually we will be getting executables directly, the dream of previous AI Summers might finally materialise, with all the implications for the victims of software factories automation.
reply
The LLM still benefits from a concise type-checked language to write software in, in the exact way a human does.
reply
That would be formal rules, Lean style, and not related to 3 GL languages.
reply