Re: . or : for namespace?
- Posted by Derek Parnell <ddparnell at ?igpond.co?> May 07, 2008
- 677 views
Jeremy Cowgar wrote: > Please comment on my post: > > <a > href="http://www.openeuphoria.org/EUforum/m20546.html">http://www.openeuphoria.org/EUforum/m20546.html</a> > : blends right in with text, that's why others have not adopted it. lik:this. > lik.this does not. Your examples have demonstrated to me that the selection between '.' and ':' is somewhat governed by one's opinion of what is aesethically pleasing. You feel that '.' stands out more in text. I feel that ':' stands out more. Who is right and does it really matter? > Why do other languages that have the . as the namespace, class, > struct delimiter not have problems? We can look at history and > tell this is not going to be a problem. No sense in trying to > predict the future. Your assertion that these languages do not have problems with using '.' instead of something else may not be so cut and dried. I use the D programming language and it uses '.' to delimit the use of 'namespace' identifiers. This overloading of the '.' does cause problems. It places restrictions on the compiler about how to interpret identifier references and adds a bit of mental overhead for readers of the code to work out am I looking at a 'package' reference or a class/struct reference or a property reference. Without knowing the details of other parts of the source (which may be in other files) it can be difficult, and in some cases impossible, to be sure. For example: foo.bar.qwe(somevalue); Does 'foo' refer to a module, class, struct, or property? Does 'foo.bar' refer to a package, class, struct, or property? If we could write foo.bar:qwe(somevalue); we would know *immediately* that 'qwe' is a function defined in the package 'foo.bar' (which means it is in the file called "foo/bar.d"). > Preiod is more natural, easier > to read for scanning and easier for typing. In your opinion, unless you have some empirical results of appropriate studies to show otherwise. > But please, comment on my post that I referred to above. Sure ...
include datetime.e as dt struct emp emp.name.last = "Doe" emp.name.first = "John" emp.age = 35 emp.dob = dt:new(1965, 10, 5, 0, 0, 0)
is so much nicer to read now -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell