Why D is not popular enough?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 12 14:33:05 PDT 2016
On 08/12/2016 04:06 PM, Shachar Shemesh wrote:
> On 12/08/16 22:55, Walter Bright wrote:
>>
>> I'm surprised that I've never seen anyone else use such a technique.
>> It's so unusual I've seen it be unrepresentable in some 'make'
>> replacements.
>>
>> I suppose it's like unittest and ddoc. Sure, you can do it with some
>> contortions and/or some external tooling, but having it conveniently
>> built in to the language changes everything.
>>
>
> Actually, even with it being easilly accessible in the compiler, there
> are sometimes reasons to still do it with an external tool.
>
> My next task at work requires precomputing a table. This might prove to
> be a quite intensive task, and the result will change quite rarely.
> Under those circumstances, I believe I will not wish to compute it each
> time the system is compiled, but to compute it when it changes and use a
> cached version.
I wonder if you can arrange things such that a compile-time table is
computed only upon a change in the source file. I mean:
// table.di
extern double[] table;
// table.d
double[] table = makeComplicatedTable();
double[1024] makeComplicatedTable() {
... compile-time computation ...
}
People use the interface file table.di. The complicated computation goes
in table.o which is generated only when table.d is changed.
Andrei
More information about the Digitalmars-d
mailing list