Does D have too many features?
Artur Skawina
art.08.09 at gmail.com
Tue May 1 02:50:11 PDT 2012
On 05/01/12 02:25, H. S. Teoh wrote:
> On Tue, May 01, 2012 at 02:14:42AM +0200, bearophile wrote:
>> Timon Gehr:
>>
>>> * I agree on supporting deducing length for static arrays. (there
>>> is a
>>> int[$] arr = [1,2,3]; proposal.)
>>
>> Someone in Bugzilla ha just proposed an alternative idea, that
>> despite not looking very nice, is not overall bad (here with a small
>> change):
>>
>> auto arr = [1, 2, 3]f;
>>
>> That trailing f denotes a fixed-side array/string literal. So it's
>> usable for other situations too.
> [...]
>
> I don't like it. An f prefix already means float in another context;
> overloading it to also mean static array is a bad idea. D already has
> too much overloaded syntax (like static meaning all sorts of diverse
> things depending on context). I much prefer the int[$] proposal, because
> $ already means "length of array" in D, and so would fit right in.
Since one of the most characteristic D features is overloading "static"
whenever possible, this would fit right in:
auto arr = static [1, 2, 3];
artur
More information about the Digitalmars-d
mailing list