Re: Cool pattern or tragic?

2023-09-24 Thread cc via Digitalmars-d-learn
On Friday, 25 August 2023 at 21:00:08 UTC, Guillaume Piolat wrote: The idea is to deliberately mark @system functions that need special scrutiny to use, regardless of their memory-safety. Function that would typically be named `assumeXXX`. ... That way, @safe code will still need to manually

Re: Cool pattern or tragic?

2023-08-26 Thread user1234 via Digitalmars-d-learn
On Friday, 25 August 2023 at 21:00:08 UTC, Guillaume Piolat wrote: The idea is to deliberately mark @system functions that need special scrutiny to use, regardless of their memory-safety. Function that would typically be named `assumeXXX`. ```d class MyEncodedThing { Encoding encoding;

Re: Cool pattern or tragic?

2023-08-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 25, 2023 3:00:08 PM MDT Guillaume Piolat via Digitalmars-d- learn wrote: > The idea is to deliberately mark @system functions that need > special scrutiny to use, regardless of their memory-safety. > Function that would typically be named `assumeXXX`. > > > > ```d > class

Re: Cool pattern or tragic?

2023-08-25 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
I do something similar with my error types. I have a method called assumeOkay. It'll assert if it isn't ok. There is also unsafeGetLiteral for slice based types. All @system.

Cool pattern or tragic?

2023-08-25 Thread Guillaume Piolat via Digitalmars-d-learn
The idea is to deliberately mark @system functions that need special scrutiny to use, regardless of their memory-safety. Function that would typically be named `assumeXXX`. ```d class MyEncodedThing { Encoding encoding; /// Unsafe cast of encoding. void assumeEncoding (Encoding