Closed josephrocca closed 10 months ago
Please feel free to close if this is actually an age-old discussion - i.e. something that has been firmly established to be a bad idea.
Closing this as a dupe of https://github.com/tc39/proposal-string-dedent/issues/25. When I last brought this up in the committee, they recognized this use case but think it can be addressed as a follow up after the core proposal.
@jridgewell Ah, sorry for missing that. Can I quickly ask: Does the committee think that the non-preserved-expression-indent mode is more intuitive as the default behavior?
Maybe it is better for having it enabled by default?
Does the committee think that the non-preserved-expression-indent mode is more intuitive as the default behavior?
Correct. Just having regular string concatenation is the least surprising behavior.
I'm guessing there's enough prior art here to know that what I want here is not a good idea, all things considered, but I have a use case that looks something like this:
That outputs this:
Whereas I'm trying to outputs this:
I'm wondering - if the "injected" string is indented, then isn't the dev's intention clearly that the injected string should "live at" that level of indentation?
I guess the key question is: Are there reasonable/common cases where the behaviour I desire here is counter-intuitive?
It's very possible that I'm blinded by my specific use case here. I'm posting this issue because this is basically the first time I've needed to use a dedent library (my use case is LLM prompt construction), and it's possible (though unlikely) that some "fresh eyes" on this might help break away from prior art / conventional wisdom in a way that actually makes sense in terms creating an intuitive developer experience.