The plots in http://blog.wolfram.com/2014/06/04/how-the-wolfram-language-measures-up/ seems to indicate that Pascal has a relatively high code density. What features of the language makes it so?

Follow-up question:

Does this explain why Pascal are often introduced in high schools as one of the first programming languages?

  • 1
    $\begingroup$ Although I provided an answer, it has occurred to me that I don't know what you mean by code density. What do you mean? $\endgroup$ – Dave Clarke Jun 4 '14 at 20:25
  • $\begingroup$ @DaveClarke Based on the blog post, the preferred measure of code density is the number of tokens required to implement specific functionality (though a previous study used character count). $\endgroup$ – Paul A. Clayton Jun 4 '14 at 21:43
  • 1
    $\begingroup$ Given that the Wolfram language "wins" by their measurement but is horrible to program in, that might not be the best quality metric around. $\endgroup$ – Raphael Jun 4 '14 at 23:39
  • $\begingroup$ @Raphael What's a better metric given Rosetta Stone as input data sets? $\endgroup$ – qazwsx Jun 5 '14 at 6:46
  • $\begingroup$ @Problemania: I have no idea! Depends on what you want, I guess. In industry, I'd look at revenue per programmer hour. For academic investigations of elegance, code length may even be appropriate but it has to be done carefully (i.e. selecting fair examples and forbidding [non-standard] library functions). $\endgroup$ – Raphael Jun 5 '14 at 7:00

What makes Pascal dense is not the features it has, but the features it doesn't. Here is a small list of features that make other languages less dense:

  • higher order functions
  • classes and inheritance
  • specialised syntax for sets, lists, hashes
  • built in regular expression syntax
  • good libraries
| cite | improve this answer | |
  • $\begingroup$ Boilerplate is also a source of code bloat. Having to specify types would also add length. $\endgroup$ – Paul A. Clayton Jun 4 '14 at 21:46
  • $\begingroup$ Procedures and function can be passed as parameters in Pascal, though they cannot be returned as results. Still, it should qualify to some extent as higher-order functions. $\endgroup$ – babou Jun 4 '14 at 22:31
  • $\begingroup$ Does your argument explains that Pascal wins over FORTRAN? $\endgroup$ – qazwsx Jun 5 '14 at 6:45
  • $\begingroup$ seems good answer to me as it is indeed correct plus the structured form of programming, pascal is known to endorse (which adds boilerplate code), makes this even higher $\endgroup$ – Nikos M. Jun 5 '14 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.