Re: Does D has C#'s string.Empty?

2014-09-25 Thread Chris Cain via Digitalmars-d-learn
On Friday, 26 September 2014 at 01:09:01 UTC, AsmMan wrote: On Friday, 26 September 2014 at 00:53:24 UTC, ketmar via Digitalmars-d-learn wrote: On Fri, 26 Sep 2014 00:24:27 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: It made me a bit confusing. How is the

Re: RFC: reference counted Throwable

2014-09-20 Thread Chris Cain via Digitalmars-d
I'm just throwing a new ThisOutThereException: What if we modified the exception hierarchy to have it so Throwables are GC allocated but there's an alternate set of classes down another line that either must be manually managed or are RC. Thus, there's no breakage. Something like: class

Re: destroy(someStruct)

2014-09-20 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 20 September 2014 at 22:46:10 UTC, John Colvin wrote: import core.stdc.stdio; struct S { ~this() { printf(%x\n.ptr, this); } } void main() { S* sp = new S; destroy(*sp); S s; destroy(s); auto sa = new

Re: literate programming in D

2014-08-30 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 30 August 2014 at 07:33:38 UTC, Philippe Sigaud wrote: On Friday, 29 August 2014 at 23:58:19 UTC, Chris Cain wrote: I used https://www.npmjs.org/package/literate-programming (+ pandoc) to do this when writing https://dl.dropboxusercontent.com/u/2206555/uniformUpgrade.pdf in

Re: literate programming in D

2014-08-29 Thread Chris Cain via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 14:55:08 UTC, nikki wrote: I've been googling without luck, is there a way to do literate programming in D?, similar to how it's done in Coffeescript ? http://www.coffeescriptlove.com/2013/02/literate-coffeescript.html basically me writing comments around code

Re: GC can collect object allocated in function, despite a pointer to the object living on?

2014-08-16 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 16 August 2014 at 22:36:51 UTC, 岩倉 澪 wrote: void changeState(){ if(nextState != WaitState nextState != ExitState){ auto newState = cast(IState) Object.factory(game.states.~nextState); import std.exception; enforce(newState); // !!!

Re: unittesting generic functions

2014-08-13 Thread Chris Cain via Digitalmars-d
On Thursday, 14 August 2014 at 02:04:09 UTC, Idan Arye wrote: Well, there's nothing to test in abstract functions, is there? I'm more concerned about the unit test appearing before the code, when the usual convention is to put the unit tests after the code they are testing... There is

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Chris Cain via Digitalmars-d-learn
On Monday, 4 August 2014 at 12:05:31 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: OK, I get it. Just to be sure, there is no ThreadPool in Phobos or in core, right? IIRC, there are fibers somewhere in core, I'll have a look. I also heard the vibe.d has them. There is. It's called

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 05:32:43 UTC, Timon Gehr wrote: Well, if there is no proof of something, how can I claim it can be proven? In fact, in my past life, when somebody told me something like '...and actually one _can prove_ that any non-planar graph contains either a K_5 or a K_{3,3}

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 06:08:43 UTC, Tofu Ninja wrote: On Saturday, 2 August 2014 at 05:07:58 UTC, Chris Cain wrote: Actually, I'm going to clarify this: Your assertion is *not* the promise. Your assertion is simply a statement of fact (note, that does not mean it's a fact, as that

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 06:36:00 UTC, Timon Gehr wrote: http://en.wikipedia.org/wiki/Falsifiability ^^ See? A statement is called falsifiable if it is possible to conceive an observation or an argument which proves the statement in question to be false. If we have proven the

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 07:23:07 UTC, Timon Gehr wrote: Thanks for having been a reasonable discussion partner. Same to you. Have a good evening :)

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 07:36:34 UTC, Tofu Ninja wrote: On Saturday, 2 August 2014 at 06:35:33 UTC, Chris Cain wrote: Well, you can disagree but it doesn't change the fact that what I meant and what you're saying are two different things. With Yes I disagreed with you... so yes I

Re: checkedint call removal

2014-08-02 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 07:36:34 UTC, Tofu Ninja wrote: ... Look, this is the point I'm trying to make. Given the English definition of assert (Just accept the definition, I'm tired: statement of fact or belief confidently and forcefully), I claim that it makes sense that a compiler

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 14:08:56 UTC, Daniel Gibson wrote: .. but even if I were: words used for constructs/function-names/... in programming often don't 100% match their real meaning (as used in human communication)[1] - why should it be different for assert(), especially when not

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 21:29:48 UTC, Timon Gehr wrote: en.wikipedia.org/wiki/Evidence http://en.wikipedia.org/wiki/Sausage ... Sorry, I don't know what you meant by that. :-)

Re: Setting array length to 0 discards reserved allocation?

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 07:51:32 UTC, Andrew Godfrey wrote: Going through other .dd files, I found an error in expression.dd. It says For static or dynamic arrays, identity is defined as referring to the same array elements and the same number of elements. Well, in fact: unittest {

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 22:01:01 UTC, Timon Gehr wrote: You will notice it uses the word 'assertion' in a way that is incompatible with your claim that the assert definition rules out such an usage. How so? It's an article on evidence. All it seems to suggest is that evidence can be used

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 22:05:04 UTC, Daniel Gibson wrote: Yeah, it seems like assertion doesn't *have* to mean something like promise I'd argue that it never really means promise. It's a simple statement. In the sense of programming stating something that is incorrect will cause

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 22:17:15 UTC, Timon Gehr wrote: contradictory assertions To what degree of certitude must the assertion be supported? etc. I'll not go into more details because I actually intend not to participate again in heated debate after already having shown strong

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 22:20:02 UTC, Timon Gehr wrote: On 08/02/2014 12:07 AM, Chris Cain wrote: On Friday, 1 August 2014 at 22:05:04 UTC, Daniel Gibson wrote: Yeah, it seems like assertion doesn't *have* to mean something like promise I'd argue that it never really means promise.

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 23:11:17 UTC, Timon Gehr wrote: ( Source: http://www.chris.com/ascii/index.php?art=objects/explosives ) On 08/02/2014 12:26 AM, Chris Cain wrote: On Friday, 1 August 2014 at 22:17:15 UTC, Timon Gehr wrote: contradictory assertions To what degree of certitude must

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 01:55:49 UTC, Timon Gehr wrote: On 08/02/2014 03:11 AM, Chris Cain wrote: However, by not stating what it is you have provided strong evidence for, Why would I need to? It is what you were arguing against: You will notice it uses the word 'assertion' in a way

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
Here, I'll do you the favor of giving you a few more Google results with hopes that you'll start developing a mental model behind what the definition of assertion is: Google itself: state a fact or belief confidently and forcefully http://dictionary.reference.com/browse/assert: to state with

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 02:32:45 UTC, Timon Gehr wrote: On 08/02/2014 04:28 AM, Chris Cain wrote: ... I retract my apology. Of course. The worst curse I could wish upon you is that you stick to your guns. So stick to your guns, my friend. :-)

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 03:07:25 UTC, Tofu Ninja wrote: D3 anyone? :) Macros please. God please. I assert(macrosExist);

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 04:00:01 UTC, Timon Gehr wrote: On 08/02/2014 05:14 AM, Chris Cain wrote: On Saturday, 2 August 2014 at 03:07:25 UTC, Tofu Ninja wrote: D3 anyone? :) Macros please. God please. I assert(macrosExist); core.exception.AssertError@chris(332812126): Assertion

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 03:40:47 UTC, Timon Gehr wrote: I already googled 'statement of fact' myself earlier, and found the wikipedia entry for 'fact', that I quoted back then: http://en.wikipedia.org/wiki/Fact The usual test for a statement of fact is verifiability, that is, whether it

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 04:28:33 UTC, Timon Gehr wrote: On 08/02/2014 06:11 AM, Chris Cain wrote: On Saturday, 2 August 2014 at 03:40:47 UTC, Timon Gehr wrote: I already googled 'statement of fact' myself earlier, and found the wikipedia entry for 'fact', that I quoted back then:

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 04:40:53 UTC, Tofu Ninja wrote: I don't know... maybe I can try to explain what he is trying to say. Correct me if I am wrong in either of your interpretations of assert. Your claim is that an assertion is a promise, by the person asserting, that something is

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 04:54:09 UTC, Andrei Alexandrescu wrote: I don't think there's ever been a more majestic thread in the history of this forum. Probably up there with the best of them anywhere and anytime. It's become officially an Epic Debate. Andrei Oh by the way, how about

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 04:47:05 UTC, Timon Gehr wrote: BTW: I missed something: On 08/01/2014 11:18 PM, Chris Cain wrote: Imagine my surprise when I Google'd assert definition to find it meant state a fact or belief confidently and forcefully. On 08/02/2014 12:03 AM, Chris Cain

Re: checkedint call removal

2014-08-01 Thread Chris Cain via Digitalmars-d
On Saturday, 2 August 2014 at 05:12:12 UTC, Tofu Ninja wrote: On Saturday, 2 August 2014 at 04:46:43 UTC, Chris Cain wrote: No. You can verify it but find it to be false. Your proof would show it to be false. The fact that you can write a proof showing it to be false is a proof that it was

Re: checkedint call removal

2014-07-31 Thread Chris Cain via Digitalmars-d
On Thursday, 31 July 2014 at 08:36:12 UTC, John Colvin wrote: Wait what? Now I'm confused. x y is guaranteed at point B (the assert). x and y are unchanged between point A (the enforce) and point B. Therefore, x y is guaranteed at point A That's not true. If x and y didn't follow x y,

Re: assume, assert, enforce, @safe

2014-07-31 Thread Chris Cain via Digitalmars-d
On Friday, 1 August 2014 at 01:20:04 UTC, Walter Bright wrote: I'm rather astonished you'd take that position. It opens a huge door wide for undefined behavior, and no obvious way of verifying that the assume() is correct. I'm confident that if D introduced such behavior, the very first

Re: Setting array length to 0 discards reserved allocation?

2014-07-24 Thread Chris Cain via Digitalmars-d
See this post: http://forum.dlang.org/thread/shpcpmwvphbyaumxg...@forum.dlang.org My response in that thread: The reason is simple, observe: auto arr = [1,2,3] It is safe if you append 4 to that. auto arr = [1,2,3,4] auto other = arr[]; arr.length = 2; It is *not* safe to append 5 to

Re: @nogc

2014-07-11 Thread Chris Cain via Digitalmars-d
On Friday, 11 July 2014 at 07:45:24 UTC, bearophile wrote: Joseph Rushton Wakeling: I've habitually used 'format' to prepare assert messages with variable content, which has a similar problem -- IIRC it conflicts with nothrow and I guess it too would conflict with @nogc. A solution is to

Re: @nogc

2014-07-11 Thread Chris Cain via Digitalmars-d
On Friday, 11 July 2014 at 07:45:24 UTC, bearophile wrote: range, where the range you use a stack-allocated array of chars Actually, thinking about this more, it's possible if the array of chars is malloc'd instead and written to (of course, that's not `@noalloc`, but that's ok). It's just

Re: @nogc

2014-07-11 Thread Chris Cain via Digitalmars-d
On Friday, 11 July 2014 at 14:18:35 UTC, H. S. Teoh via Digitalmars-d wrote: Wouldn't @reallynogc == @nogc + nothrow ? Not precisely. Throwing is perfectly fine in @reallynogc. You just can't cheat by allowing allocating exceptions using the GC. Technically it *could* work, but removing

Re: @nogc

2014-07-10 Thread Chris Cain via Digitalmars-d
On Friday, 11 July 2014 at 03:45:17 UTC, Walter Bright wrote: I've thought of allowing throw new ..., and yours would be in addition to that, in @nogc functions, but was waiting to see how this would play out a bit first. Errors I agree with (basically, that's the end of your program, so

Re: @nogc

2014-07-10 Thread Chris Cain via Digitalmars-d
On Friday, 11 July 2014 at 04:23:20 UTC, Kapps wrote: I somewhat remember discussion about this originally during the @nogc discussions. My stance remains that if you're throwing exceptions, you don't care about the semi-realtime requirements that @nogc benefits. Ideally it would be some sort

Re: GC behavior and Allocators

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 10:36:03 UTC, safety0ff wrote: I just thought a little more about this and you will always have a race. Consider this code: auto a = malloc(aSize); GC.addRange(a, aSize); auto b = realloc(a, aSize * 2); If realloc moves the data (a != b) and the GC runs before you

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 19:46:40 UTC, Remo wrote: Who want to use C-style memory management today ? How about C++ style memory management, is this easy to this in D2 now ? The big problem with that is C++ style memory management implies we're going to have new/delete which AFAIK delete is

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 20:25:24 UTC, Chris Cain wrote: depreciated deprecated*. I swear I say it correctly and when I'm coding I type it correctly there XD

Re: Languages for servers (Go, D, and more)

2014-07-04 Thread Chris Cain via Digitalmars-d
On Friday, 4 July 2014 at 21:09:05 UTC, Remo wrote: By C++ style memory management I do not mean naked new/delete or malloc/free. What I mean is RAII, smart pointers and destructor's. What is the proper replacement for std::unique_ptr and std::shared_ptr in D2 ? Of course with move support

Re: std.math performance (SSE vs. real)

2014-06-30 Thread Chris Cain via Digitalmars-d
On Monday, 30 June 2014 at 19:42:34 UTC, Temtaime wrote: And my opinion is that real should be deprecated and removed in the future. Double is enough. If your application depends on float-point accuracy you have problems. I think that real should be deprecated and removed in favor of a

Re: std.math performance (SSE vs. real)

2014-06-30 Thread Chris Cain via Digitalmars-d
On Monday, 30 June 2014 at 21:51:22 UTC, H. S. Teoh via Digitalmars-d wrote: How do you implement 80-bit reals in the library? Is it a legitimate problem to do so? My feeling is that it should be possible if it's possible to implement it in C or asm since it's possible to do everything in D

Re: Cryptography and D

2014-06-29 Thread Chris Cain via Digitalmars-d
On Sunday, 29 June 2014 at 09:24:39 UTC, Tobias Pankrath wrote: The best way to become one of these damned few people is getting started though. If getting started means go to college and get a doctorate for Crypto, I agree. If getting started means write some crypto libraries until you

Re: Cryptography and D

2014-06-29 Thread Chris Cain via Digitalmars-d
On Sunday, 29 June 2014 at 17:45:41 UTC, Nick Sabalausky wrote: The crypto algorithms are very well defined and documented. You don't need to understand the theory behind them in order to implement them. You just need to be able to: - Read/follow the spec accurately - NOT invent your own

Re: D Logos

2014-06-25 Thread Chris Cain via Digitalmars-d
On Wednesday, 25 June 2014 at 11:07:47 UTC, Alix Pexton wrote: Here are half a morning's worth of doodles, let me know if you see anything you like. https://drive.google.com/file/d/0B3i8FWPuOpryaGVwb2NKT18zNFE/edit A... Yeah, the one on the 3rd row next to GDC looks fantastic to me. I'd

Re: Optimizing Java using D

2014-06-24 Thread Chris Cain via Digitalmars-d
On Tuesday, 24 June 2014 at 09:22:24 UTC, Andrea Fontana wrote: On Monday, 23 June 2014 at 16:33:13 UTC, Chris Cain wrote: It's not really about the time complexity but the absolute time it must take. But I showed the example that shows that the fact that any stable sort must do extra work:

Re: D Logos

2014-06-24 Thread Chris Cain via Digitalmars-d
On Sunday, 22 June 2014 at 08:52:56 UTC, Alix Pexton wrote: https://drive.google.com/file/d/0B3i8FWPuOpryQU9OQlMydXJmeTQ/edit I like the ones with Mars and Phobos on the side the most, but I feel like the top D is excessive and doesn't really communicate anything. Maybe something like

Re: Optimizing Java using D

2014-06-24 Thread Chris Cain via Digitalmars-d
On Tuesday, 24 June 2014 at 16:37:06 UTC, Chris Cain wrote: Of course, that's yet more playing around with restrictions. Plus your proposed relaxed stable sort is also the same as relaxed unstable sort so your restriction just made them identically fast. By relaxed here, I was thinking in

Re: Optimizing Java using D

2014-06-24 Thread Chris Cain via Digitalmars-d
On Monday, 23 June 2014 at 17:26:47 UTC, Andrei Alexandrescu wrote: Corollary: the default sorting algorithm in std will always be unstable, even if for certain data types and inputs it will produce stable sorting. -- Andrei I'd also like to note that this whole discussion about restrictions

Re: Converting from C const(dchar*) to dstring

2014-06-24 Thread Chris Cain via Digitalmars-d-learn
On Tuesday, 24 June 2014 at 17:59:41 UTC, Steven Schveighoffer wrote: // assuming 0 terminated dstring text = x[0..x.strlen].idup; strlen is only defined for char, not dchar: https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/string.d#L44

Re: Converting from C const(dchar*) to dstring

2014-06-24 Thread Chris Cain via Digitalmars-d-learn
On Tuesday, 24 June 2014 at 18:17:07 UTC, Danyal Zia wrote: On Tuesday, 24 June 2014 at 17:59:41 UTC, Steven Schveighoffer wrote: const(dchar *)x = ...; // assuming 0 terminated dstring text = x[0..x.strlen].idup; -Steve const(dchar)* x = Hello\0; dstring text = x[0..x.strlen].idup;

Re: Optimizing Java using D

2014-06-23 Thread Chris Cain via Digitalmars-d
On Monday, 23 June 2014 at 15:19:15 UTC, Steven Schveighoffer wrote: Is it just me, or does this seem unintuitive? I would think a stable sort requires extra care, i.e. extra time, to ensure stability. Do we need an unstable sort then? Or is this a corner case? I am fully ignorant on these

Re: Optimizing Java using D

2014-06-23 Thread Chris Cain via Digitalmars-d
On Monday, 23 June 2014 at 15:57:12 UTC, Andrea Fontana wrote: How can this be proven? Is it valid only for swap-based sorting algorithms? For example, radix sort is stable and its complexity is O(kn). Is there a faster unstable sort? It's not really about the time complexity but the

Re: hap.random: a new random number library for D

2014-06-22 Thread Chris Cain via Digitalmars-d-announce
On Thursday, 19 June 2014 at 21:27:17 UTC, Joseph Rushton Wakeling wrote: I realized that it ought to be possible to allow a more direct drop-in replacement for std.random by adding static opCalls to the classes which were previously structs. Thoughts on this, in favour, against ... ? I'd

Re: DIP64: Attribute Cleanup

2014-06-21 Thread Chris Cain via Digitalmars-d
On Saturday, 21 June 2014 at 18:11:32 UTC, Chris Cain wrote: On Saturday, 21 June 2014 at 18:07:25 UTC, Temtaime wrote: Too many attributes in D. In C++ there is no pure, safe, trusted and others. And it's C++ that shows that almost all of D attributes are not necessary. Welcome to

Re: DIP64: Attribute Cleanup

2014-06-21 Thread Chris Cain via Digitalmars-d
On Saturday, 21 June 2014 at 18:07:25 UTC, Temtaime wrote: Too many attributes in D. In C++ there is no pure, safe, trusted and others. And it's C++ that shows that almost all of D attributes are not necessary. Welcome to attribute hell ! Of course. But pure/safe/trusted/others statically

Re: DIP64: Attribute Cleanup

2014-06-21 Thread Chris Cain via Digitalmars-d
On Saturday, 21 June 2014 at 18:20:43 UTC, Temtaime wrote: And attributes - it's only restrictions and gives almost nothing. I'll reiterate that the restrictions in question make code easier to reason about. Increased reasoning is not almost nothing ... in fact, that's one of the main

Re: shorter alternative of constructor with parameter

2014-06-21 Thread Chris Cain via Digitalmars-d
On Saturday, 21 June 2014 at 21:47:00 UTC, SomeDude wrote: I've never seen a single instance of a bug like this in 15 years of Java and C++ programming. One has to be really sloppy in order to insert bugs in such simple code. Related:

Re: Is D production-ready?

2014-06-16 Thread Chris Cain via Digitalmars-d
On Monday, 16 June 2014 at 10:24:46 UTC, John Petal wrote: Does D have a mature SFML or SDL binding? http://code.dlang.org/packages/derelict-sfml2 and http://code.dlang.org/packages/derelict-sdl2 Are available. I have personally used the SDL2 bindings on both Windows and Mac and they work

Re: Is D production-ready?

2014-06-16 Thread Chris Cain via Digitalmars-d
On Monday, 16 June 2014 at 10:51:11 UTC, ponce wrote: Ahem, looks like I commited something too early. This is a bug. In the mean time you can use the ==1.1.1 version. Actually, sadly, you can't use gfm at all (or, at least, I can't) ... It complains about not being able to satisfy

Re: Strange issue on OSX

2014-06-13 Thread Chris Cain via Digitalmars-d
On Saturday, 14 June 2014 at 02:12:45 UTC, Jeremy DeHaan wrote: I agree. Also, this page (http://dlang.org/dmd-osx.html) says that the base requirement is a 32 bit OSX. Why is the DMD version that is released 64 bit? That seems very counter intuitive. Honestly, I feel like it should be noted

Re: hap.random: a new random number library for D

2014-06-12 Thread Chris Cain via Digitalmars-d-announce
On Wednesday, 11 June 2014 at 16:35:31 UTC, Kagamin wrote: In some scenarios impredictability is not enough. For example, when you generate a session id, an attacker doesn't have to predict it ahead of time, he can guess it at any time later. And if they listen to radio waves - that's an open

Re: hap.random: a new random number library for D

2014-06-12 Thread Chris Cain via Digitalmars-d-announce
On Wednesday, 11 June 2014 at 06:41:34 UTC, Joseph Rushton Wakeling wrote: Done :) ... if I get a response, I'll make sure to incorporate everything said. Great, let me know how that goes. :-) Well, the ultimate conclusion of the conversation with the guy is that: 1. ISAAC probably isn't

Re: hap.random: a new random number library for D

2014-06-12 Thread Chris Cain via Digitalmars-d-announce
On Thursday, 12 June 2014 at 17:35:39 UTC, Nick Sabalausky wrote: Naturally, it doesn't yet exist in hap.random because, as Joseph said, hap.random's step one is to match the current std.random as closely as possible. I'd be happy to put together a PR to adapt my RNG stuff above to hap.random

Re: hap.random: a new random number library for D

2014-06-11 Thread Chris Cain via Digitalmars-d-announce
On Wednesday, 11 June 2014 at 06:41:34 UTC, Joseph Rushton Wakeling wrote: That would be very cool. Can you point me at your code examples? It's written in Nimrod (in a way that someone who learned Nimrod the day before would write them, because I learned Nimrod the day before and worked on

Re: hap.random: a new random number library for D

2014-06-10 Thread Chris Cain via Digitalmars-d-announce
Awesome! I'll definitely check this out :) Would there be any chance of additional contributions, such as an ISAAC RNG implementation, being accepted? I wouldn't go as far as to guarantee it for crypto purposes, but I've been messing around with an implementation recently and wouldn't mind

Re: hap.random: a new random number library for D

2014-06-10 Thread Chris Cain via Digitalmars-d-announce
Hey again Joe, I had an opportunity to give the entire code a good once over read and I have a few comments. 1. Biggest thing about the new hap.random is how much nicer it is to actually READ. The first few times I went through the current std.random, I remember basically running out of

Re: D aliases vs. C typedefs

2014-06-10 Thread Chris Cain via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 22:00:34 UTC, Ali Çehreli wrote: http://stackoverflow.com/questions/10758811/c-syntax-for-functions-returning-function-pointers int (*(*(*f3)(int))(double))(float); f3 is a ... Ali f3 is a pointer to a function taking an int returning a pointer to a function

Re: Does D have a variant data type?

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 7 June 2014 at 19:10:19 UTC, katuday wrote: I am looking for something like boost::variant in C++ Like this? http://dlang.org/phobos/std_variant.html

Re: How to sort a 2D array by column

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
This is my attemot to create a compare object. But I don't know how to use it together with .sort member function Don't use the .sort property. Use std.algorithm.sort, which has a less predicate (that should return a bool). http://dlang.org/phobos/std_algorithm.html#sort

Re: How to sort a 2D array by column

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 7 June 2014 at 19:14:01 UTC, Chris Cain wrote: This is my attemot to create a compare object. But I don't know how to use it together with .sort member function Don't use the .sort property. Use std.algorithm.sort, which has a less predicate (that should return a bool).

Re: Running a delegate inside a C function

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 7 June 2014 at 20:04:41 UTC, Denis Martinez via Digitalmars-d-learn wrote:     int ret = jack_set_process_callback(handle_, f, dg); dg here is giving you a pointer to the dg variable sitting on the stack. The stack is almost certainly getting overwritten at some point.

Re: Permutation Sort Algorithm Very Slow

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 7 June 2014 at 21:40:08 UTC, Agora wrote: Why is running slow? One of the main reasons is because the number of permutations an array has is n!. Thus the expected runtime is O(n!). That's a slow, slow algorithm in general. In particular, your array with length 11 has 39,916,800

Re: Permutation Sort Algorithm Very Slow

2014-06-07 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 7 June 2014 at 22:01:25 UTC, Ali GOREN wrote: Thank you. I can not resolve it in quicker time, right? You might be able to come up with a faster way to permute, but it's mostly pointless because it will always be very slow. Use std.algorithm.sort if you want to sort quickly, as

Re: (git HEAD) std.datetime spewing deprecation messages

2014-06-05 Thread Chris Cain via Digitalmars-d
On Wednesday, 4 June 2014 at 15:51:58 UTC, John Colvin wrote: On Wednesday, 4 June 2014 at 14:16:31 UTC, Meta wrote: On Wednesday, 4 June 2014 at 11:28:52 UTC, Kagamin wrote: Does one really needs only one component, but not the others? Maybe it should provide full computed broken form instead

Re: [OT] Apple introduces Swift as Objective-C sucessor

2014-06-03 Thread Chris Cain via Digitalmars-d
On Tuesday, 3 June 2014 at 08:33:14 UTC, ponce wrote: On Tuesday, 3 June 2014 at 00:57:53 UTC, Chris Cain wrote: On Monday, 2 June 2014 at 23:01:56 UTC, deadalnix wrote: On Monday, 2 June 2014 at 22:53:10 UTC, ponce wrote: - no exceptions (!) How do they do error handling ? I haven't read

Re: [OT] Apple introduces Swift as Objective-C sucessor

2014-06-03 Thread Chris Cain via Digitalmars-d
On Tuesday, 3 June 2014 at 13:18:38 UTC, Byron Heads wrote: Use .. to make a range that omits its upper value, and use ... to make a range that includes both values. That is going to be a source of a lot of bugs, so easy to type 3 when you ment 2 Agreed. But I think if the language made it

Re: [OT] Apple introduces Swift as Objective-C sucessor

2014-06-02 Thread Chris Cain via Digitalmars-d
On Monday, 2 June 2014 at 23:01:56 UTC, deadalnix wrote: On Monday, 2 June 2014 at 22:53:10 UTC, ponce wrote: - no exceptions (!) How do they do error handling ? I haven't read too much into Swift but languages with ADTs, pattern matching, and no exceptions can (and usually do) return

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-06-02 Thread Chris Cain via Digitalmars-d-learn
On Sunday, 1 June 2014 at 14:22:31 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: I missed the debate at the time, but actually, I'm slightly more concerned over the remark in that discussion that the new uniform was ported from java.util.Random. Isn't OpenJDK GPL-licensed ... ?

Re: Different random shuffles generated when compiled with gdc than with dmd

2014-06-02 Thread Chris Cain via Digitalmars-d-learn
On Monday, 2 June 2014 at 18:46:18 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: I'm really sorry, Chris, I was obviously mixing things up: on rereading, the person in the earlier forum discussion (not PR thread) who talks about porting from Java wasn't you. I'm very glad to be

Re: Fighting compiler - experienced programmer but D novice

2014-06-02 Thread Chris Cain via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 03:17:10 UTC, Charles Parker wrote: ... Thanx for any help - Charlie Well one thing is that you don't need the type parameters on the this function. You're basically creating a templated this inside the templated class which is not what you want. try this:

Re: Modify char in string

2014-05-18 Thread Chris Cain via Digitalmars-d-learn
On Sunday, 18 May 2014 at 18:55:59 UTC, Tim wrote: Hi everyone, is there any chance to modify a char in a string like: As you've seen, you cannot modify immutables (string is an immutable(char)[]). If you actually do want the string to be modifiable, you should define it as char[] instead.