Re: Do we really need @unsafe?

2009-11-11 Thread Phil Deets
On Wed, 11 Nov 2009 06:04:16 -0500, Don wrote: Walter Bright wrote: Don wrote: Actually, I'd hope for a way of checking that @unsafe functions are called only from @trusted functions, and NOT from unmarked ones -- that's the way I'd proceed in moving a codebase over to 'safe'. That would

Re: Do we really need @unsafe?

2009-11-11 Thread Don
Walter Bright wrote: Don wrote: Actually, I'd hope for a way of checking that @unsafe functions are called only from @trusted functions, and NOT from unmarked ones -- that's the way I'd proceed in moving a codebase over to 'safe'. That would be fairly viral. I'm concerned it would make it an

Re: Do we really need @unsafe?

2009-11-11 Thread Walter Bright
Don wrote: Actually, I'd hope for a way of checking that @unsafe functions are called only from @trusted functions, and NOT from unmarked ones -- that's the way I'd proceed in moving a codebase over to 'safe'. That would be fairly viral. I'm concerned it would make it an impediment to use.

Re: Do we really need @unsafe?

2009-11-11 Thread Walter Bright
Don wrote: Actually, I'd hope for a way of checking that @unsafe functions are called only from @trusted functions, and NOT from unmarked ones -- that's the way I'd proceed in moving a codebase over to 'safe'. Based on the idea that the most common cause of safety violation is via passing incor

Re: Do we really need @unsafe?

2009-11-11 Thread Don
Walter Bright wrote: @unsafe was suggested (I think by Don) to provide symmetry with @safe and @trusted. This is a good point, but I'm starting to think that @unsafe is not a good idea. For example, one could make an entire module safe with: --- module foo; @safe: [...] --

Re: Do we really need @unsafe?

2009-11-10 Thread Justin Johansson
Walter Bright Wrote: > bearophile wrote: > > Walter Bright: > > > >> Furthermore, why would a safe module wish to expose unsafe functions? > >> Shouldn't the programmer instead be obliged to produce trusted functions > >> in it? > > > > If what you say is right, then what's the purpose/advanta

Re: Do we really need @unsafe?

2009-11-10 Thread Bill Baxter
On Tue, Nov 10, 2009 at 3:56 PM, Walter Bright wrote: > @unsafe was suggested (I think by Don) to provide symmetry with @safe and > @trusted. This is a good point, but I'm starting to think that @unsafe is > not a good idea. > > For example, one could make an entire module safe with: > > -

Re: Do we really need @unsafe?

2009-11-10 Thread Walter Bright
bearophile wrote: Walter Bright: Furthermore, why would a safe module wish to expose unsafe functions? Shouldn't the programmer instead be obliged to produce trusted functions in it? If what you say is right, then what's the purpose/advantage of using: module foo; @safe: Instead of this? mo

Re: Do we really need @unsafe?

2009-11-10 Thread bearophile
Walter Bright: > Furthermore, why would a safe module wish to expose unsafe functions? > Shouldn't the programmer instead be obliged to produce trusted functions > in it? If what you say is right, then what's the purpose/advantage of using: module foo; @safe: Instead of this? module(safe) foo;

Do we really need @unsafe?

2009-11-10 Thread Walter Bright
@unsafe was suggested (I think by Don) to provide symmetry with @safe and @trusted. This is a good point, but I'm starting to think that @unsafe is not a good idea. For example, one could make an entire module safe with: --- module foo; @safe: [...] --- And an