www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Safer D is implemented!

reply Walter Bright <newshound2 digitalmars.com> writes:
https://github.com/dlang/dmd/pull/17044

It's enabled with -preview=safer

It enables "safe by default". This is different from marking functions as
 safe, 
in that:

1. it does not mark the function as  safe, the function mangling does not change

2. it enables all  safe checks except it does not complain about calling
 system 
functions

3. it does not interfere with attribute inference

In other words, it does not impose transitive safety. You can still call 
malloc() and printf() in it.

Once it appears in the next release, I encourage people to add -preview=safer
to 
their build process.
Nov 27
next sibling parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Thursday, November 28, 2024 12:08:29 AM MST Walter Bright via Digitalmars-
d-announce wrote:
 https://github.com/dlang/dmd/pull/17044

 It's enabled with -preview=safer

 It enables "safe by default". This is different from marking functions as
  safe, in that:

 1. it does not mark the function as  safe, the function mangling does not
 change

 2. it enables all  safe checks except it does not complain about calling
  system functions

 3. it does not interfere with attribute inference

 In other words, it does not impose transitive safety. You can still call
 malloc() and printf() in it.

 Once it appears in the next release, I encourage people to add
 -preview=safer to their build process.
So, essentially, it makes functions with no explicit safety attributes be somewhere between system and safe by disallowing language constructs which are considered system but not disallowing calling system functions. - Jonathan M Davis
Nov 28
parent reply Walter Bright <newshound2 digitalmars.com> writes:
Right.
Nov 28
parent reply f <f abc.com> writes:
On Thursday, 28 November 2024 at 21:01:30 UTC, Walter Bright 
wrote:
 Right.
11 languages have coroutine support natively Only 1 with full borrow semantics : rust. That according to chatgpt Please sir , the coroutine dips is still at 1st draft. While other dip will make lines fewer , their execution still from top down. The coroutine, is a game changer. That will make porting library from other languages straightforward.
Nov 28
next sibling parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 29/11/2024 10:30 AM, f wrote:
 On Thursday, 28 November 2024 at 21:01:30 UTC, Walter Bright wrote:
 Right.
11 languages have coroutine support natively Only 1 with full borrow semantics : rust. That according to chatgpt Please sir , the coroutine dips is still at 1st draft. While other dip will make lines fewer , their execution still from top down. The coroutine, is a game changer. That will make portingĀ  library from other languages straightforward.
I'll be restarting on my language design work, including coroutines next year. I'm taking a few months where I work on my own stuff. I have not forgotten any of the design work :)
Nov 28
prev sibling parent Sergey <kornburn yandex.ru> writes:
On Thursday, 28 November 2024 at 21:30:33 UTC, f wrote:
 On Thursday, 28 November 2024 at 21:01:30 UTC, Walter Bright 
 wrote:
 Right.
The coroutine, is a game changer. That will make porting library from other languages straightforward.
People mostly with C99 and C++(who even touch 20th standard, right?) experience will answer: we have core.thread and std.concurrency for years.. this is enough, what else do you want? :P
Nov 28
prev sibling parent Duan Tihua <duantihua 163.com> writes:
On Thursday, 28 November 2024 at 07:08:29 UTC, Walter Bright 
wrote:
 https://github.com/dlang/dmd/pull/17044

 It's enabled with -preview=safer
For writing memory safe code, this is a more practical engineering approach. Fortunately, this compilation option will reduce the number of times safe annotation is used and the code will be relatively cleaner.
Nov 29