Re: is struct delete deterministic? (cf used in Unique)

2015-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 08, 2015 14:04:52 Timothee Cour via Digitalmars-d-learn wrote: > On Sun, Mar 8, 2015 at 4:36 AM, Jonathan M Davis via Digitalmars-d-learn < > > I would point out though that until recently, the GC never ran the > > destructors for structs on the heap, because it didn't have the typ

Re: Dub + Optlink == ???

2015-03-08 Thread David Held via Digitalmars-d-learn
On 3/8/2015 3:55 PM, David Held wrote: Since DDT (Eclipse plugin) uses Dub, I am trying to convert the DWT build instructions into Dub. Here is my current attempt: { "name" : "foo", "description" : "foo", "importPaths" : [ "d:/workspace/dwt/imp" ], "stringImportPaths" : [ "D

Dub + Optlink == ???

2015-03-08 Thread David Held via Digitalmars-d-learn
Since DDT (Eclipse plugin) uses Dub, I am trying to convert the DWT build instructions into Dub. Here is my current attempt: { "name" : "foo", "description" : "foo", "importPaths" : [ "d:/workspace/dwt/imp" ], "stringImportPaths" : [ "D:/workspace/dwt/org.eclipse.swt.win32.win3

Re: Strange behavior of the function find() and remove()

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:58:20 UTC, safety0ff wrote: On Sunday, 8 March 2015 at 21:34:25 UTC, Dennis Ritchie wrote: This is normal behavior? Yes it is normal, there are two potential points of confusion: - remove mutates the input range and returns a shortened slice to the range which e

Re: Strange behavior of the function find() and remove()

2015-03-08 Thread anonym...@example.com via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:34:25 UTC, Dennis Ritchie wrote: This is normal behavior? import std.stdio; import std.algorithm; void main() { auto a = [3, 5, 8]; writeln(find(remove(a, 1), 5).length != 0); // prints false writeln(a); // prints [3, 8, 8]

Re: Strange behavior of the function find() and remove()

2015-03-08 Thread safety0ff via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:34:25 UTC, Dennis Ritchie wrote: This is normal behavior? Yes it is normal, there are two potential points of confusion: - remove mutates the input range and returns a shortened slice to the range which excludes the removed element. - remove takes an index as it

Re: string-int[] array

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:41:44 UTC, FG wrote: On 2015-03-08 at 20:26, Meta wrote: On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. What in the world is that code doing? I'm having a hard time wrapping my head around this. It's a tri

Re: string-int[] array

2015-03-08 Thread FG via Digitalmars-d-learn
On 2015-03-08 at 20:26, Meta wrote: On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. What in the world is that code doing? I'm having a hard time wrapping my head around this. It's a trick to reuse string internals to store an int. A stri

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:17:31 UTC, Meta wrote: Urgh, I'm all messed up now. The results in the second case are correct, but the results in the first case are wrong, as !canBeAlias!true should be !false, not !true. I also get the same results with __traits(compiles, { alias _ = T[0]; }).

Strange behavior of the function find() and remove()

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
This is normal behavior? import std.stdio; import std.algorithm; void main() { auto a = [3, 5, 8]; writeln(find(remove(a, 1), 5).length != 0); // prints false writeln(a); // prints [3, 8, 8] ??? }

Re: string-int[] array

2015-03-08 Thread Paul via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:18:31 UTC, Max Klyga wrote: On 2015-03-08 21:11:42 +, Paul said: On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five

Re: string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:18:31 UTC, Max Klyga wrote: OP is fighting a loosing battle in flame war on some obscure forum. F# enthusiast trolls OP into solving stupid puzzles that are trivial in F# (or any ML-family language) and clumsy in C-family languages. In language holy wars the only

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 21:11:12 UTC, Meta wrote: Yeah, definitely wrong. template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false

Re: string-int[] array

2015-03-08 Thread Max Klyga via Digitalmars-d-learn
On 2015-03-08 21:11:42 +, Paul said: On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five"]; As there's no mention of performance, what's wrong wi

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 20:36:34 UTC, anonymous wrote: I get an error on your code: "test.d(16): Error: static assert (canBeAlias!(true)) is false". But when commenting out the first assert (line 15), there's no error. Hmm, I might have made a mistake reducing my actual code. Played arou

Re: string-int[] array

2015-03-08 Thread Paul via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five"]; As there's no mention of performance, what's wrong with a plain old string array with a bit of

Re: is struct delete deterministic? (cf used in Unique)

2015-03-08 Thread Timothee Cour via Digitalmars-d-learn
On Sun, Mar 8, 2015 at 4:36 AM, Jonathan M Davis via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Sunday, March 08, 2015 04:13:28 Jonathan M Davis via > Digitalmars-d-learn wrote: > > On Saturday, March 07, 2015 17:20:49 Timothee Cour via > Digitalmars-d-learn wrote: > > >

Re: Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread anonym...@example.com via Digitalmars-d-learn
On Sunday, 8 March 2015 at 15:41:23 UTC, Meta wrote: template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false; } } pragma(msg

Re: Documentation confusion

2015-03-08 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Mar 08, 2015 at 09:29:28PM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > Hi, I just want to be sure that I'm not missing something, as I'm a > bit confused: > > 1. The docs at http://dlang.org/phobos/ are not complete, right? Even > not complete in that all runtime / phobos modu

Documentation confusion

2015-03-08 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I just want to be sure that I'm not missing something, as I'm a bit confused: 1. The docs at http://dlang.org/phobos/ are not complete, right? Even not complete in that all runtime / phobos modules are listed with a comment "no docs yet". I'm missing stuff like: import std.c.wind

Re: string-int[] array

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote: http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this. What in the world is that code doing? I'm having a hard time wrapping my head around this.

Re: string-int[] array

2015-03-08 Thread Baz via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:54:43 UTC, Meta wrote: On Sunday, 8 March 2015 at 18:38:02 UTC, Dennis Ritchie wrote: On Sunday, 8 March 2015 at 18:18:15 UTC, Baz wrote: import std.stdio; import std.typecons; alias T = Tuple!(string, int); void main(string[] args) { T[] tarr; tarr ~= T("a",

Re: string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:54:43 UTC, Meta wrote: On Sunday, 8 March 2015 at 18:38:02 UTC, Dennis Ritchie wrote: On Sunday, 8 March 2015 at 18:18:15 UTC, Baz wrote: import std.stdio; import std.typecons; alias T = Tuple!(string, int); void main(string[] args) { T[] tarr; tarr ~= T("a",

Re: string-int[] array

2015-03-08 Thread Kagamin via Digitalmars-d-learn
http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this.

Re: string-int[] array

2015-03-08 Thread Meta via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:38:02 UTC, Dennis Ritchie wrote: On Sunday, 8 March 2015 at 18:18:15 UTC, Baz wrote: import std.stdio; import std.typecons; alias T = Tuple!(string, int); void main(string[] args) { T[] tarr; tarr ~= T("a",65); tarr ~= T("b",66); writeln(tarr); }

Re: string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:38:02 UTC, Dennis Ritchie wrote: Thanks, will do. No, will not work. On Sunday, 8 March 2015 at 18:25:33 UTC, Baz wrote: mmmh maybe off-topic, you probably don't what pairs but either a string representing an int or an int, do you ? If so then an array of uni

Re: string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:18:15 UTC, Baz wrote: import std.stdio; import std.typecons; alias T = Tuple!(string, int); void main(string[] args) { T[] tarr; tarr ~= T("a",65); tarr ~= T("b",66); writeln(tarr); } [Tuple!(string, int)("a", 65), Tuple!(string, int)("b", 66

Re: string-int[] array

2015-03-08 Thread Baz via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:18:15 UTC, Baz wrote: On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five"]; using an array of tuple it works: imp

Seems core.thread.Fiber is broken dmd windows 64-bit build

2015-03-08 Thread Carl Sturtivant via Digitalmars-d-learn
The following crashes on Windows 7 sp1 64-bit edition when build at 64 bits with dmd and the Microsoft linker that comes with Windows SDK 7.1 (i.e. MSVC 2010 linker). I've had no trouble with other D code when using that arrangement, though I have not used threads. When built at 32 bits with

Re: string-int[] array

2015-03-08 Thread Baz via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:05:33 UTC, Dennis Ritchie wrote: Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five"]; using an array of tuple it works: import std.stdio; import std.typecons; alias T = Tuple!

string-int[] array

2015-03-08 Thread Dennis Ritchie via Digitalmars-d-learn
Is it possible to create such an array in which you can store strings and numbers at the same time? string-int[] array = [4, "five"];

Re: Derelict Assimp not loading mesh properly? (Maybe index buffer)

2015-03-08 Thread Rene Zwanenburg via Digitalmars-d-learn
On Saturday, 7 March 2015 at 22:01:26 UTC, Bennet wrote: Update: I've gotten the vertices, normals an uvs to load into arrays properly, now I just can't get the indices loaded. I'm loading them in the manner you suggested but they only load up to index 22 when there are 33 vertices. I imagine t

Template pred is true for pred!(pred!(pred)) but not for value "true"

2015-03-08 Thread Meta via Digitalmars-d-learn
template canBeAlias(T...) if (T.length == 1) { static if (is(typeof({alias _ = T[0];}))) { enum canBeAlias = true; } else { enum canBeAlias = false; } } pragma(msg, canBeAlias!canBeAlias); //prints "true" static asser

Re: how to read some in vibe.d tcpconnection?

2015-03-08 Thread Kagamin via Digitalmars-d-learn
On Sunday, 8 March 2015 at 03:09:00 UTC, zhmt wrote: Yes, this a good idea, if the author of vibe.d do this, will be better, it is used frequently in many scenes. You can do it too, unlike in C++, in D you can write extension methods to any type, as long as they are visible, you can call them

Re: is struct delete deterministic? (cf used in Unique)

2015-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 08, 2015 04:13:28 Jonathan M Davis via Digitalmars-d-learn wrote: > On Saturday, March 07, 2015 17:20:49 Timothee Cour via Digitalmars-d-learn > wrote: > > To clarify, I'm only asking about a struct allocated via new. > > Unique!T is wrapped around a struct, but it allocates a st

Re: is struct delete deterministic? (cf used in Unique)

2015-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 07, 2015 17:20:49 Timothee Cour via Digitalmars-d-learn wrote: > To clarify, I'm only asking about a struct allocated via new. > Unique!T is wrapped around a struct, but it allocates a struct T via 'new', > so my question still holds: does 'delete t' (where t is a struct allocat

Re: is struct delete deterministic? (cf used in Unique)

2015-03-08 Thread weaselcat via Digitalmars-d-learn
On Sunday, 8 March 2015 at 01:20:57 UTC, Timothee Cour wrote: To clarify, I'm only asking about a struct allocated via new. Unique!T is wrapped around a struct, but it allocates a struct T via 'new', so my question still holds: does 'delete t' (where t is a struct allocated via new) guarantee