Re: Why hide a trusted function as safe?

2015-07-26 Thread anonymous via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:38:31 UTC, simendsjo wrote: Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The reason I ask is because I found

Re: Struct that destroys its original handle on copy-by-value

2015-07-26 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:30:16 UTC, Joseph Rushton Wakeling wrote: Hello all, A design question that came up during the hackathon held during the last Berlin D Meetup. [...] Sounds like unique_ptr (so UniqueRange might be a nice name). Maybe you can get some ideas from that.

Re: Why hide a trusted function as safe?

2015-07-26 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 26/07/15 14:24, Adam D. Ruppe via Digitalmars-d-learn wrote: If the whole function is marked @trusted, the compiler doesn't try to check it at all - it just takes your word for it. There was a bit of argument about this a while ago in bugzilla, not everyone agrees it is a good idea. I don't

Re: static linking

2015-07-26 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 26 July 2015 at 05:22:14 UTC, Martin Nowak wrote: On Saturday, 25 July 2015 at 18:02:48 UTC, Laeeth Isharc wrote: I am trying to compile a D binary to run on AWS lambda. If I cannot link statically, which files should I include in the zip upload - libphobos2.so,

Struct that destroys its original handle on copy-by-value

2015-07-26 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello all, A design question that came up during the hackathon held during the last Berlin D Meetup. I was trying to come up with a range that can be copied by value, but when this is done, destroys the original handle. The idea would be behaviour something like this: auto

Re: Why hide a trusted function as safe?

2015-07-26 Thread Johannes Pfau via Digitalmars-d-learn
Am Sun, 26 Jul 2015 13:11:51 + schrieb Dicebot pub...@dicebot.lv: I remember doing something like that in druntime because of objects - you can't override @safe method prototype with @trusted one. That's probably related to the fact that safe and trusted functions have different

Re: GC stats

2015-07-26 Thread simendsjo via Digitalmars-d-learn
On Sunday, 26 July 2015 at 14:16:46 UTC, Gary Willoughby wrote: On Saturday, 25 July 2015 at 17:43:44 UTC, Martin Nowak wrote: On Saturday, 25 July 2015 at 17:34:26 UTC, Márcio Martins wrote: What I want is a clean non-intrusive way to log when a collection happened, how long my threads were

Why hide a trusted function as safe?

2015-07-26 Thread simendsjo via Digitalmars-d-learn
Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The reason I ask is because I found the following in std.concurrency: @property Tid

Re: Why hide a trusted function as safe?

2015-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:38:31 UTC, simendsjo wrote: Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The Phobos idiom you've seen there

Re: GC stats

2015-07-26 Thread Gary Willoughby via Digitalmars-d-learn
On Saturday, 25 July 2015 at 17:43:44 UTC, Martin Nowak wrote: On Saturday, 25 July 2015 at 17:34:26 UTC, Márcio Martins wrote: What I want is a clean non-intrusive way to log when a collection happened, how long my threads were stopped, how much total memory and how many blocks were

Re: Why hide a trusted function as safe?

2015-07-26 Thread Dicebot via Digitalmars-d-learn
I remember doing something like that in druntime because of objects - you can't override @safe method prototype with @trusted one.

Re: Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2015 11:07 AM, Gary Willoughby wrote: In the description for Fiber in std.thread is the following[1]: Please note that there is no requirement that a fiber be bound to one specific thread. Rather, fibers may be freely passed between threads so long as they are not currently

Re: static linking

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 05:19 PM, Laeeth Isharc wrote: The former is trickier on arch in particular (not related to Dicebot's choice) because they don't distributed static versions of library files as a matter of policy. Yes, quite a few distributions no longer support fully static linking. Some, e.g.

Re: static linking

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 05:19 PM, Laeeth Isharc wrote: How do I do the same on gdc and ldc ? Since running times may be a matter of seconds, speed and startup time counts especially for lambda. Probably starting via nodejs is an unnecessary tax, but I guess they will get rid of that requirement in

Re: static linking

2015-07-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 26, 2015 19:17:59 Martin Nowak via Digitalmars-d-learn wrote: On 07/26/2015 05:19 PM, Laeeth Isharc wrote: The former is trickier on arch in particular (not related to Dicebot's choice) because they don't distributed static versions of library files as a matter of policy.

Re: [Rosettacode] sum of powers conjecture

2015-07-26 Thread Daniel N via Digitalmars-d-learn
On Sunday, 26 July 2015 at 18:40:59 UTC, bearophile wrote: I've translated the C++ entry to D as third D entry, but it's not a good translation, I've just converted iterators to pointers instead of using ranges (the resulting speed is acceptable). You're welcome to improve it:

[Rosettacode] sum of powers conjecture

2015-07-26 Thread bearophile via Digitalmars-d-learn
I've translated the C++ entry to D as third D entry, but it's not a good translation, I've just converted iterators to pointers instead of using ranges (the resulting speed is acceptable). You're welcome to improve it:

Re: Struct that destroys its original handle on copy-by-value

2015-07-26 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 26/07/15 13:45, Martijn Pot via Digitalmars-d-learn wrote: Sounds like unique_ptr (so UniqueRange might be a nice name). Maybe you can get some ideas from that. There is already a Unique in std.typecons. However, I'm not sure that it's doing what I require. Example: Unique!Random

Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Gary Willoughby via Digitalmars-d-learn
In the description for Fiber in std.thread is the following[1]: Please note that there is no requirement that a fiber be bound to one specific thread. Rather, fibers may be freely passed between threads so long as they are not currently executing. How would this be accomplished and are there

Re: Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 26 July 2015 at 19:51:08 UTC, Ali Çehreli wrote: On 07/26/2015 11:07 AM, Gary Willoughby wrote: In the Thanks for the example. I'll study it.

Re: GC stats

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 04:16 PM, Gary Willoughby wrote: I thought there is a recently added compiler option that profiles the GC and creates a report now? That's an allocation profiler, the other one mentioned by me reports GC stats as requested by the OP.