www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What previews should I enable?

reply luafyn <VuLXn6DBW PPtUm7TvV6nsw.com> writes:
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!
May 29
next sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Friday, 30 May 2025 at 00:31:56 UTC, luafyn 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!
None, its all stuff that makes less code work, several of them have been there for years with known fundamental flaws.
May 29
prev sibling next sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
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
May 29
prev sibling next sibling parent Sergey <kornburn yandex.ru> writes:
On Friday, 30 May 2025 at 00:31:56 UTC, luafyn wrote:
 Hi everyone, so dmd includes several -preview flags and I was 
 wondering if there were any that are recommended to enable?
I think no
 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!
DIP1000 is under discussion for dropping. Moreover I would suggest to not consider D as a language with plans and proper design team which have "recommended" things. The dev team is severely understaffed and nobody is doing high-level design work. And if you will think about D as a language where any hacker has some idea and some time/energy to push it - it can be added to the language, even if it is not working well with other parts of the language, or even if the implementation is not fully thought and not all corner cases were properly designed. So working with D from that perspective should help you to properly identify preview flags as "I want this hack-feature for my hacking". Having this in mind should better describe them and overall D idea as a lang for lone-wolf experienced hackers. Hope this helped to better feel D's zen
May 29
prev sibling parent Dom DiSc <dominikus scherkl.de> writes:
On Friday, 30 May 2025 at 00:31:56 UTC, luafyn wrote:
 Hi everyone, so dmd includes several -preview flags and I was 
 wondering if there were any that are recommended to enable?
I always use -preview=all, this also buys you dip1000, but otherwise the list is just too long and everything else has never annoyed me and was helpful several times.
May 30