Hacker News new | ask | show | jobs
by TwentyPosts 670 days ago
This like a bad idea on the first glance? Maybe I don't get the whole pitch here?

It just doesn't seem worth it to define a whole new thing just to abstract over a format() function call. The laziness might be interesting, but I feel like "lazy strings" might be all that's needed here. Laziness and validation (or custom string formatting logic) are separate concerns and should be separated.

1 comments

> It just doesn't seem worth it to define a whole new thing just to abstract over a format() function call.

That could also be leveraged at f-strings themselves.

> Laziness and validation (or custom string formatting logic) are separate concerns and should be separated.

In which case the one to move out is the laziness not the customised interpolation. Because the latter is the one that's necessary for safer dynamic SQL or HTML or whatever.