Two visual D suggestions:

Alex AJ at gmail.com
Mon May 13 19:58:58 UTC 2019


A biggie:

1. Visual D is not properly handling interfaces. If I declare an 
interface variable, it simply treats it as a pointer without 
casting it to it's class type. Since all interfaces are classes 
at run time, it should do this internally and treat all 
interfaces as the classes that they

idata	0x000002a47bcc8510 {}	moduleX.idata

But if I cast idata to it's class then it shows everything as as 
expected.

This is tedious because it requires me to cast all interfaces 
and, at least for debugging purposes, makes interfaces a real 
PITA.

The debugger should easily be able to figure out the class of the 
type(use typeinfo/typeid/reflection or whatever).

Then just internally cast them to the class as if I did it in 
code(but still show it as an interface variable in the debugger).

example:

interface X;
class Y : X;

X x = new Y;
Y y = cast(Y)x;

x then is treated as a dumb ptr in the debug windows but y is 
treated correctly. Clearly they are identical.


2. For some pointers for some reason when I drag them from the 
watch or locals to memory, it shows the memory where the pointer 
is declared rather than the data of the pointer.

This is happening in strange situations:


protected void[] data;
@property ref void[] Data() { return data; }

Later on I call a template function where I get the Data above 
from an object and pass it in:

auto data = cast(float[])obj.Data;
Mod!(float)(data, 10000);

A BP on data shows the correct data when dragged. (it lists the 
values in the memory window)

auto Mod(T)(T[] dat, size_t len)

Inside Mod the dat, when dragged, is not showing up as the values 
but as a fat pointer.

In inside mod, the value's for dat looks to be a fat pointer.

In the debugger it is registering dat as T[]* (a float[]*) rather 
than just T[]. I don't understand why it is doing this, 
everything in the code works but it seems to be treating dat as a 
pointer under the hood.



Thanks for any help!



More information about the Digitalmars-d-ide mailing list