Subj : Re: curve for verbosity in a language To : comp.programming From : Jon Harrop Date : Sun Aug 07 2005 04:48 am Vesa Karvonen wrote: > 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. Merriam-Webster dictionary is not a suitable source for this kind of information... >> 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. That's a nice theory but I don't have token counting programs and I do have "wc". >> > *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%. They both differ by arbitrary amounts, yes. > *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. In this case. > 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. Then we'll have to agree to disagree. >> Indeed, verbosity is inherently subjective. > > To some degree, yes. Something is either objective or not. Verbosity isn't. > Particularly when you choose a lousy definition of verbosity. But that's the point - you have to choose a definition. > 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. Ok. >> 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. Objectively, we can do no better than "highly subjective and biased metrics". > There is a reason why there are so many advocacy groups. Those groups are > for people like you. I am sorry that you don't appreciate my work, but many other people do. -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com .