3 isn't unreadable; just look out for semicolons rather than new lines. lysdexia 04:59, 22 Oct 2004 (UTC)
- Then let's change it so it doesn't say "unreadable". I've done so. Dysprosia 09:34, 22 Oct 2004 (UTC)
It's not malformed either; it's a single logical unit of code which happens to fit on one reasonably-short line; therefore it is not unreasonable to keep it as one line. I've changed it to "another style which some might find less easy to read".
I removed the section on Wiki formatting, because text formatting as done by the Wiki, or by Tex or a Web browser, is not normally called pretty-printing. --Macrakis 02:34, 13 Apr 2005 (UTC)
- It is not nomally called prettyprinting, but it is prettyprinting by definition and a prime example of it. Dysprosia 13:50, 13 Apr 2005 (UTC)
- We apparently disagree on the definition of pretty-printing, then. As I have always understood it, pretty-printing refers to making the structure of an object explicit in its layout. So it is all about structured objects like programming language texts, mathematical formulae, chemical structures, etc. Laying out paragraphs by hyphenating, justifying text, avoiding widow and orphan lines, inserting headers and footers with titles and page numbers, generating tables of contents and indexing, etc. does not fit into that definition -- although formatting section headings does. Since you agree that text formatting is "not normally called prettyprinting", it would seem to me more appropriate to cross-reference it as "related" rather than including it in this article. Of course, there is some overlap (e.g. splitting formulae over multiple lines) and some pretty-printers also do things like generate function indexes etc., but I would argue that that is not the core pretty-printing functionality. --Macrakis 15:09, 16 Apr 2005 (UTC)
- No, I'm saying by the definition in the article, it may be not normally called prettyprinting, but it is prettyprinting nonetheless.
- In any case, WYSYWIG word processing is not prettyprinting because there is no active improvement of layout.
- However, wiki syntax or TeX is prettyprinting, because it is making a document's structure easier to perceive. Formatting does reflect structure (consider the bold formatting of the title text or synonyms thereof in Wiki articles, this tells us what the article is to deal with, for example). Don Knuth in The TeXbook said himself that TeX permits macro formatting of text precisely to make the applicability of style to structure simple. Dysprosia 07:38, 17 Apr 2005 (UTC)
- Now I am completely confused about your definition of pretty-printing. Why is it pretty-printing if done offline but not when done online, in real time? Anyway, even if you consider text formatting to be pretty-printing in some technical sense, if it is "not normally called" prettyprinting, then I'd conclude that it's a bad idea to use it as an example of pretty-printing. It's a little like using a tomato as an example of a fruit -- yes, it is technically a fruit, but it is not a prototypical fruit. --Macrakis 15:41, 17 Apr 2005 (UTC)
- I'm confused about what you think my definition is. I am using the article's definition: "to present an object in such a way a to make its structure easier to perceive for to a human reader". Certain examples of text formatting such as Wiki or TeX formatting is prettyprinting since it is making a document's structure easier to perceive for a human reader.
- Yes, you call a tomato a fruit, but you list it on the "List of fruits" and you may even want to make special note of its fruity status. You don't leave it off the List of fruits altogether. Dysprosia 23:03, 17 Apr 2005 (UTC)
Should we mention TeX or LaTeX, or one of the similar programs? --Whiteknight 02:56, 23 Jun 2005 (UTC)
What programming language is the example in?
I am a highschool JAVA student and it looks to me like JAVA but...I can't tell...
- C. Dysprosia 09:21, 30 May 2005 (UTC)
Would it be sensible to mention commercial packages here? e.g. SourceStyler, PolyStyle, SourceFormatX and StyleManager. I'm not sure of the etiquette on Wikipedia on linking to non-free resources (it could be considered advertising). In the interests of full disclosure it's fair to point out I work for ProFactor who product StyleManager, hence I think it wise I check before suggesting these links! TheMoog 15:06, 25 November 2005 (UTC)
- My understanding of Wikipedia policy is that links to commercial resources are fine, as long as they respect the same quality standards as other links. In particular, not only should the site be informative, but if it is a product site, it should be a notable product, not (for example) a recent start-up or a company with a tiny market share. --Macrakis 15:34, 25 November 2005 (UTC)
- Now a year on and I hope nobody minds if I link our product here too - I don't know our own market share but our product has been out and selling happily for over a year now, so I'd like to think we meet the requirements. As far as notable, we are the one of the only remaining actively developed source code formatting packages so I think that makes us noteworthy (compare the build dates and versions of the other commercial offerings). TheMoog 22:06, 5 September 2006 (UTC)
- I believe mention of commercial packages is appropriate here, since the topic itself is not inherently restricted to open source software. I disagree with the anonymous action of a year ago where someone deleted references to commercial software, and if there is a Wikipedia policy statement on this, someone please post it below. Moreover, if a commercial package is robust, actively supported, and has a user community, it has more weight than a one-man project on sourceforge which is still in "alpha" release. Some of the open source projects mentioned in the article are stale or abandoned, and the better-known packages ought to receive mention. Censoring mention of a commercial product simply because it is commercial or "non-free" is still censorship. On the other hand, start-up products less than a year old should have a one-year delay before posting links to them. EricP (talk) 23:25, 8 May 2008 (UTC)
Pretty Printing vs Code Beautification
I always thought these were two separate things. Code beautification actually changes the source code, i.e. its ASCII representation -- usually by changing indentation and line breaking (i.e. fiddle round with whitespace). Pretty printing does not leave you with ASCII or change the indentation or line-breaking (or do any insertion, deletion or alterations of characters), but rather changes the typeface, weight, slant and/or colour of bits of text in a way that corresponds to the lexical/grammatical structure of the language. So it leaves you with some kind of rich text representation designed for easy human reading on-screen or in hardcopy form. That's just how I always interpreted these terms -- am I wrong? --Russell E 03:07, 15 June 2006 (UTC)
You're right. It's obvious, ironically from the article itself, that code beautification and 'pretty print' are two different things. This needs to be cleared up. Code beautification should have its own page. --Daydreamer302000 (talk) 09:50, 14 August 2008 (UTC)
- Actually there are three aspects mixed together: (a) modifying a program's source to present it in a more readable form but not necessarily intended for further editing, (b) modifying a program's source to make it more readable - but still editable, and (c) showing a program's source in a more readable way without modifying it at all. Normally pretty-printing is just the first. Mixing indent with it is typically done by people unfamiliar with the topic. Tedickey (talk) 23:32, 4 December 2008 (UTC)
I've added a paragraph on Virtual Formatting, because it seems both an obvious and significant alternative to using whitespace for formatting code in certain circumstances. I should declare a self-interest in that my company produces a virtual formatting XML tool. I've been advised by others that there are examples of virtual formatting tools around, but I've had no success in tracking one down to use as an example. Phil Fearon (talk) 10:40, 19 August 2011 (UTC)
Yes, that was a concern, but now I now realize that Internet Explorer, Firefox and Chrome use virtual formatting to render XML, so so I'll include one of them as a reference, hopefully they meet notability requirements? Phil Fearon (talk) 13:27, 19 August 2011 (UTC)
- Do you have any WP:RS pointing out that they use this term, in a manner consistent with your definition? I've found none. Googling on it finds only random unrelated uses. Without that, it's WP:OR TEDickey (talk) 20:46, 19 August 2011 (UTC)
Agreed, the term is not in common use, thank you for highlighting WP:OR. Because of this, I don't see a way of adding balance to the impression the article's samples and referenced items give, I'll just remove the heading and para and admit defeat. Phil Fearon (talk) 22:12, 20 August 2011 (UTC)
Note on the code examples: the function has return type "int," but the example code does not return any value. I therefore suggest that you change the function to return type "void." 184.108.40.206 (talk) 20:58, 7 April 2008 (UTC)