any news on const/invariant?
Bruce Adams
tortoise_74 at yeah.who.co.uk
Mon Dec 17 11:19:59 PST 2007
On Mon, 17 Dec 2007 19:16:34 -0000, Bruce Adams
<tortoise_74 at yeah.who.co.uk> wrote:
> not be part of the contract.
> You can just as easily say in the body:
>
> foobar(valueType2 bar)
> {
> const valueType2 IamConst = bar;
> ... use IamConst
> }
>
> or
>
> foobar(const valueType2)
> {
> valueType2 IamNotConst = bar;
> ... use IamNotConst
> }
>
> constness helps a little here but it affects the implementation only.
> Ideally I'd like the to be able to declare constness of an argument in
> the implementation but leave it out of the declaration. Implementation
> in the compiler
> wise it would be trivial but syntactically its hard to think of
> something appropriate.
> In D this is even weirder because you don't have separate declarations
> and implementations.
>
Actually thinking about it. In D the syntax is easier. Implement what you
like in your
code and your documentation, doxygen or whatever should leave the const
out.
More information about the Digitalmars-d
mailing list