strong weak argument,strong weak type,weak typed languages,weak typed,strong type vs weak type,strong type weak type,strongly weakly typed programming languages,weak type programming languages,strong vs weak type programming,idiom strong weak, xml%%%strong weak argument - Re: Strong versus (weak

[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Strong versus (weak|runtime) typing


strong weak argument
There's been surprisingly little discussion of Sean's original question:

>Is the strong/weak/runtime typing argument over XML any different from
>that debate in programming languages.

I do think that this argument is different for XML. In programming 
languages, it is rare to argue whether integers should be allowed to exist 
in data, or whether the serialization should be considered the true form of 
the data. Most programming languages that allow complex structures also 
have fairly strong typing - though it may well be runtime typing rather 
than static typing.

Personally, I believe that XML documents contain a wide range of type 
information, from very loosely typed information without even a DTD, to 
rigidly structured data corresponding to relational data or objects. A 
language designed for processing XML needs to be able to deal with this 
fact gracefully, avoid imposing assumptions on what is allowed that 
conflict with what is actually found in the data, allow data to be managed 
without turning explicit casts into a common idiom, and allow the 
programmer to focus on the documents being processed and the task to be 
performed rather than the quirks of the type system.

Some people seem to feel that only weakly typed systems meet those 
requirements. I disagree. I think that a language whose type system matches 
exactly the types found in XML documents will be most graceful for 
processing XML. If the XML is governed only by a DTD or has no schema, the 
appropriate types are document, element, attribute, node, text node, 
processing instruction, comment, ID, IDREF, IDREFS, etc. A strongly typed 
language that does not support these types tends to get in the way, because 
it is a poor match for the data being processed. It insists on the wrong 
things.

If W3C XML Schema is used, then documents can also contain the kinds of 
types typically found in strongly typed programming languages, plus some 
types typically not found anywhere. Again, the most graceful type system 
for a programming language is the one that best matches the data being 
processed. And even in this case, the type system must be very flexible, 
because the output types may be quite different from the input types.

Strong typing is not synonymous with needing to write the names of types 
everywhere and do lots of explicit casts, though this is common in many 
strongly typed languages. Implicit typing allows a programming language to 
infer a type, assigning the correct type to a variable without requiring 
the programmer to write down the name of the type.

The ideal is to come up with a type system that catches errors early 
without imposing too much overhead on programmers. This is difficult and 
subtle, and you have to both look at it theoretically and by looking at 
lots and lots of examples. But I think that XML has become important enough 
to deserve such a type system.

Jonathan 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.