Re: Struct immutable data and dict

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 03:05:18 UTC, Patric Dexheimer wrote: But why i´m overwriting the struct if its the first time i´m putting it there? (like on the array). There's a difference between initialization and assignment. ``` // Given this structure struct MyStruct { int x; } //

Re: Struct immutable data and dict

2016-10-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 October 2016 at 03:05:18 UTC, Patric Dexheimer wrote: But why i´m overwriting the struct if its the first time i´m putting it there? (like on the array). The compiler doesn't know it is the first time (it doesn't follow the data from creation, it just looks at that individual

Re: Struct immutable data and dict

2016-10-05 Thread Patric Dexheimer via Digitalmars-d-learn
On Thursday, 6 October 2016 at 02:09:44 UTC, Adam D. Ruppe wrote: On Thursday, 6 October 2016 at 01:23:35 UTC, Patric Dexheimer wrote: Why? Because you'd be overwriting that immutable member. Structs just put structure around their contents, but it doesn't change their nature. That struct

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Laeeth Isharc via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote: On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A

Re: Stupid User error with DUB/Derelict runtime issue?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 00:13:20 UTC, WhatMeWorry wrote: Dub/Derelict is returning the following error at the D line: DerelictFT.load(); // Load the FreeType library

Re: Struct immutable data and dict

2016-10-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 October 2016 at 01:23:35 UTC, Patric Dexheimer wrote: Why? Because you'd be overwriting that immutable member. Structs just put structure around their contents, but it doesn't change their nature. That struct is no different than if you wrote `immutable size_t` as the value -

Struct immutable data and dict

2016-10-05 Thread Patric Dexheimer via Digitalmars-d-learn
struct Test{ immutable size_t id; } Test[string] dict; Test[] array; void main(){ array~=Test(1);//work dict["teste"] = Test(1); //fail ?? } "Error: cannot modify struct dict["teste"] Test with immutable members" Why?

Stupid User error with DUB/Derelict runtime issue?

2016-10-05 Thread WhatMeWorry via Digitalmars-d-learn
Dub/Derelict is returning the following error at the D line: DerelictFT.load(); // Load the FreeType library derelict.util.exception.SharedLibLoadException@C:\Users\kheaser\AppData\Roaming\dub\packages\derelict-util-2.0.6\source\derelict\util\exception.d(35): Failed to load one or

Re: Shared an non-shared

2016-10-05 Thread Begah via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:48:07 UTC, Jonathan M Davis wrote: On Wednesday, October 05, 2016 11:25:57 Begah via Digitalmars-d-learn wrote: [...] Unless you're writing lock-free algorithms (which really should only be done by experts, and even then, they should probably reconsider

Re: Why can't static arrays be sorted?

2016-10-05 Thread Ali Çehreli via Digitalmars-d-learn
On 10/05/2016 12:30 PM, Jonathan M Davis via Digitalmars-d-learn wrote: > On Wednesday, October 05, 2016 19:22:03 pineapple via Digitalmars-d-learn > wrote: >> Would just like to point out that this is design weirdness on >> Phobos' part - the library I've been writing does not have this >>

Re: Why can't static arrays be sorted?

2016-10-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 05, 2016 19:22:03 pineapple via Digitalmars-d-learn wrote: > On Wednesday, 5 October 2016 at 18:19:27 UTC, TheGag96 wrote: > > On Wednesday, 5 October 2016 at 02:19:13 UTC, Jonathan M Davis > > > > wrote: > >> The problem is that static arrays aren't ranges (calling > >>

Re: Why can't static arrays be sorted?

2016-10-05 Thread pineapple via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 18:19:27 UTC, TheGag96 wrote: On Wednesday, 5 October 2016 at 02:19:13 UTC, Jonathan M Davis wrote: The problem is that static arrays aren't ranges (calling popFront on them can't work, because their length isn't mutable). However, you can slice a static array

Re: Why can't static arrays be sorted?

2016-10-05 Thread TheGag96 via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 02:19:13 UTC, Jonathan M Davis wrote: The problem is that static arrays aren't ranges (calling popFront on them can't work, because their length isn't mutable). However, you can slice a static array to get a dynamic array which _is_ a range. e.g.

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote: On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A

Re: Using OpenGL

2016-10-05 Thread Darren via Digitalmars-d-learn
On Tuesday, 4 October 2016 at 16:09:34 UTC, Darren wrote: Back again with another little problem that isn't specifically OpenGL related, but is a result of getting such code to work. I actually figured it out; my own mistakes.

Re: artistic and boost licenses compatibility

2016-10-05 Thread Kagamin via Digitalmars-d-learn
Depends on the license text.

Re: Shared an non-shared

2016-10-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 05, 2016 11:25:57 Begah via Digitalmars-d-learn wrote: > On Wednesday, 5 October 2016 at 07:36:58 UTC, Jonathan M Davis > > wrote: > > On Tuesday, October 04, 2016 19:22:10 Begah via > > > > Digitalmars-d-learn wrote: > >> How can I make a method that accepts being called by

Re: What exactly does the compiler switch -betterC do?

2016-10-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-05 11:39, Martin Nowak wrote: Because you're linking with druntime/phobos which drags in plenty of symbols (including a GC). Also Jakob is showing the symbols of the object file, not executable. No. There's a difference between DMD 2.070.0 and 2.071.0: $ cat main.d module main;

Re: Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:46:14 UTC, Adam D. Ruppe wrote: On Wednesday, 5 October 2016 at 11:43:12 UTC, John C wrote: Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf? If it is a legal array (matching types), just put []

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A selectively. That led to link problems with module constructors.

Re: Convert type tuple to array?

2016-10-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:43:12 UTC, John C wrote: Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf? If it is a legal array (matching types), just put [] around it. int[] arr = [ AliasSeq!(1,2,3) ]; An AliasSeq is

obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Laeeth Isharc via Digitalmars-d-learn
I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A selectively. That led to link problems with module constructors. Here I noticed it in a different context. Simple two-page main code

Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf?

Re: Shared an non-shared

2016-10-05 Thread Begah via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 07:36:58 UTC, Jonathan M Davis wrote: On Tuesday, October 04, 2016 19:22:10 Begah via Digitalmars-d-learn wrote: How can I make a method that accepts being called by both a shared and non-shared object, to prevent having to copy methods and adding a "shared"?

Re: What exactly does the compiler switch -betterC do?

2016-10-05 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 19 September 2016 at 21:09:39 UTC, Gary Willoughby wrote: On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: On 2016-06-19 21:53, Gary Willoughby wrote: If compiled with -betterC, it contains these: T _main U _printf I get

Re: How dub select versions?

2016-10-05 Thread Daniel Kozak via Digitalmars-d-learn
That makes sense :). Thanks Dne 5.10.2016 v 10:27 Mike Parker via Digitalmars-d-learn napsal(a): On Wednesday, 5 October 2016 at 08:23:25 UTC, Mike Parker wrote: The ~> constrains the dependency to the minor version number, meaning DUB will not try to use a version of the dependency that

Re: How dub select versions?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 08:23:25 UTC, Mike Parker wrote: The ~> constrains the dependency to the minor version number, meaning DUB will not try to use a version of the dependency that has a higher minor version. Oh, that came out wrong. TO be clear for anyone who doesn't read the

Re: How dub select versions?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 08:01:33 UTC, Daniel Kozak wrote: I really does not understand how does DUB works. I have small app which use vibe-d:core as dependency, and I use libasync as subConfiguration. When I try to build my app it always try to download libasync-0.7.9 instead of

How dub select versions?

2016-10-05 Thread Daniel Kozak via Digitalmars-d-learn
I really does not understand how does DUB works. I have small app which use vibe-d:core as dependency, and I use libasync as subConfiguration. When I try to build my app it always try to download libasync-0.7.9 instead of libasync-0.8.0. Why? I would expect to select the latest one frum dub

Re: Shared an non-shared

2016-10-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 04, 2016 19:22:10 Begah via Digitalmars-d-learn wrote: > How can I make a method that accepts being called by both a > shared and non-shared object, to prevent having to copy methods > and adding a "shared"? You could templatize them, but really, the idea is that you _don't_