digitalmars.D - How about "inline" for manifest constants?
- Russell Lewis (8/8) Dec 09 2007 inline int x = 3;
- Craig Black (3/11) Dec 09 2007 I like it.
- Robert Fraser (3/13) Dec 09 2007 You mean semantic error? But now we're just talking semantics...
- Janice Caron (6/7) Dec 10 2007 Isn't this exactly the same idea as
- Bill Baxter (9/19) Dec 10 2007 The idea is: if we're going to change the meaning of enum completely why...
- Robert Fraser (10/19) Dec 10 2007 No it's not. With inline or wildbeast, you can create blocks:
inline int x = 3; Where the "inline" keyword means "the compiler is free to not allocate any storage for this constant." In particular, this means that it would be a syntax error to either: 1) Take the address of an inline constant 2) Change its value Whether or not the compiler actually inlines all instances or not is implementation-specific.
Dec 09 2007
"Russell Lewis" <webmaster villagersonline.com> wrote in message news:fjill0$2jnc$1 digitalmars.com...inline int x = 3; Where the "inline" keyword means "the compiler is free to not allocate any storage for this constant." In particular, this means that it would be a syntax error to either: 1) Take the address of an inline constant 2) Change its value Whether or not the compiler actually inlines all instances or not is implementation-specific.I like it.
Dec 09 2007
Russell Lewis wrote:inline int x = 3; Where the "inline" keyword means "the compiler is free to not allocate any storage for this constant." In particular, this means that it would be a syntax error to either: 1) Take the address of an inline constant 2) Change its value Whether or not the compiler actually inlines all instances or not is implementation-specific.You mean semantic error? But now we're just talking semantics... Anyways, it's a good idea.
Dec 09 2007
On Dec 10, 2007 7:18 AM, Robert Fraser <fraserofthenight gmail.com> wrote:Anyways, it's a good idea.Isn't this exactly the same idea as enum int x = 3; but with "inline" instead of "enum"? Aren't we done arguing over what the word should be? I think we should just go with Craig's wildebeest idea! :-)
Dec 10 2007
Janice Caron wrote:On Dec 10, 2007 7:18 AM, Robert Fraser <fraserofthenight gmail.com> wrote:The idea is: if we're going to change the meaning of enum completely why not just replace it with a different word that describes the entirety of it's new job and phase out the word "enum". That way there's no net increase in keywords but we get a more descriptive language.Anyways, it's a good idea.Isn't this exactly the same idea as enum int x = 3; but with "inline" instead of "enum"? Aren't we done arguing over what the word should be?I think we should just go with Craig's wildebeest idea! :-)I think inline is a pretty good suggestion. And inline(enum) could be used to trigger enumeration behavior. But it'll never happen. --bb
Dec 10 2007
Janice Caron wrote:On Dec 10, 2007 7:18 AM, Robert Fraser <fraserofthenight gmail.com> wrote:No it's not. With inline or wildbeast, you can create blocks: wildbeast { int mufasa = 99999999999999L; string aslan = "i can has cheezburger?"; } This can't be done with enum. SOme other word besides enum, final or alias needs to be found, IMO, since enum can't create blocks, and final used on blocks would have different meanings for vars and member functions.Anyways, it's a good idea.Isn't this exactly the same idea as enum int x = 3; but with "inline" instead of "enum"? Aren't we done arguing over what the word should be?
Dec 10 2007