lvalue - opIndexAssign - Tango
daniel.keep.lists at gmail.com
Fri Mar 13 21:40:04 PDT 2009
The Anh Tran wrote:
> When porting from c++ to D, i encounter this strange discrimination:
> 1. Built-in AA:
> int[int] arr;
> arr += 12345;
> 2. Tango HashMap:
> auto hm = new HashMap!(int, int)();
> hm += 12345; // error not lvalue
> hm++; // error
> D document says current opIndexAssign does not work as lvalue. But why
> can builtin AA can that? How can i copy builtin AA behaviour?
You can't. This is a hole in the language at the moment, hopefully
solved by the introduction of ref returns (but that's in D 2.0 which you
don't want to use at the moment.)
> Forgive my noob, where is the place to ask question, report bug for Tango?
You could try the Tango IRC channel:
That, or the Tango forums:
You can report problems with Tango via the ticket system:
http://dsource.org/projects/tango/report ("New Ticket" is down the
bottom of the page.)
> 1. I can't compile D code using tango hashmap in debug mode:
> import tango.util.container.HashMap;
> void main()
> auto hm = new HashMap!(uint, uint)();
>> dmd -w -g -debug hello.d // error
When posting problems with compiling something, it helps to mention the
version of the compiler you're using, your platform, the version of
Tango (in this case) and what the error actually is.
> 2. Compile D code using Tango Regex by GDC emit lots of link errors.
> 3. Bug in Tango atomicIncrement, atomicDecrement:
> int task_done = 0;
> That function is compiled in asm:
> lock inc byte ptr[task_done];
> Which is wrong. It'll wrap to 0 at 255.
> It should be: lock inc dword ptr[task_done];
> 4. There is no atomicAdd(ref original, int newvalue) family. GCC
> equivalence is __syn_fetch_and_add ...
More information about the Digitalmars-d-learn