[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: RE: Declarative programming requires a different mindset
It seems to me that a declarative language describes where you want to be (output model) in relation (semantics) to where you are (input model) - but NOT the steps you might wish to take to get there (programming steps). So (X)HTML goes some way to describing output (browser behaviour) and how output might relate to input (in the 'tag' names at least - e.g. 'table' by its name invokes our common understanding of what a table will look like) and it certainly describes the input model (the (X)HTML markup itself). By the above tentative definition that makes it declarative. A programming language is more like a series of steps, many of which might in themselves, discretely, be declarative (they invoke definitions of input, output and the mapping between the two). Their sequencing takes them beyond declarative though. There are grey areas of course. When you pipe/chain XSLT, say, it starts to become a programmed sequence of steps, which in my view is no longer purely declarative. I think people tend to mix all these concepts together in their designing of languages. A query language tends to have some imperative aspects and some declarative aspects - even a purely declarative one will have, at least implicitly, the specification of where to put the result (which kinds of makes it like a single step in an imperative language). A statement like 'Y=X' can be put as an imperative 'copy X to Y'. When you put that as a query it might become 'what is X?' but there might be an implicit 'put the answer into (variable) Y'. Declaratively you might wrap X and Y in tags which mean that X is the input and Y is the output and the semantics of the tags means that there is straight mapping of the input to the output, e.g. <var name="Y"><copy-of>X</... It ceases to be declarative if you split it into two steps where you first say declaratively 'copy X' and secondly 'put the copy into Y' but if your semantics require that the first step be completed before the second step then it loses the declarative characteristics. If the semantics require that the second step be started 'as-if' the first step had been completed (logically) then it becomes more of a grey area, I think. e.g you could say that the step of 'put the copy into Y' has a prerequisite that 'X has been copied'. (Still seems to have lost its declarative characteristics.) --- Stephen D Green On 11 April 2010 13:31, Costello, Roger L. <costello@mitre.org> wrote: > Hi Folks, > > Thank you very much for your comments. I am assimilating them as fast as I can. > > With regard to my statement "XHTML is a declarative programming language" I must confess that I got the idea from the Wikipedia article on Declarative Programming [1]: > > > ------------------------------------------------------------------------------- > Domain-specific languages > > Some well-known examples of declarative domain specific languages (DSLs) include regular expressions, CSS, and a subset of SQL (SELECT queries, for example). DSLs have the advantage of being useful while not necessarily needing to be Turing-complete, which makes it easier for a language to be purely declarative. > > Many markup languages such as HTML, MXML, XAML, XSLT, SVG or other user interface markup languages are often declarative. HTML, for example, only describes what should appear on a webpage and doesn't specify the possible interactions with it. > ------------------------------------------------------------------------------- > > > Should the Wikipedia page be modified? > > /Roger > > > [1] http://en.wikipedia.org/wiki/Declarative_programming > > _______________________________________________________________________ > > XML-DEV is a publicly archived, unmoderated list hosted by OASIS > to support XML implementation and development. To minimize > spam in the archives, you must subscribe before posting. > > [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ > Or unsubscribe: xml-dev-unsubscribe@lists.xml.org > subscribe: xml-dev-subscribe@lists.xml.org > List archive: http://lists.xml.org/archives/xml-dev/ > List Guidelines: http://www.oasis-open.org/maillists/guidelines.php > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|