November 27, 2012
On 2012-11-27 08:22, Gor Gyolchanyan wrote:
> Nice idea, especially with the template to make things easier. Still it
> looks ugly. Version identifiers and numbers (as well as debug
> identifiers and numbers) serve a very good purpose (parametrizing
> modules), but they're vastly incomplete. There's so much useful stuff
> that could be done if module could have access to data of user defined
> types. I think this is very close to the idea of UDAs. If UDAs become
> mutable (which I think would be the most important feature of UDAs),
> then the module declaration could also get mutable UDAs, which would
> solve all problems. Don't you think? And version identifiers can be used
> as described in Version.d, except they'll change the module UDAs instead
> of defining a manifest constant.

Do you have any example of how you would like this to look like?

-- 
/Jacob Carlborg
November 27, 2012
On 2012-11-27 08:25, Gor Gyolchanyan wrote:
> I'd go one step forward to also allow UDAs on packages. This will be
> very useful for conditionally compiling entire libraries, instead of
> manually setting the same UDAs for every module in the package.

How would that work? You cannot declare a package, only modules.

-- 
/Jacob Carlborg
November 27, 2012
There's a tiny, but extremely useful enhancement request, that resides in bugzilla for a long time now. It proposes the possibility to have modules named "package", in which case they're imported using their package name alone:

mylib
    core.d
    aux.d
    package.d

// main.d:
    import mylib.core;
    import mylib.aux;
    import mylib;

In this case adding UDAs to packages essentially means adding UDAs to the
"package" module.
And adding UDAs to any modules would look like this:

[MyUda] module mylib.core;

Since the module-level import statements affect the entire module, the later imports would be enough to make the MyUda type visible at the top.


On Tue, Nov 27, 2012 at 11:42 AM, Jacob Carlborg <doob@me.com> wrote:

> On 2012-11-27 08:25, Gor Gyolchanyan wrote:
>
>> I'd go one step forward to also allow UDAs on packages. This will be very useful for conditionally compiling entire libraries, instead of manually setting the same UDAs for every module in the package.
>>
>
> How would that work? You cannot declare a package, only modules.
>
> --
> /Jacob Carlborg
>



-- 
Bye,
Gor Gyolchanyan.


Next ›   Last »
1 2
Top | Discussion index | About this forum | D home