alias butAtLeast = max; 5.butAtLeast(6);

SimonN via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 12 06:56:52 PST 2015


> By putting it in the top level. I believe this is intentional 
> but I don't remember the reasoning.

On Saturday, 12 December 2015 at 13:34:09 UTC, ZombineDev wrote:
> This is due to limitation of function-local aliases. If you put 
> the alias outside it will work: 
> http://dpaste.dzfl.pl/4fb06cbbfad2.

Thanks for both of these quick replies -- doing it similar to 
that example, it works for me too now. Good to know this little 
workaround.

I'd love to see the design reason for the limitation. Right now, 
the error message (property doesn't exist at all) seems to be 
misleading. But getting all corner cases right is always tricky. 
:-)

> Perhaps a simpler way achieve this is to use renamed imports:

> The Identity template can also helpful in some situations:

Thanks, will read for inspiration!

-- Simon


More information about the Digitalmars-d-learn mailing list