the best language I have ever met(?)
Igor
stojkovic.igor at gmail.com
Fri Oct 13 09:24:00 UTC 2017
On Friday, 25 November 2016 at 19:16:43 UTC, ketmar wrote:
> On Friday, 25 November 2016 at 14:27:39 UTC, Igor Shirkalin
> wrote:
>> On Wednesday, 23 November 2016 at 18:58:55 UTC, ketmar wrote:
>>>> 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. ;-)
>>
>> I think you may write it (I mean actual D) with using some
>> template like this:
>
> yeah. but i'm not Andrei, i don't believe that the only
> compiler task is to resolve templated code. ;-) i.e. Andrei
> believes that everything (and more) should be moved out of
> compiler core and done with library templates. Andrei is
> genius, for sure, but he is living somewhere in future, where
> our PCs are not bound by memory, CPU, and other silly
> restrictions. ;-)
>
> tl;dr: using template for this sux.
I just don't understand how is it worth to add to a language that
instead of typing someArray.length you can just type $ but it is
not ok to add to the language the same thing for static array
size...
More information about the Digitalmars-d-learn
mailing list