Worst ideas/features in programming languages?
Stefan Koch
uplink.coder at googlemail.com
Tue Nov 23 14:09:56 UTC 2021
On Tuesday, 23 November 2021 at 09:09:03 UTC, bauss wrote:
> On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:
>> On 12.10.21 23:38, Timon Gehr wrote:
>>>> * Features you'd like to see in D
>>
>> Another thing I have sometimes wished for, but forgot to
>> include:
>>
>> - package and module templates
>
> What do you mean by that?
>
> Something like this? Or?
>
> ```d
> module main;
>
> import a!5;
>
> void main()
> {
> auto foo = new Foo;
> foo.field4 = 10;
> }
> ```
>
> ```d
> module a(int fieldCount);
>
> import std.string : format;
>
> class Foo
> {
> static foreach (i; 0 .. fieldCount)
> {
> mixin(format("int field%d", i));
> }
> }
> ```
I think that is what he means.
template modules are something I have thought about, it's a
simple addition but I fear they might not be advisable in the
long run. Unfortunately I cannot really put my finger onto why
that might be.
I have a vague sense that this feature would lead to
un-synchronized changes which are meant to be synchronized.
More information about the Digitalmars-d
mailing list