digitalmars.D - Initializers are Evil!
- nazo (6/6) Jun 21 2007 I don't like initializer because need to remember two grammars.
- mandel (7/14) Jun 21 2007 Initialization is a good way to prevent undefined behavior.
- nazo (6/23) Jun 21 2007 I think that this is better for disable-initialization:
- dennis luehring (6/7) Jun 21 2007 are there different types of void?
- nazo (7/17) Jun 22 2007 In other hand, add "nothing" keyword and NothingExp's type is made void....
I don't like initializer because need to remember two grammars. dmd already support many literals so can replace initializers easily with expressions, I think. Most script languages like Javascript don't have any initializers. Why special-case initializers? #Sorry for my poor English
Jun 21 2007
Initialization is a good way to prevent undefined behavior. But you can also disable initialization when you assign void: class Foo { int number = void; //initialization disabled } nazo Wrote:I don't like initializer because need to remember two grammars. dmd already support many literals so can replace initializers easily with expressions, I think. Most script languages like Javascript don't have any initializers. Why special-case initializers? #Sorry for my poor English
Jun 21 2007
I think that this is better for disable-initialization: class Foo { auto number = int.void; //assign nothing } mandel さんは書きました:Initialization is a good way to prevent undefined behavior. But you can also disable initialization when you assign void: class Foo { int number = void; //initialization disabled } nazo Wrote:I don't like initializer because need to remember two grammars. dmd already support many literals so can replace initializers easily with expressions, I think. Most script languages like Javascript don't have any initializers. Why special-case initializers? #Sorry for my poor English
Jun 21 2007
nazo schrieb:are there different types of void? int.void != float.void != double.void? why on earth should void be type-dependend? it isn't! and typeof(int.void) should be void? why change the auto semantic? ciao dennisauto number = int.void
Jun 21 2007
dennis luehring さんは書きました:nazo schrieb: >>auto number = int.void are there different types of void? int.void != float.void != double.void?see the following.why on earth should void be type-dependend? it isn't!In other hand, add "nothing" keyword and NothingExp's type is made void. But module's type is also void. so I think that it is not good.and typeof(int.void) should be void?int.void should be VoidExp and typeof(int.void) should be int. And compiler should optimize VoidExp for assign.why change the auto semantic?don't changeciao dennis
Jun 22 2007