the best language I have ever met(?)

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 10:58:55 PST 2016


On Wednesday, 23 November 2016 at 18:54:35 UTC, Igor Shirkalin 
wrote:
> On Tuesday, 22 November 2016 at 00:08:05 UTC, ketmar wrote:
>> On Monday, 21 November 2016 at 23:49:27 UTC, burjui wrote:
>>> Though I would argue that it's better to use '_' instead of 
>>> '$' to denote deduced fixed size, it seems more obvious to me:
>>>
>>> int[_] array = [ 1, 2, 3 ];
>>
>> alas, `_` is valid identifier, so `enum _ = 42; int[_] a;` is 
>> perfectly valid. dollar is simply most logical non-identifier 
>> character.
>
> We can define static array without counting the elements as 
> following:
>
>
> enum array_ = [1u,2,3,4];
> uint[array_.length] static_array = array_;

there are workarounds, of course. yet i'll take mine `uint[$] a = 
[1u,2,3,4];` over that quoted mess at any time, without second 
thought. ;-)


More information about the Digitalmars-d-learn mailing list