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

Re: One-based indexes in XPath

Subject: Re: One-based indexes in XPath
From: "Colin Adams" <colinpauladams@xxxxxxxxxxxxxx>
Date: Tue, 20 May 2008 18:13:51 +0100
Re:  One-based indexes in XPath
2008/5/20 Justin Johansson <procode@xxxxxxxxxxx>:
> In response to my question, thanks Colin for being the first devil's
> advocate for 1-based indexes.

I'm not a devil's advocate. 1-based indexing is the only correct
approach to software engineering.

> Possibly I am wrong about 0 being the norm.  Please enlighten me.  I was
> only going on ubiqitous languages like C++, C#, Java & Javascript.

They aren't modern though.

> Would you also please justify your claim " It is a very poor choice".

0-based indexing is a frequent source of bugs, due to the mismatch in
language that now enters the mental thought process.

The first element is numbered 0. It should be numbered 1, because that
is the meaning of 1 in an ordinal context - the first item, not the
second.

> Sure we can skip the first memory cell in $0.02 per meg RAM; but why is 0
> poor wrt 1?  What's wrong with -1 then?

Even worse. Now 1 would refer to the third element.

It''s just obscurantism - a hangover from assembler-programming days.

Current Thread

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
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.