[Issue 7897] Problem with alias template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 20 17:59:45 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7897



--- Comment #8 from Walter Bright <bugzilla at digitalmars.com> 2012-04-20 18:00:42 PDT ---
(In reply to comment #7)
> Oooohkay, so now we get to the bottom of it.
> Right, well I didn't realise that restriction. I just assumed any statically
> addressable variable was alias-able.

Any *symbol* is aliasable. It isn't about addresses.


> So this is a feature request then, not a bug.
> There's still technically no reason it shouldn't work, it's just not quite how
> alias is written?
> How much trouble would it be to extend 'alias' to include an offset value?

This is a significant redesign of what alias is.


> This restriction makes it very difficult to drill down into structures via
> recursive enumeration. The workaround I've had to use is to use strings instead
> of aliases that can mixin an absolute reference, but it's really untidy, and
> again, messes with the editor a lot (syntax hilighting, auto-complete, etc).
> It also requires mixin(a) everywhere, and there are lots of cases where mixin()
> is invalid in the middle of an expression. This requires a further workaround
> to build the whole expression into a string and mix the whole thing in.
> 
> I wonder if you could use lowering here to produce the same result via lowered
> mixin? Although it sounds much cleaner to simply add an offset to aliases.

It isn't simple, because having an offset makes it an expression, not a symbol.
It's a substantial redesign.


> Another alternative could be to just invent the appropriate symbol when a
> reference like this appears. Symbol names follow the d scoping patterns right?
> In this case, the symbol would just be my.module.thing.x (or with whatever
> mangling happens to appear in D symbols).

Can't you just pass a pointer around?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list