Interpolation struct names and location
Paul Backus
snarwin at gmail.com
Wed Feb 14 12:59:34 UTC 2024
On Wednesday, 14 February 2024 at 05:30:47 UTC, Steven
Schveighoffer wrote:
> However, [these
> names](https://github.com/dlang/dmd/blob/98443676dcfa32f7234ebab6ca9f925e1d3cd736/druntime/src/core/interpolation.d#L102) are rather verbose. And every function that accepts these sequences is going to be mangled with some pretty long names.
>
> I propose we discuss both for where these types should live and
> what they should be called. I personally think we might want to
> move these things to object.d (yes, I know object.d is big, but
> these are not big or complex types), and rename them something
> more succinct.
I think putting them in `core.interpolation` instead of
`object.d` is fine. Having to `import core.interpolation` when
you write a function that takes an interpolation sequence is no
worse than having to `import core.vararg` when you write a
variadic function.
Normally, my suggestion would be to not repeat the module name in
the type name, and just call these `core.interpolation.Header`,
`core.interpolation.Footer`, `core.interpolation.Literal`, and
`core.interpolation.Expression`. However, the names of these
types are going to show up in user-facing error messages without
the module name attached, so having some kind of prefix to
distinguish them makes sense.
I agree that `Interpolation` is too long. `i` looks kind of weird
to me (violates the D style rules about capitalization), but if
we want brevity above all else, it's a reasonable choice. The
only other thing I can think of is `Interp`
More information about the Digitalmars-d
mailing list