Subj : Re: curve for verbosity in a language To : comp.programming From : Vesa Karvonen Date : Sun Aug 07 2005 03:16 am Jon Harrop wrote: > Vesa Karvonen wrote: [...] > Whitespace is important to both the machine and the human. The fact that the > amount of whitespace is irrelevant for the machine has nothing to do with > the notion of verbosity (which is for the human). Your notion of verbosity does not agree with any widely used definition I have seen. Again, according to Merriam-Webster, verbose means "containing more words than necessary" . Whitespace is not considered a word by any strech of imagination in most programming languages. > I can type "wc" in under 1sec. So that is ~5 orders of magnitude faster than > writing and testing my own lexers. What would you estimate would be the time for you to type the name of a token counting program after someone has written it? For the sake of argument, let's assume that the name of the token counting program would be called `tc'. The token counting program only needs to be written once and extended once per language --- not every time you use it. You don't roll your own `wc' each time you want to use one. > > *NOT (number of tokens) is a well defined and objective metric*. > No. Token count is also subject to personal style. For example: Let's see. > let f a b = > let c = a + b in > c * c Here I count 15 tokens and 3 lines. > let f a b = (fun c -> c * c) (a + b) Here I count 18 tokens and 1 line. The token counts differ by 17% and the line counts differ by 67%. *Evaluation*: Looking at the example, my opinion is that the latter definition is slightly more verbosely written; the latter definition has more puctuation than the former one. Since both functions do the same thing, I would expect that a good complexity metric would give similar results for both. The token count metric agrees with my expectations in this respect clearly better. However, let's look at a more interesting example: let f a b=let c=a+b in c*c let f a b = let c = a + b in c * c Between the above definitions there is no difference in token counts and the line counts differ by 80%. *Evaluation*: The definitions are considered identical in Ocaml. I personally consider them equally verbose, although they are formatted differently (and neither according to my personal preference, but still I wouldn't be surprised to see either style being used). Since the definitions are identical, I would expect an objective metric to give them, from a practical point of view, the same result. The token count metric succeeds. The line count metric fails miserably at matching my expectations. > Indeed, verbosity is inherently subjective. To some degree, yes. Particularly when you choose a lousy definition of verbosity. However, there are more and less subjective ways to define and measure verbosity as I have hopefully demonstrated above. Based on the above, I consider the token count metric to be a clearly superior metric of verbosity compared to the line count metric. Line count metric is at the best a good metric of personal preferences in formatting code and at the worst a poor metric to base salary upon. > Regarding the personal note, OCaml is my favourite language and do I prefer > it to the other languages that I have learned. Consequently, I advocate it. > Not the other way around. I think we need a new group: comp.lang.ocaml.advocacy. I have nothing against Ocaml. I find it a very nice language, based on my experience in writing Ocaml code for a couple of years. However, I find your arrogant style of advocating it in terms of highly subjective and biased metrics quite revolting. There is a reason why there are so many advocacy groups. Those groups are for people like you. -Vesa Karvonen .