-
-
Notifications
You must be signed in to change notification settings - Fork 271
Closed
Description
they are a problem around private var, below code:
private import std.array : split;
private import std.stdio : writeln;
private import std.string : format, stripLeft, stripRight;
class Container{
private:
string[string] dict;
string name;
this( string name ){
this.name = name;
this.dict = dict;
}
}
void main( string[] args ){
string[]words = split(cast(string)"key=value", "=");
foreach( ref string word; words )
word.stripRight().stripLeft();
Container c = new Container("test");
c.dict[words[0]] = words[1];
writeln( "strange access to private var!!!" );
writeln( c.dict );
writeln( c.dict["key"] );
writeln( c.dict.keys );
}poduce this output:
$ ldc2 test.d
$ ./test
strange access to private var!!!
["key":"value"]
value
["key"]Metadata
Metadata
Assignees
Labels
No labels