Thread overview
[Issue 18304] std.format functions with compile time format strings should be nothrow
Dec 17, 2022
Iain Buclaw
Apr 23
Forest
Apr 23
basile-z
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18304

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
April 23
https://issues.dlang.org/show_bug.cgi?id=18304

Forest <forestix@nom.one> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |forestix@nom.one

--
April 23
https://issues.dlang.org/show_bug.cgi?id=18304

basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
         Resolution|---                         |INVALID

--- Comment #1 from basile-z <b2.temp@gmx.com> ---
Why the heck would they have to be ?

```
void main()
{
    import std;
    int i = 0;
    format!"%s"((){if (!i) throw new Exception("oops"); return "helloho";
}()).writeln;
}
```

just let attribute inference do the job.

--
April 23
https://issues.dlang.org/show_bug.cgi?id=18304

Jack Stouffer <jack@jackstouffer.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Jack Stouffer <jack@jackstouffer.com> ---
The point is that

void main() nothrow
{
    import std;
    int i = 0;
    format!"%s"("This is a string");
}

doesn't work because exceptions are still thrown for checks that should be happening at compile time. E.g. attribute inference cannot be done.

--