Current limitations of -dip1000

Walter Bright newshound2 at digitalmars.com
Tue Oct 10 02:37:21 UTC 2017


On 10/9/2017 8:04 AM, Per Nordlöw wrote:
> I'm trying to figure out how to make my manually written containers have 
> scope-aware element(s)-accessing functions. I've come up with 5 different 
> situations as follows

I find it is hopeless to explain how this works with refs, arrays, member 
functions, etc. It's much simpler to rewrite anything you're unsure of as using 
nothing but pointers and free functions. (After all, the compiler lowers all 
that reference stuff to pointers and free functions anyway.)

Making it explicit where all the pointers and parameters are makes it a LOT 
easier to reason about how dip1000 works.

For example, replace:

   int[]
   a[0]

with:

   int*
   *a

Get rid of the templates, too. Replace T with int. Get rid of any of the layers 
of confusing complexity. Think "what does the compiler lower this construct to" 
and do that.

Once it is clear how the pointers works, then start adding the complexity back in.


More information about the Digitalmars-d mailing list