What's missing to make D2 feature complete?
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Wed Dec 24 05:40:12 PST 2014
On Wed, 24 Dec 2014 09:32:05 +0000
via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> On Wednesday, 24 December 2014 at 09:02:56 UTC, Kagamin wrote:
> > If you require another variable for a sanitized version of `n`,
> > you get confused, when to use `n` and when to use `x`, they are
>
> Btw, this is case where preventing shadowing becomes an issue, as
> you could have solved this easily using immutable shadowing:
>
> func(immutable int n){
> @trustmeiwantoshadowthis immutable n = sanitize(n);
> ...
> }
void myFunc(T) (T numm) if (isIntegral!numm) {
static if (isMutable!numm) alias num = numm;
else auto num = cast(Unqual!T)numm;
...
}
heh. catched a bug in my code with immutable ints recently, wrote the
quoted snippet. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141224/231bbfd5/attachment.sig>
More information about the Digitalmars-d
mailing list