• definition of a programming language (discussion/rant)
    38 replies, posted
Hi. I would like to start a discussion on this topic to see what people opinions on it, as well as give a sort of initial rant to get things started. While I was learning HTML and CSS (cascading style sheets) I caught a bit of flak from some programming friend for me saying I was learning a new programming language. My friends argued that HTML and CSS are not really programming languages. I did not argue back as I was new and assumed they knew better. Now that I am familiar with javascript and Jquery, and being able to get a better understanding of how CSS actually works on the back end, I am starting to disagree with the statement that HTML and CSS are not real programming languages. While I was studying electrical engineering (lets call it a past life), I had to learn the assembly programming language. This language was very low level, only one up from binary; and from what I understand, was used to make higher level programming languages such as C (my facts may be wrong there.) Now if people are arguing that HTML and CSS are not programming languages because they rely on "real programming languages" to interpret their instructions and convert them into the original code; then would you not end up down the road of saying that C, Javascript, ect are not real programming languages, witch is of course not true. What you definitely could say, is that HTML and CSS do not belong to certain groups of programming languages, such as logic programming languages but they are definitely instructions to a computer witch I believe makes the definition. I think that saying that HTML and CSS are not true programming languages is both inaccurate and only serve to degrade the enthusiasm of new programmers who are venturing into the first required fields of web programming. Why not just urge them onwards to start on JavaScript and PHP were the real fun begins. My two thoughts, -Adrian
It's like saying you're casually learning Cockney.
HTML is a markup language, and CSS is a style sheet language that is used to define how documents in a markup language are supposed to look like to the user. Both are computer languages in the sense that they are interpreted and used by a computer, but they are not programming languages as they don't let you write algorithms in them.
[QUOTE=Zinayzen;44483073]It's like saying you're casually learning Cockney.[/QUOTE] I have a hard time imagining that metaphor. But fair enough...
it's sort of a language, i guess, but no one will take you seriously about it.
It's a language for instructing a computer, yes, but you can instruct a computer in English, if you want. Does that make English a programming language? HTML is a markup language, because it's made for marking up text (like Markdown, Wikitext, LaTeX, or any number of alternatives). CSS is a styling language, because it's meant for making marked up text look pretty. Neither of these are programming languages. Also, there is no fun in PHP.
I wanted to argue against OPs point but now I'm starting to change my mind. Take a look at a dropdown list for example. The content it's displaying depends on the currently selected option. Is that not branching? The only viable argument I can see to that is the lack of procedurality but then you have to argue that functional languages aren't programming languages either. Markup is a programming language. Perhaps declarative and not really turing complete, but I don't see why it wouldn't fit in the category.
Dude it's all just text turned in to a syntax tree and used to do by the computer.
[QUOTE=Jookia;44486330]Dude it's all just text turned in to a syntax tree and used to do by the computer.[/QUOTE] Do you mean HTML or all programming languages in general?
HTML is no more of a programming language than JSON, YAML or XML are (unless you're using a dodgy version of Ruby). It's a method of framing data so that a parser (your browser) can understand it. CSS is a set of static rules. They don't have instructions so you can't write programs in them.
[QUOTE=Lexic;44486592]HTML is no more of a programming language than JSON, YAML or XML are (unless you're using a dodgy version of Ruby). It's a method of framing data so that a parser (your browser) can understand it. CSS is a set of static rules. They don't have instructions so you can't write programs in them.[/QUOTE] How is a frame different from an "instruction"? It describes how the data inside of it is interpreted just like a function describes what to do with the arguments.
[QUOTE=Darwin226;44486659]How is a frame different from an "instruction"? It describes how the data inside of it is interpreted just like a function describes what to do with the arguments.[/QUOTE] It doesn't describe how it's interpreted, it annotates it. What those annotations mean or do depends entirely on the parser that reads it and the CSS rules active at the time. For example, <em> is not an instruction, but an indicator that the contained data should be emphasised somehow. Browser A may make it italic while browser B reads it to the user in a different voice and browser C ignores it because it implements an older standard of HTML and doesn't know what em is. Equally I could make a bit of CSS that causes browser A to render <em> tags as bold green on my website, even though it normally uses italic black.
That's really no different from any other programming languages. They all require an external program to interpret their various semantics. If you had a programming language with a command "shutdown" that turned off the computer, that command would have to be interpreted differently depending on the platform the program is running on. You don't care how it does it, you just care about a specific aspect of it. Just like you only care that <em> emphasizes stuff. As for CSS, would you also say that a language with macros isn't a language anymore? Plenty of languages have preprocesors that can completely change the meaning of code. A programming language is just a set of descriptions that you give to the interpreter that tells it what you want it to do. I don't think you can really add anything more to it.
[QUOTE=Darwin226;44487439]If you had a programming language with a command "shutdown" that turned off the computer, that command would have to be interpreted differently depending on the platform the program is running on. You don't care how it does it, you just care about a specific aspect of it. Just like you only care that <em> emphasizes stuff.[/QUOTE] This isn't about making things work cross-platform, whether the platform is an operating system or browser. The <strong> tag in HTML is [i]not[/i] an instruction or command like "shutdown" or "print hello" in pseudocode, as it does not directly cause an action to occur. It simply [i]declares[/i] that the content within it should be drawn in heavier letters. When the browser encounters a <strong> tag, it does not immediately evaluate it like a command. The object responsible for rendering the letters simply gains the knowledge that they should be drawn bold. The same thing goes for CSS selectors and attributes. The browser doesn't do anything when parsing CSS other than to set up a mapping of selectors and attributes which should be applied to elements matching a selector. CSS statements are not "evaluated" or "run", but are simply treated as knowledge about how certain elements need to be formatted. In other words: It's not the stylesheet's responsibility to format the document. Other objects fulfill this purpose. For instance, one object would be responsible for collecting every element's list of computed attributes, which is composed of attributes from matching selectors in the CSS stylesheets as well as predefined attributes for this element from the browser. (That's what you see [url=https://mdn.mozillademos.org/files/5665/inspector-css-computed-show-rule.png]here[/url].) Running actual program code, whether it's some simple BASIC dialect or Haskell, is a completely different and far more complex process.
[QUOTE=Alternative Account;44491977]The <strong> tag in HTML is [i]not[/i] an instruction or command like "shutdown" or "print hello" in pseudocode, as it does not directly cause an action to occur. It simply [i]declares[/i] that the content within it should be drawn in heavier letters. When the browser encounters a <strong> tag, it does not immediately evaluate it like a command. The object responsible for rendering the letters simply gains the knowledge that they should be drawn bold. The same thing goes for CSS selectors and attributes. The browser doesn't do anything when parsing CSS other than to set up a mapping of selectors and attributes which should be applied to elements matching a selector. CSS statements are not "evaluated" or "run", but are simply treated as knowledge about how certain elements need to be formatted. In other words: It's not the stylesheet's responsibility to format the document. Other objects fulfill this purpose. For instance, one object would be responsible for collecting every element's list of computed attributes, which is composed of attributes from matching selectors in the CSS stylesheets as well as predefined attributes for this element from the browser. (That's what you see [url=https://mdn.mozillademos.org/files/5665/inspector-css-computed-show-rule.png]here[/url].) Running actual program code, whether it's some simple BASIC dialect or Haskell, is a completely different and far more complex process.[/QUOTE] Are you're getting at that declarative languages aren't programming languages?
[QUOTE=Jookia;44492171]Are you're getting at that declarative languages aren't programming languages?[/QUOTE] I said "declares" once. That doesn't mean that I'm getting at that, nor that I agree with that position.
[QUOTE=Alternative Account;44492881]I said "declares" once. That doesn't mean that I'm getting at that, nor that I agree with that position.[/QUOTE] I'm not sure what to make of your post, that's all. Are you saying that because HTML isn't an imperative language it's not a programming language? I'm sincerely confused.
My personal metric for determining if something is a "programming language" is if it has the ability to perform conditional branches. If it can't branch, like HTML or CSS cannot, then I do not consider it a programming language. If it can, then I consider it one. The distinction between "programming" and "scripting" languages is a bit more ambiguous, though, for me. I think my current metric is compiledness - if the source compiles to something else (bytecode or other), then its a programming language; if the source is directly interpreted, then I consider it a scripting language. That's how I, personally, make the distinctions. :v:.
[QUOTE=Gmod3ever;44493865]If it can't branch, like HTML or CSS cannot, then I do not consider it a programming language. If it can, then I consider it one.[/QUOTE] CSS3 has 'nth-element' properties, HTML has <noscript>. I feel that's conditional branching.
[QUOTE=Jookia;44493897]CSS3 has 'nth-element' properties, HTML has <noscript>. I feel that's conditional branching.[/QUOTE] <script> operations are not an element of HTML. <script> uses Javascript, which [b]is[/b] a programming language. <noscript> is not a conditional branch. Or, rather, it is not a [b]generic[/b] conditional branch; you cannot declare your own condition for which it executes. nth-child is also not a generic conditional branch. It is a selector. You cannot do any operation of the form "if <expr> then <operation>" with the nth-child operation. You only perform operations to things that pass the nth-child filter. I suppose I should have clarified that I meant [b]generic[/b] conditional branches, where the antecedent can be any arbitrary boolean expression, and the consequent can be any arbitrary combination of operations on any arbitrary data-structures.
[QUOTE=Gmod4ever;44494015]<script> operations are not an element of HTML. <script> uses Javascript, which [b]is[/b] a programming language.[/QUOTE] Yes. [QUOTE=Gmod4ever;44494015]<noscript> is not a conditional branch. Or, rather, it is not a [b]generic[/b] conditional branch; you cannot declare your own condition for which it executes.[/QUOTE] Generic conditional branches don't make sense in HTML, there's no input. [QUOTE=Gmod4ever;44494015]nth-child is also not a generic conditional branch. It is a selector. You cannot do any operation of the form "if <expr> then <operation>" with the nth-child operation. You only perform operations to things that pass the nth-child filter.[/QUOTE] "if (is 5th child) then (set to bold)" [QUOTE=Gmod4ever;44494015]I suppose I should have clarified that I meant [b]generic[/b] conditional branches, where the antecedent can be any arbitrary boolean expression, and the consequent can be any arbitrary combination of operations on any arbitrary data-structures.[/QUOTE] Then yeah, of course HTML can't do that. But I don't see how it's any less of a programming language.
[url=http://lemire.me/blog/archives/2011/03/08/breaking-news-htmlcss-is-turing-complete/]HTML+CSS is turing complete[/url]
[QUOTE=Jookia;44494053] "if (is 5th child) then (set to bold)" Then yeah, of course HTML can't do that. But I don't see how it's any less of a programming language.[/QUOTE] For the first point, note I said I personally only consider [b]generic[/b] conditional branches, and explicitly excluded the fact that nth-child [b]only[/b] allows the consequent if the antecedent is of the form "is nth child," which is [b]not[/b] generic. If you can perform a conditional such as, "if the element contains the word 'banana' then set to bold", then (depending on the context, EG if there isn't some "element-contains-text" explicit control) I would consider it a valid candidate for what I consider a programming language. For the second point, the entire point of those posts were to say that [b]is[/b] how I determine if something is a programming language. The argument you make here is akin to arguing that a circle can't be a square because it doesn't have exactly four sides with "well yeah it doesn't have exactly four sides but that doesn't mean it can't be a square." It completely contradicts the definition being used. :v: [editline]9th April 2014[/editline] [QUOTE=DrTaxi;44494205][url=http://lemire.me/blog/archives/2011/03/08/breaking-news-htmlcss-is-turing-complete/]HTML+CSS is turing complete[/url][/QUOTE] Interesting. I'd like to see some more exposition on this HTML5+CSS Turing completeness, personally. Mostly because I don't know much anything at all about Rule 110. :v:
[QUOTE=Gmod4ever;44494284]For the second point, the entire point of those posts were to say that [b]is[/b] how I determine if something is a programming language. The argument you make here is akin to arguing that a circle can't be a square because it doesn't have exactly four sides with "well yeah it doesn't have exactly four sides but that doesn't mean it can't be a square." It completely contradicts the definition being used. :v:[/QUOTE] I'm questioning why you think that it's a circle and not a square. In the end it's all used to make the computer do something based on the contents of the language, which is basically what programming is. Sure HTML doesn't have conditionals, but it's programming the computer to display something a certain way.
[QUOTE=Alternative Account;44491977]This isn't about making things work cross-platform, whether the platform is an operating system or browser. The <strong> tag in HTML is [i]not[/i] an instruction or command like "shutdown" or "print hello" in pseudocode, as it does not directly cause an action to occur. It simply [i]declares[/i] that the content within it should be drawn in heavier letters. When the browser encounters a <strong> tag, it does not immediately evaluate it like a command. The object responsible for rendering the letters simply gains the knowledge that they should be drawn bold. The same thing goes for CSS selectors and attributes. The browser doesn't do anything when parsing CSS other than to set up a mapping of selectors and attributes which should be applied to elements matching a selector. CSS statements are not "evaluated" or "run", but are simply treated as knowledge about how certain elements need to be formatted. In other words: It's not the stylesheet's responsibility to format the document. Other objects fulfill this purpose. For instance, one object would be responsible for collecting every element's list of computed attributes, which is composed of attributes from matching selectors in the CSS stylesheets as well as predefined attributes for this element from the browser. (That's what you see [url=https://mdn.mozillademos.org/files/5665/inspector-css-computed-show-rule.png]here[/url].) Running actual program code, whether it's some simple BASIC dialect or Haskell, is a completely different and far more complex process.[/QUOTE] I'm really having trouble seeing how complexity of a language determines if it's a programming language. I agree that these are all differences but I don't think that in any way implies it's not a programming language. Besides, what you described has a pretty strong parallel to lazy evaluation, yet nobody questions that Haskell is a programming language. I imagine people argued the same thing about C when everyone was working in asm. "This isn't a language because you don't explicitly say which instruction you want to use. You're just saying you want a loop"
[QUOTE=DrTaxi;44494205][url=http://lemire.me/blog/archives/2011/03/08/breaking-news-htmlcss-is-turing-complete/]HTML+CSS is turing complete[/url][/QUOTE] That doesn't make it a programming language, though. [URL="http://boingboing.net/2012/09/12/magic-the-gathering.html"]Magic: The Gathering[/URL] is Turing-complete. It doesn't matter the features; it matters what the purpose of the language is. Wikitext - Wikipedia's templating engine - [URL="https://web.archive.org/web/20130101055126/http://mentalpolyphonics.com/posts/wikimedia-proves-greenspuns-tenth-law"]is theoretically Turing-complete[/URL]. Does that mean we should start referring to it as a programming language? Of course not, it's a templating language. Calling HTML and CSS a programming language only ends in confusion. If your enthusiasm for learning programming is so low that it's ruined by finding out that HTML + CSS aren't programming languages, you probably weren't that enthusiastic to learn it in the first place.
[QUOTE=supersnail11;44495461]That doesn't make it a programming language, though. [URL="http://boingboing.net/2012/09/12/magic-the-gathering.html"]Magic: The Gathering[/URL] is Turing-complete. It doesn't matter the features; it matters what the purpose of the language is. Wikitext - Wikipedia's templating engine - [URL="https://web.archive.org/web/20130101055126/http://mentalpolyphonics.com/posts/wikimedia-proves-greenspuns-tenth-law"]is theoretically Turing-complete[/URL]. Does that mean we should start referring to it as a programming language? Of course not, it's a templating language. Calling HTML and CSS a programming language only ends in confusion. If your enthusiasm for learning programming is so low that it's ruined by finding out that HTML + CSS aren't programming languages, you probably weren't that enthusiastic to learn it in the first place.[/QUOTE] The purpose is to tell the computer what you want it to do. All of those fit the description. Your partition into programming languages and markup languages is as arbitrary as any other and has nothing to do with this subject. You're basically claiming that a banana isn't a fruit because it isn't sour like the other fruits.
[QUOTE=Darwin226;44495552][B]The purpose is to tell the computer what you want it to do. All of those fit the description. [/B]Your partition into programming languages and markup languages is as arbitrary as any other and has nothing to do with this subject. You're basically claiming that a banana isn't a fruit because it isn't sour like the other fruits.[/QUOTE] HTML/CSS doesn't tell the computer what to do, it tells the browser what to show and how to show it. -oops double post-
[QUOTE=ZestyLemons;44495905]HTML/CSS doesn't tell the computer what to do, it tells the browser what to show and how to show it. -oops double post-[/QUOTE] What? It tells the browser what to show and the browser tells the computer what to do. Are scripting languages now also not programming languages? [editline]9th April 2014[/editline] Neither determinism, procedurality nor Turing-completeness are defining characteristics of a programming language, those are just properties that a language CAN have.
[QUOTE=Darwin226;44495552]The purpose is to tell the computer what you want it to do. All of those fit the description. Your partition into programming languages and markup languages is as arbitrary as any other and has nothing to do with this subject. You're basically claiming that a banana isn't a fruit because it isn't sour like the other fruits.[/QUOTE] Not really, the markup languages describe information more than processes, they are designed to carry machine readable semantics. Programming languages are designed to describe processes/programs that transform information and are often subpar at containing it. You can write a program in HTML/CSS, but it's prohibitively cumbersome. You can describe a full web page in C++ without embedding HTML, but it's for more annoying than necessary (barring preprocessor/template hacks).
Sorry, you need to Log In to post a reply to this thread.