Re: D Article: Memory Safety

2016-01-21 Thread Brad Anderson via Digitalmars-d-announce
On Thursday, 21 January 2016 at 17:42:02 UTC, Jakob Ovrum wrote: On Thursday, 21 January 2016 at 17:39:11 UTC, Andrei Alexandrescu wrote: Good work, thanks! Has this been reddited yet? -- Andrei I don't think so. Personally I don't think I have a reddit account, but people are more than welco

Re: D Article: Memory Safety

2016-01-21 Thread Brad Anderson via Digitalmars-d-announce
On Thursday, 21 January 2016 at 17:56:19 UTC, Brad Anderson wrote: On Thursday, 21 January 2016 at 17:42:02 UTC, Jakob Ovrum wrote: On Thursday, 21 January 2016 at 17:39:11 UTC, Andrei Alexandrescu wrote: Good work, thanks! Has this been reddited yet? -- Andrei I don't think so. Personally I

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 17:39:11 UTC, Andrei Alexandrescu wrote: Good work, thanks! Has this been reddited yet? -- Andrei I don't think so. Personally I don't think I have a reddit account, but people are more than welcome to post it wherever they like :)

Re: D Article: Memory Safety

2016-01-21 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 01/20/2016 09:04 AM, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. Good work, thanks! Has this

Re: D Article: Memory Safety

2016-01-21 Thread Joakim via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. Nic

Re: D Article: Memory Safety

2016-01-21 Thread Dicebot via Digitalmars-d-announce
On Thursday, 21 January 2016 at 13:42:13 UTC, Jakob Ovrum wrote: On Thursday, 21 January 2016 at 13:39:48 UTC, Dicebot wrote: I'd suggest at the very least to add a comment before "p.bar();" saying "Must not escape 'p' pointer or @safe-ty will be compromised". I thought about this case, but i

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 13:52:57 UTC, Dicebot wrote: Reasonable, but the UFCS call can result from some other function defined in same module (Phobos modules are not small at all). Even small unlikely violation can completely destroy benefits of @safe so in my opinion one can't be overl

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 13:39:48 UTC, Dicebot wrote: I'd suggest at the very least to add a comment before "p.bar();" saying "Must not escape 'p' pointer or @safe-ty will be compromised". I thought about this case, but it relies on UFCS which is controlled by the callee. The caller ca

Re: D Article: Memory Safety

2016-01-21 Thread Dicebot via Digitalmars-d-announce
On Thursday, 21 January 2016 at 04:31:25 UTC, Jakob Ovrum wrote: That was for non-templated functions where this approach makes no sense. Indeed it is counterproductive, because @trusted on the whole function is a better indication of what needs to be reviewed for memory safety (the whole funct

Re: D Article: Memory Safety

2016-01-21 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: snip Thanks for all the feedback. I've pushed a revision with further changes, most of it based on the feedback in this thread. https://github.com/JakobOvrum/jakobovrum.github.io/commit/07c270567097f6cae5d9b95c88bd4d6c8124498c

Re: D Article: Memory Safety

2016-01-21 Thread Kagamin via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe Um, no, the article doesn't explain how to use @safe, it shows patterns that can be used to write safe code. The target audience must already understand safety.

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Thursday, 21 January 2016 at 06:20:01 UTC, rsw0x wrote: okay, I'll just use @safe here... and nothing else in third party libraries/half of phobos is @safe friendly so I guess I'll wrap it in @trusted oh fuck it Yeah, using @trusted like that is counterproductive. Just use @system or impro

Re: D Article: Memory Safety

2016-01-20 Thread rsw0x via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. my

Re: D Article: Memory Safety

2016-01-20 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Jan 21, 2016 at 05:09:48AM +, Basile B. via Digitalmars-d-announce wrote: [...] > I mean '@safe' at too low level is a handicap. It's like 'const'. They > are hard to use, mostly because of transitivness. These attributes are > never a noop. Transitivity also makes const really painfu

Re: D Article: Memory Safety

2016-01-20 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Jan 21, 2016 at 04:59:01AM +, Basile B. via Digitalmars-d-announce wrote: [...] > Altgough one thing, attributes are not the easy part of D. I've > recently encountered a case were in the library attributes were > allright, test OK, and then suddently when I've started to use the > lib

Re: D Article: Memory Safety

2016-01-20 Thread Basile B. via Digitalmars-d-announce
On Thursday, 21 January 2016 at 04:59:01 UTC, Basile B. wrote: On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/0

Re: D Article: Memory Safety

2016-01-20 Thread Basile B. via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. Goo

Re: D Article: Memory Safety

2016-01-20 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Jan 21, 2016 at 04:38:08AM +, Jakob Ovrum via Digitalmars-d-announce wrote: > On Wednesday, 20 January 2016 at 15:28:05 UTC, jmh530 wrote: > >I like the description of @trusted and template inference. Template > >inference, in particular, was not something that was obvious to me > >whe

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 20:28:03 UTC, Jon D wrote: This is passes the @safe constraint, but 'stdout.writeln()' and 'stderr.writeln()' do not. (My program uses stderr.) stderr/stdout/stdin are __gshared and can't be referenced by safe code. The module level version of writeln, etc., acc

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 15:28:05 UTC, jmh530 wrote: I like the description of @trusted and template inference. Template inference, in particular, was not something that was obvious to me when first reading about D. I'm not sure how clear you make it that you can still mark templates @s

Re: D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 19:55:45 UTC, H. S. Teoh wrote: On Wed, Jan 20, 2016 at 07:25:43PM +, Dicebot via Digitalmars-d-announce wrote: `auto p = () @trusted { return &t; } ();` Huh, I thought Andrei was opposed to this idiom? Is it now considered reserved for templates or somethi

Re: D Article: Memory Safety

2016-01-20 Thread Jon D via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. Nic

Re: D Article: Memory Safety

2016-01-20 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Jan 20, 2016 at 07:25:43PM +, Dicebot via Digitalmars-d-announce wrote: > `auto p = () @trusted { return &t; } ();` > > Huh, I thought Andrei was opposed to this idiom? Is it now considered > reserved for templates or something has changed? Yeah, I thought this was exactly the case w

Re: D Article: Memory Safety

2016-01-20 Thread Dicebot via Digitalmars-d-announce
`auto p = () @trusted { return &t; } ();` Huh, I thought Andrei was opposed to this idiom? Is it now considered reserved for templates or something has changed?

Re: D Article: Memory Safety

2016-01-20 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. I l

Re: D Article: Memory Safety

2016-01-20 Thread default0 via Digitalmars-d-announce
On Wednesday, 20 January 2016 at 14:04:53 UTC, Jakob Ovrum wrote: The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated. Nic

D Article: Memory Safety

2016-01-20 Thread Jakob Ovrum via Digitalmars-d-announce
The article aims to explain how to use @safe, @system and importantly, @trusted, including all the hairy details of templates. https://jakobovrum.github.io/d/2016/01/20/memory-safety.html Any and all feedback appreciated.