Re: Array!T and find are slow

2014-05-17 Thread w0rp via Digitalmars-d-learn
On Saturday, 17 May 2014 at 20:06:03 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: But I think that the correct solution is to improve the compiler with regards to lazy. The fact that lazy is so slow is a serious problem, and enforce is just one manifestation of it (albeit the worst becau

Re: opEquals nothrow

2017-07-20 Thread w0rp via Digitalmars-d-learn
On Thursday, 20 July 2017 at 15:10:24 UTC, Aldo wrote: On Thursday, 20 July 2017 at 14:59:50 UTC, Steven Schveighoffer wrote: On 7/20/17 10:38 AM, Aldo wrote: Hello, im tring to add nothrow keyword in my code, but compilation fails : function 'object.opEquals' is not nothrow its a simple

Creating ranges over mutable, const, or immutable data structures.

2014-05-24 Thread w0rp via Digitalmars-d-learn
I have been writing my own hashmap which can provide forward ranges usable in @safe pure nothrow functions, because it's going to be useful for creating graph data structures with the same. I came to writing my ranges and I figured out how to do everything right for just mutable hashmaps, but I

Re: Creating ranges over mutable, const, or immutable data structures.

2014-05-24 Thread w0rp via Digitalmars-d-learn
On Saturday, 24 May 2014 at 18:01:43 UTC, Ali Çehreli wrote: On 05/24/2014 10:02 AM, w0rp wrote: > I have been writing my own hashmap which can provide forward ranges > usable in @safe pure nothrow functions, because it's going to be useful > for creating graph data structures with the same. I c

Re: '!' and naming conventions

2014-06-18 Thread w0rp via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 20:55:36 UTC, cym13 wrote: Hello, I see a lot of functions and other stuff with a '!' in the name such as 'bitfields!' or 'ctRegex!'. What does it mean exactly? In scheme, we use such a convention to warn that a function is not pure, but I don't see the point of u

Re: dmd & dub from git master

2014-07-06 Thread w0rp via Digitalmars-d-learn
I hit this myself also. I was trying to use the master branch DMD, druntime, and phobos with a recent vibe.d for building the documentation with ddox, and I ran into the reliance on std.metastrings.

Re: @trusted and return ref

2015-02-24 Thread w0rp via Digitalmars-d-learn
On Tuesday, 24 February 2015 at 22:37:58 UTC, Ola Fosheim Grøstad wrote: If this is careful use of @trusted, then I don't see the point of having @trusted at all. What is the purpose? What is it meant to cover? In order for @trusted to make sense in this code segment ( http://dpaste.dzfl.pl/f3d

Re: @trusted and return ref

2015-03-03 Thread w0rp via Digitalmars-d-learn
On Wednesday, 25 February 2015 at 06:48:17 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 24 February 2015 at 22:49:17 UTC, w0rp wrote: In general, @trusted means "I have proven myself that this code is actually safe, eeven though it uses unsafe features." The compiler has to be pessimistic and as

Re: Object as function argument

2015-03-05 Thread w0rp via Digitalmars-d-learn
On Thursday, 5 March 2015 at 19:35:35 UTC, Chris Sperandio wrote: Hi, I'm a developer coming from C and I've a question about class instance as method or function parameter. In the book "The D Programming Language", I read the instance was passed by reference to functions (in the opposite of

Re: Mutual optimization of tail recursion does not work in D

2015-03-31 Thread w0rp via Digitalmars-d-learn
Mutual tail call optimisation doesn't work in C++ either. Because it's not a language feature in C++ or D. It is not required by the standards of either language. It's an optimisation which compilers apply. I am guessing you are using DMD, which might not offer the best optimisations for runti

Re: Binary search in structs

2015-04-05 Thread w0rp via Digitalmars-d-learn
On Sunday, 5 April 2015 at 23:06:27 UTC, FreeSlave wrote: I have array of structs sorted by specific field. How can I perform binary search using this field as a key? Currently I ended up with this, but it gives error: struct S { int i; string s; } import std.range; void main(string

Re: Static if to compare two types are the exact same

2015-04-07 Thread w0rp via Digitalmars-d-learn
On Tuesday, 7 April 2015 at 06:37:50 UTC, Jonathan wrote: static if (is(T == V)) Are static ifs always checked outside of runtime? Is it possible for a static if condition to be undeterminable outside of runtime, or would such a condition throw a compiler error? 'static if' is always run at

Re: Possible to write a classic fizzbuzz example using a UFCS chain?

2015-04-28 Thread w0rp via Digitalmars-d-learn
On Tuesday, 28 April 2015 at 10:46:54 UTC, Gary Willoughby wrote: After reading the following thread: http://forum.dlang.org/thread/nczgumcdfystcjqyb...@forum.dlang.org I wondered if it was possible to write a classic fizzbuzz[1] example using a UFCS chain? I've tried and failed. [1]: http:/