Your connection is not private
I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12).
Re: Accessing members of an array of a class with map.
On Friday, 30 September 2016 at 19:31:55 UTC, Jonathan M Davis wrote: On Friday, September 30, 2016 19:04:11 Ave via Digitalmars-d-learn wrote: [...] The first example is segfaulting, because you never gave the variable, test, a value. It's null when you try and access its arrB member. - Jonathan M Davis Hah wow. Can't believe I even retyped that whole thing and didn't see it. Thanks.
Re: Accessing members of an array of a class with map.
On Friday, September 30, 2016 19:04:11 Ave via Digitalmars-d-learn wrote: > An example of what I'm trying to do: > > import std.stdio; > import std.container; > import std.algorithm; > class Aa > { > Array!B arrB; > } > > class Bb > { > string name; > > } > void main() > { > Aa test; > auto c=new Bb; > c.name="asdf"; > test.arrB.insert(c); > auto d=new Bb; > d.name="1234"; > test.arrB.insert(d); > writeln(test.arrB[].map!(x=>x.name); > } > I was able to get this to compile,but it segfaults. > If I do this however: > > import std.stdio; > import std.container; > import std.algorithm; > class Bb > { > string name; > } > void main() > { > Array!B arrB; > auto c=new Bb; > c.name="asdf"; > arrB.insert(c); > auto d=new Bb; > d.name="1234"; > arrB.insert(d); > writeln(arrB[].map!(x=>x.name); > } > It will compile and work without seg faulting. What am I doing > wrong in my first case that's causing the program to seg fault? The first example is segfaulting, because you never gave the variable, test, a value. It's null when you try and access its arrB member. - Jonathan M Davis
Accessing members of an array of a class with map.
An example of what I'm trying to do: import std.stdio; import std.container; import std.algorithm; class Aa { Array!B arrB; } class Bb { string name; } void main() { Aa test; auto c=new Bb; c.name="asdf"; test.arrB.insert(c); auto d=new Bb; d.name="1234"; test.arrB.insert(d); writeln(test.arrB[].map!(x=>x.name); } I was able to get this to compile,but it segfaults. If I do this however: import std.stdio; import std.container; import std.algorithm; class Bb { string name; } void main() { Array!B arrB; auto c=new Bb; c.name="asdf"; arrB.insert(c); auto d=new Bb; d.name="1234"; arrB.insert(d); writeln(arrB[].map!(x=>x.name); } It will compile and work without seg faulting. What am I doing wrong in my first case that's causing the program to seg fault?
Re: Reinstalled Mac
On Friday, 30 September 2016 at 07:36:58 UTC, Jacob Carlborg wrote: Yeah, that would be nice. Would it be interesting to have "dmd" point to "ldmd2" when LDC is selected as the current compiler? Or is that just confusing. Confusing. For me it's much more common to want a current DMD compiler and a current LDC compiler.
Re: Configuring of dub for the application reading enviroment variable
On Friday, 30 September 2016 at 10:31:52 UTC, MGW wrote: My STARTING application shall read the enviroment variable. For example MY_VARIABLE= "I'm Gena". The MY_VARIABLE variable needs to be set in dub.json so what she would be visible in case of start of my application. Purpose: to set LD_LIBRARY_PATH having specified a certain directory in dub packet. Please, write an example of dub.json for it. Can you use preBuildCommands, e.g.: "preBuildCommands" : ["export LD_LIBRARY_PATH=dir"]
Re: Configuring of dub for the application reading enviroment variable
On Friday, 30 September 2016 at 11:09:37 UTC, rikki cattermole wrote: There is no way to do this. it is necessary to add section to dub: "enviroment": [ { "LD_LIBRARY_PATH", "$PACKAGE_DIR" }, { "MY_VARIABLE", "$PACKAGE_DIR/IMAGES"} ]
Re: Configuring of dub for the application reading enviroment variable
On 30/09/2016 11:31 PM, MGW wrote: My STARTING application shall read the enviroment variable. For example MY_VARIABLE= "I'm Gena". The MY_VARIABLE variable needs to be set in dub.json so what she would be visible in case of start of my application. Purpose: to set LD_LIBRARY_PATH having specified a certain directory in dub packet. Please, write an example of dub.json for it. There is no way to do this.
Configuring of dub for the application reading enviroment variable
My STARTING application shall read the enviroment variable. For example MY_VARIABLE= "I'm Gena". The MY_VARIABLE variable needs to be set in dub.json so what she would be visible in case of start of my application. Purpose: to set LD_LIBRARY_PATH having specified a certain directory in dub packet. Please, write an example of dub.json for it.
Re: Reinstalled Mac
On 2016-09-29 14:59, Guillaume Piolat wrote: More or less related: it would be nice if DVM supports LDC fetching and switching. The use case I see is that you often want one DMD and one LDC. Yeah, that would be nice. Would it be interesting to have "dmd" point to "ldmd2" when LDC is selected as the current compiler? Or is that just confusing. -- /Jacob Carlborg
Re: Reinstalled Mac
On 2016-09-29 18:28, Paolo Invernizzi wrote: Ummm... All the installed stuff is pretty well organised inside `/usr/local`, so this works... --- hw0062:~ pinver$ /usr/local/Cellar/dmd/2.071.2/bin/dmd --version DMD64 D Compiler v2.071.2 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright hw0062:~ pinver$ /usr/local/Cellar/dmd/2.071./bin/dmd --version 2.071.0_1/ 2.071.1/ 2.071.2/ hw0062:~ pinver$ /usr/local/Cellar/dmd/2.071.0_1/bin/dmd --version DMD64 D Compiler v2.071.0 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright --- The advantage of DVM is that you don't have to modify any build scripts, makefiles or similar. Invoking just "dmd" in a build script will invoke whatever version the user has set for the current session. -- /Jacob Carlborg