www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Bug with associative array properties - new in v2.064.2

reply "Gary Willoughby" <dev nomad.so> writes:
	import std.stdio;

	void main(string[] args)
	{
		int[string] a;

		auto b = a.sizeof;
		auto c = a.length;
		auto d = a.dup;
		auto e = a.keys;
		auto f = a.values;
		a.rehash;
	}

Compile with: rdmd -property test.d

Output:

test.d(7): Error: not a property a.dup
test.d(8): Error: not a property a.rehash
Failed: 'dmd' '-property' '-v' '-o-' 'test.d' '-I.'

Is this intended behaviour now? dup and rehash not being marked 
as a property? or is this a regression?

Dynamic arrays compile fine with: rdmd -property test.d

	import std.stdio;

	void main(string[] args)
	{
		int[] a;

		auto b = a.sizeof;
		auto c = a.length;
		auto d = a.ptr;
		auto e = a.dup;
		auto f = a.idup;
		auto g = a.reverse;
		auto h = a.sort;
	}
Nov 13 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Gary Willoughby:

 		int[string] a;

 		auto b = a.sizeof;
 		auto c = a.length;
 		auto d = a.dup;
 		auto e = a.keys;
 		auto f = a.values;
 		a.rehash;
 	}

 Compile with: rdmd -property test.d

 Output:

 test.d(7): Error: not a property a.dup
 test.d(8): Error: not a property a.rehash
 Failed: 'dmd' '-property' '-v' '-o-' 'test.d' '-I.'
Associative arrays don't have a dup. https://d.puremagic.com/issues/show_bug.cgi?id=11509 Bye, bearophile
Nov 13 2013
parent reply "Gary Willoughby" <dev nomad.so> writes:
On Wednesday, 13 November 2013 at 11:03:48 UTC, bearophile wrote:
 Associative arrays don't have a dup.
According to this they do: http://dlang.org/hash-map.html
Nov 13 2013
next sibling parent "Gary Willoughby" <dev nomad.so> writes:
On Wednesday, 13 November 2013 at 11:12:55 UTC, Gary Willoughby 
wrote:
 On Wednesday, 13 November 2013 at 11:03:48 UTC, bearophile 
 wrote:
 Associative arrays don't have a dup.
According to this they do: http://dlang.org/hash-map.html
And adding parens works fine. `hashmap.dup()`.
Nov 13 2013
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Gary Willoughby:

 On Wednesday, 13 November 2013 at 11:03:48 UTC, bearophile 
 wrote:
 Associative arrays don't have a dup.
According to this they do: http://dlang.org/hash-map.html
Right, sorry, I have added a note to the bug report. Bye, bearophile
Nov 13 2013
parent "Gary Willoughby" <dev nomad.so> writes:
On Wednesday, 13 November 2013 at 11:25:58 UTC, bearophile wrote:
 Gary Willoughby:

 On Wednesday, 13 November 2013 at 11:03:48 UTC, bearophile 
 wrote:
 Associative arrays don't have a dup.
According to this they do: http://dlang.org/hash-map.html
Right, sorry, I have added a note to the bug report. Bye, bearophile
Cheers!
Nov 13 2013