What previews should I enable?
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Fri May 30 01:41:45 UTC 2025
On Thursday, May 29, 2025 6:31:56 PM Mountain Daylight Time luafyn via Digitalmars-d-learn wrote:
> Hi everyone, so dmd includes several -preview flags and I was
> wondering if there were any that are recommended to enable?
>
> I like using the most up to date stuff possible so I've actually
> been using -preview=all and it seems to work alright, but then I
> hit a weird issue with sumtypes and -preview=dip1021 so I'm
> wondering if that's a bad idea.
>
> Some of the previews seem pretty ok to use like the bugfix
> previews but I'm not sure about the DIPs. Like, is it required
> for me to use -preview=dip1000 to have `scope` do anything, for
> example? Cheers!
Personally, I never use any of them unless I specifically want to test them.
As a general rule, they're experimental behavior, and they may or may not
become the default behavior. Some of them arguably should have become the
default behavior already, whereas others will probably never go anywhere. I
would not suggest using any of them as part of your normal builds unless
they specifically provide something that you're looking for.
-preview=dip1000 in particular is extremely controversial and likely will
not become the default in its current form. scope does have _some_ effect
without it, but it's minimal. However, with DIP 1000, scope becomes a
complicated mess. And even then, it's usually only useful if you're trying
to avoid the GC for some reason.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list