digitalmars.D - Seems like everybody's proposing const ... so here's another one
- Mike <vertex gmx.at> Dec 07 2007
- Denton Cockburn <diboss hotmail.com> Dec 07 2007
- Mike <vertex gmx.at> Dec 07 2007
- "Janice Caron" <caron800 googlemail.com> Dec 07 2007
- Mike <vertex gmx.at> Dec 07 2007
Why not keep the simple things simple? const int simple_pi =3D 3; Const, final and invariant have "default" meanings, whatever Walter thin= ks = makes the most sense. If you have the need to be specific about constnes= s, = you use: const(head: mutable, tail: invariant) [...]; It is aliasable of course. alias const(head: random, tail: pay-per-view) my_silly_const; // (*) my_silly_const [...]; What do you think? -Mike (*) Disclaimer: I don't mean to be sarcastic, it's just a silly joke = because it's friday :) -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 07 2007
On Fri, 07 Dec 2007 17:10:52 +0100, Mike wrote:Why not keep the simple things simple? const int simple_pi = 3; Const, final and invariant have "default" meanings, whatever Walter thinks makes the most sense. If you have the need to be specific about constness, you use: const(head: mutable, tail: invariant) [...]; It is aliasable of course. alias const(head: random, tail: pay-per-view) my_silly_const; // (*) my_silly_const [...]; What do you think? -Mike (*) Disclaimer: I don't mean to be sarcastic, it's just a silly joke because it's friday :)
Maybe it could be implemented in some esoteric template code. That's the idea that Walter mentioned from Andrei (not yours, but tailconst!(c)). That's the best solution right now, but yours can certainly be implemented in another template.
Dec 07 2007
On Fri, 07 Dec 2007 17:30:15 +0100, Denton Cockburn <diboss hotmail.com> wrote:Maybe it could be implemented in some esoteric template code. That's the idea that Walter mentioned from Andrei (not yours, but tailconst!(c)). That's the best solution right now, but yours can certainly be implemented in another template.
Maybe macros could do the same thing even better. Walter could leave const as it is for now, throw macros at the crowd and see what the community comes up with. I personally don't really like the idea of using templates for constness. It seems like a workaround. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 07 2007
There's one thing that's gone unmentioned in this discussion... On 12/7/07, Mike <vertex gmx.at> wrote:Why not keep the simple things simple? const int simple_pi = 3;
THREE !!!??? ;-) (Sorry - had to chime in with that).
Dec 07 2007
On Fri, 07 Dec 2007 18:17:18 +0100, Janice Caron <caron800 googlemail.co= m> = wrote:There's one thing that's gone unmentioned in this discussion... On 12/7/07, Mike <vertex gmx.at> wrote:Why not keep the simple things simple? const int simple_pi =3D 3;
THREE !!!??? ;-) (Sorry - had to chime in with that).
http://www.snopes.com/religion/pi.asp -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 07 2007









Mike <vertex gmx.at> 