February 24, 2004 Re: Properties should be C# style and Packages should be Namespaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Becker | Matthias Becker wrote: >I hate methods/properties starting with an upercase letter. My rule is Types >start with upper case letters, variables/functions with lower case letters. And >I don't want to change this only to get a worse way of properties than the >current D-properties. :confused: > >Instead of something stupid like this we should think about alternatives. E.g. >we could add something like namespaces in C++ but on class level. > >class Foo { >namepsace m { >int var; >} >public int var () >{ >return m.var; >} >public var (int value) >{ >m.var = value; >} >} > > >this is only an idea. Perhaps there are other better ideas. > > > You can almost do that with a struct: class Foo { struct M { int var; }; M m; public int var () { return m.var; } public void var (int value) { m.var = value; } } In C++ you could go: class Foo { struct { int var; }m; //Not allowed in D ... } -- -Anderson: http://badmama.com.au/~anderson/ |
February 24, 2004 Re: Properties should be C# style and Packages should be Namespaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | >Having event support in the language is way cooler, it forces developers to use one form of event handling instead of their own. So coding is about coolness? Interesting. So you like being restricted? You are realy strange. >delegate OnFoobarEventHandler(object o, EventArgs e) >{ > add { //do some things here if you } > remove { // do some things here } >}; > >event OnFoobarEventHandler FoobarEvent >{ > add { // ... } > remove { // .... } >} > > >obj.FoobarEvent += new OnFoobarEventHandler(obj.Method); > >how nice is that ??? >i don't see the point why in D you have to use opAdd and crap like that ot >override an operator what is wrong with >class Foobar { >public static Foobar operator +(Foobar c1, Foobar c2) >{ > >} >} I ever got it. I'd prefere operator +, too. >In C# events are delgates where you have to use +/- to assign to them, that is all. If you assing directly, you will erase what was there before. They only thing I don't like about C# is that it ties you in to the framework. I guess I want D to become native C#. My point is that when they designed this language, they looked at a ton of languages and took only the good things, D should be in the same way and take the nice stuff of C#. But the stuff you suggest is defenetly not nice, but restrictive. >A nice framework should be created for D istead of all this >ununited module projects. >system.Event; >system.Delegate; >system.xml*; >system.data*; >system.foobar; In D we use std not system. >Camel Casing for Methods/Properties is better since you can have a field named something, the encapsulate it later and don't have to mess with _var m_var mVar, var_. myArray.Length instead of myArray.length. thisIsCamelCase, ThisIsntCamelCase!!! >Microsoft has always seen the greater picture. so the greater picture is money? |
February 24, 2004 Re: Properties should be C# style and Packages should be Namespaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | >Why are you people so closed minded? If the language was 1.0, I wouldn't bitch about it, but since it is under development, I do.
OK, suggest something usefull. You want us to ad C# like properties, but we already have a easyer more flexible way. You want us to add a restrictive event system, but we want to be able to create our own more powerfull one. ...
|
February 24, 2004 Re: Properties should be C# style and Packages should be Namespaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to SpookyET | SpookyET wrote: > The reason why i said that myMethod should be MyMethod and the same for properties is this: > > class Demo > { > public int numbers; > > public int Numbers > { > get { return numbers; } > set { numbers = value; } > } > } > > Having methods/properties named in lowercase forces you to name your variables to > ugly naming styles like _var m_var var_. So you're saying you want to break the ability to distinguish between objects and functions because it forces you to use ugly variable names? This isn't a very convincing argument. And frankly, you should be distinguishing class member vars anyway. Read "Large Scale C++ Software Design." > What the language needs is indexers (makes classes/structs behave like arrays) and builtin support for events. I agree about the indexers (ie. operator[]) but not events. Building support for a specific programming model into the language is a mistake, IMO. If a better model is developed later on, the language will be forced to continue to support the old model. > Events are basically delegates but with some restrictions. It forces you to use +/- to add event handlers. > foo.MyEvent += new EventHandler(method); And to think I am normally a big supporter of operator overloading. This syntax is terrifying. >> To compile you have to csc.exe hello.cs /resources:System.dll >> No package crap, no includes no nothing. >> It searches the resources for that namespace and converts Console to >> System.Console. D looks promissing but please use namespaces. Modules ARE namespaces. As are classes. Sean |
Copyright © 1999-2021 by the D Language Foundation