May 21, 2019 Re: Just sayin', fwiw... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Thursday, 16 May 2019 at 03:11:15 UTC, Nick Sabalausky (Abscissa) wrote:
> I'm tempted to just always "alias String = immutable(byte)[]"
Well actually, because "string" is just an alias defined in object.d, you can actually redeclare it to be something else in your own code.
-----
import std.stdio;
alias string = int[long];
void main()
{
string im_not_a_string = [1: 10, 2: 20];
writeln(im_not_a_string);
}
-----
Have fun. :P
|
May 20, 2019 Re: Just sayin', fwiw... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 5/20/19 9:39 PM, Andrej Mitrovic wrote:
> On Thursday, 16 May 2019 at 03:11:15 UTC, Nick Sabalausky (Abscissa) wrote:
>> I'm tempted to just always "alias String = immutable(byte)[]"
>
> Well actually, because "string" is just an alias defined in object.d, you can actually redeclare it to be something else in your own code.
>
> -----
> import std.stdio;
>
> alias string = int[long];
>
> void main()
> {
> string im_not_a_string = [1: 10, 2: 20];
> writeln(im_not_a_string);
> }
> -----
>
> Have fun. :P
Hmmm...I think I'll just hold off on that trick until I ever enter a code obfuscation contest... ;)
|
Copyright © 1999-2021 by the D Language Foundation