digitalmars.D - Interpolation struct names and location
- Steven Schveighoffer (23/23) Feb 13 [DIP 1036e](https://github.com/dlang/dmd/pull/15715) has been
- Richard (Rikki) Andrew Cattermole (4/4) Feb 13 One option to consider is to give it a long name that is an alias in
- Daniel N (3/7) Feb 14 importing another file, just slows down compilation.
- Richard (Rikki) Andrew Cattermole (4/13) Feb 14 Not necessarily.
- Paul Backus (18/25) Feb 14 I think putting them in `core.interpolation` instead of
- Steven Schveighoffer (11/20) Feb 14 I'm not too worried about having to import. It's more of the fact
- Paul Backus (4/9) Feb 14 `IstrHeader` or `IseqHeader`, maybe? Shaves off a couple more
- Atila Neves (2/18) Feb 15 This can be fixed by using the fully qualified name.
- Dukc (10/12) Feb 15 One idea. For consistency with [named character
- Quirin Schroll (7/11) Feb 15 If mangled name length is an issue, couldn’t you name them
[DIP 1036e](https://github.com/dlang/dmd/pull/15715) has been merged and is going to be in the next release (set to be cut on March 1). Once this is upon the world, it will be very difficult to change the names of the types used for these things. I want to make sure everyone has a chance to think about this and suggest what they think. The way the lowering is set up, you do NOT have to import `core.interpolation` to *use* them. Most of the time, you will be only doing that in order accept the types as function parametrers. However, [these names](https://github.com/dlang/dmd/blob/98443676dcfa32f7234ebab6ca9f925e1d3cd736/druntime/src/core/i terpolation.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. Something like `iHeader`, `iFooter`, `iExpr`, `iLiteral` would be descriptive enough (everyone is going to be calling these istrings, even though they are Interpolation Expression Sequences). This is the time to debate, before it's released! -Steve
Feb 13
One option to consider is to give it a long name that is an alias in object.d but a short name in a second module. That'll keep mangling to be a non-issue and attempt to keep object.d size down, even if it does mean an import.
Feb 13
On Wednesday, 14 February 2024 at 05:33:54 UTC, Richard (Rikki) Andrew Cattermole wrote:One option to consider is to give it a long name that is an alias in object.d but a short name in a second module. That'll keep mangling to be a non-issue and attempt to keep object.d size down, even if it does mean an import.importing another file, just slows down compilation.
Feb 14
On 14/02/2024 10:41 PM, Daniel N wrote:On Wednesday, 14 February 2024 at 05:33:54 UTC, Richard (Rikki) Andrew Cattermole wrote:Not necessarily. It all depends upon how lazy the compiler can be for: ``public import std.stdio : wln = writeln;``One option to consider is to give it a long name that is an alias in object.d but a short name in a second module. That'll keep mangling to be a non-issue and attempt to keep object.d size down, even if it does mean an import.importing another file, just slows down compilation.
Feb 14
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/i terpolation.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`
Feb 14
On Wednesday, 14 February 2024 at 12:59:34 UTC, Paul Backus wrote: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.I'm not too worried about having to import. It's more of the fact that these are going to be mangled with the package/module name (though the mangling backreference system will limit this a bit). I should probably actually test and see what it looks like.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`I thought of `IHeader` but that looks like an interface... I also thought of `IESHeader` but this is less obvious to someone who sees it. InterpHeader is still long, but a bit better. Any reduction is better than no reduction? -Steve
Feb 14
On Wednesday, 14 February 2024 at 16:28:32 UTC, Steven Schveighoffer wrote:I thought of `IHeader` but that looks like an interface... I also thought of `IESHeader` but this is less obvious to someone who sees it. InterpHeader is still long, but a bit better. Any reduction is better than no reduction?`IstrHeader` or `IseqHeader`, maybe? Shaves off a couple more characters.
Feb 14
On Wednesday, 14 February 2024 at 12:59:34 UTC, Paul Backus wrote:On Wednesday, 14 February 2024 at 05:30:47 UTC, Steven Schveighoffer wrote:This can be fixed by using the fully qualified name.[...]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.
Feb 15
On Wednesday, 14 February 2024 at 05:30:47 UTC, Steven Schveighoffer wrote:This is the time to debate, before it's released! -SteveOne idea. For consistency with [named character entities](https://dlang.org/spec/entity.html) maybe it'd be better if these were escape sequences too? \$identifier or \$(an.expression), with "i" omitted from the beginning. Don't hesistate to stratch this idea though if you're even slightly against it. Since Walter already approved the present syntax I don't think we should spend time debating the syntax further.
Feb 15
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/i terpolation.d#L102) are rather verbose. And every function that accepts these sequences is going to be mangled with some pretty long names. […]If mangled name length is an issue, couldn’t you name them something very, very succinct like `__iH`, `__iF`, `__iE`, and `__iL` and just define some easy-to-comprehend aliases? As far as short mangling is concerned, the succinct identifiers need not even be (public) in object.d, only the aliases.
Feb 15