Re: . or : for namespace?
- Posted by Derek Parnell <ddparnell at big?ond.co?> May 05, 2008
- 723 views
Jeremy Cowgar wrote: > Now, following up with that there was another, new complaint, against the . > idea and that was by Mike and Matt agreed. My original obection was much the same too, by the way. > Their comment was that when the see a : in code that they wrote 6 months or > 2 years ago that they will know it's a namespace and therefore the function > is in another location. That they will be able to tell that right away. > However, > maybe in 2 years we will have dot'ed sequence access (whatever that will look > like) and then you will not know without research if greeter.greeting = > "Hello" > is assigning a variable name greeting inside of the greeter namespace or if > greeter is possibly a sequence. The main purpose of a programming language is to help people read programs. The two important words are "read" and "people". > So, please read my prior post about the complaints against . and then the > above > and let's have another round of discussion please. If you are in favor or > against > it, please post your comments. Please retain ":" as the namespace delimiter. The colon provides an unambiguous visual clue for people reading source as to how they should understand the identifier preceding it. Remember that an intelligent editor is not the only way that source code will be presented to a person, so tooltips and colorization assists must not be assumed to be always present. Without knowledge gained from other arts of a source code file, the following statement is visually ambiguous... if foo.bar = 1 What is 'foo'? if foo:bar = 1 Now it is obvious that 'bar' is declared in another source file. The argument with respect to ease of typing can also be applied to other often used Euphoria syntax elements, such as the double-quote, tilde, dollar and brace-pair, not to mention the widely used '<', '>', '(', ')', and '%' characters. But that argument isn't actively used against these characters so why use it against ':'? -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell