Thread overview | |||||
---|---|---|---|---|---|
|
April 15, 2016 Why does Reggae use mixins? | ||||
---|---|---|---|---|
| ||||
Why does the build system Reggae use mixins everywhere in the D examples? Doesn't this severly limit what the build rules are capable of in terms of run-time flexibility? https://github.com/atilaneves/reggae |
April 16, 2016 Re: Why does Reggae use mixins? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 15 April 2016 at 13:18:46 UTC, Nordlöw wrote: > Why does the build system Reggae use mixins everywhere in the D examples? > > https://github.com/atilaneves/reggae Correction, it can do stuff either at CT or run-time as show here: https://github.com/atilaneves/reggae/blob/master/doc/basics.md Could somebody highlight when either is adviced? |
April 16, 2016 Re: Why does Reggae use mixins? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Saturday, 16 April 2016 at 13:04:24 UTC, Nordlöw wrote:
> On Friday, 15 April 2016 at 13:18:46 UTC, Nordlöw wrote:
>> Why does the build system Reggae use mixins everywhere in the D examples?
>>
>> https://github.com/atilaneves/reggae
>
> Correction, it can do stuff either at CT or run-time as show here:
>
> https://github.com/atilaneves/reggae/blob/master/doc/basics.md
>
> Could somebody highlight when either is adviced?
Mixins are used so a D build description can be written at module-scope, thereby looking like a scripting language. The only reason this is important is to enable builds that have run-time logic, which is pretty much all of the high-level rules (since they have to read the file system).
the build template mixin doesn't have to be used, the only thing reggae wants from a build description written in D is that there be one and exactly one function with the signature:
Build func();
That's the function that gets called to generate the build. Since I'm lazy I created a template mixin to write the function for me, which again means that all definitions can be at module-scope.
Basically it's so that the file looks like:
alias exe = executable!(...);
mixin build!(exe);
Instead of:
Build myBuild() {
auto exe = executable(...);
return Build(exe);
}
Atila
|
Copyright © 1999-2021 by the D Language Foundation