Named constructors

Jin nin-jin at ya.ru
Mon Jan 6 14:59:02 UTC 2025


On Saturday, 9 November 2024 at 00:02:52 UTC, JN wrote:
> ```d
> Angle a1 = new Angle.fromRadians(PI / 2.0f);
> Angle a2 = new Angle.fromDegrees(90.0f);
> ```

Just use static methods:

```d
Angle a1 = Angle.fromRadians(PI / 2.0f);
Angle a2 = Angle.fromDegrees(90.0f);
```

Or right unit types:

```d
Angle a1 = Angle(PI.rad / 2.0f);
Angle a2 = Angle(90.0f.deg);
```




More information about the dip.ideas mailing list