Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 20, 2016 Is it legal to place a UDA on a module? | ||||
---|---|---|---|---|
| ||||
as in @myattr module foo; not module foo; @myattr: |
June 20, 2016 Re: Is it legal to place a UDA on a module? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | On 2016-06-20 11:59, Nicholas Wilson wrote: > as in > > @myattr > module foo; > > not > module foo; > @myattr: No, I don't think so. Because "module" can only appear the the top of the file (except for comments). -- /Jacob Carlborg |
June 20, 2016 Re: Is it legal to place a UDA on a module? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 2016-06-20 16:23, Jacob Carlborg wrote: > On 2016-06-20 11:59, Nicholas Wilson wrote: >> as in >> >> @myattr >> module foo; >> >> not >> module foo; >> @myattr: > > No, I don't think so. Because "module" can only appear the the top of > the file (except for comments). My mistake. It _is_ actually possible. It just looks a bit weird because the declaration of the UDA or import need to come after the use of the UDA. Example: @bar module foo; enum bar; The other way around does not work: enum bar; @bar module foo; // error -- /Jacob Carlborg |
June 20, 2016 Re: Is it legal to place a UDA on a module? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Monday, 20 June 2016 at 19:14:42 UTC, Jacob Carlborg wrote:
> On 2016-06-20 16:23, Jacob Carlborg wrote:
>> On 2016-06-20 11:59, Nicholas Wilson wrote:
>>> as in
>>>
>>> @myattr
>>> module foo;
>>>
>>> not
>>> module foo;
>>> @myattr:
>>
>> No, I don't think so. Because "module" can only appear the the top of
>> the file (except for comments).
>
> My mistake. It _is_ actually possible. It just looks a bit weird because the declaration of the UDA or import need to come after the use of the UDA. Example:
>
> @bar module foo;
> enum bar;
>
> The other way around does not work:
>
> enum bar;
> @bar module foo; // error
Thanks, this simplifies things greatly.
|
Copyright © 1999-2021 by the D Language Foundation