Ask the Expert

What about comparing the merits of Python and Water?

Your answer concerning Water isn't very satisfactory: being a Python fan, you don't like it. The question is not so much whether or not you like it, but rather how you judge Water's potential. BTW, I don't think it has a lot to do with SGML derivatives. What about comparing the merits of Python and Water?

    Requires Free Membership to View

I'm biased of course. My position is that XML is a truly awful syntax to express an imperative programming language in. As soon as you reach the point where you need to express imperative constructs (conditional expressions, loops, selections and so on) the syntax gets in the way. A sign of a good programming langauge, I think, is one in which the syntax does not get in the way, letting the programmer concentrate on what the program is supposed to do.

Here is an example (http://lists.xml.org/archives/xml-dev/200301/msg00406.html)

<!-- Water version of Factorial Function -->
<defmethod factorial n>
         <if> n.<is 1/> 1
         else n.<times <factorial n.<minus 1/> /> />
         </if>
</defmethod>

<test <factorial 10/> 3628800 />
# Python version of Factorial Function
def factorial (n):
         if n == 1:
                 return 1
         else:
                 return n * factorial(n-1)

factorial (10)
I think the comparison speaks for itself!

This was first published in August 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: