Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7206

Re: enhance an array's static type by a lower length-bound.

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: enhance an array's static type by a lower length-bound.
Date 2011-08-17 23:17 -0700
Organization http://groups.google.com
Message-ID <4c11ff9c-3c83-45cc-85a7-9b0c05de17ff@glegroupsg2000goo.googlegroups.com> (permalink)
References <slrnj4nm33.6gl.avl@gamma.logic.tuwien.ac.at> <6k7p47d9442mcld6j2p5l4hekodard6oss@4ax.com>

Show all headers | View raw


Roedy Green wrote:
> I used Pascal before I used Java.  The one advantage of Java 0-based
> arrays is you KNOW what the base is without having to check.
> 
> It takes a bit of a mental shift, but eventually you always think
> iteration starting at 0, just as when you were a kid, you would not
> start counting at anything but 1.

+1

FWIW

There are times when some sort of variable indexing scheme could be useful for arrays, but in Java's case they opted for simplicity, as has been mentioned in this thread.  Arrays are not the be-all and end-all, though - you can get the effects wanted with associative arrays, i.e., Maps.  Thus you will gain generics (and lose reified type), heritability, flexibility (and lose notational convenience) and sparseness.  You can recapture some of those things (e.g., notational convenience) by switching to a different JVM language that supports, e.g., bracket notation for maps.

Some of the complaints about Java can be mitigated (and ever more so) by the growing number of languages that run on the JVM. It doesn't pay for a programmer to get too locked in to any one language, but a single portable and evolving platform such as the JVM can really empower us.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-17 15:04 +0000
  Re: enhance an array's static type by a lower length-bound. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-17 12:34 -0500
    Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-18 13:14 +0000
      Re: enhance an array's static type by a lower length-bound. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-18 10:30 -0500
        Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-18 18:12 +0000
          Re: enhance an array's static type by a lower length-bound. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-08-18 20:59 -0500
  Re: enhance an array's static type by a lower length-bound. Robert Klemme <shortcutter@googlemail.com> - 2011-08-17 20:42 +0200
    Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-18 21:44 +0000
      Re: enhance an array's static type by a lower length-bound. Robert Klemme <shortcutter@googlemail.com> - 2011-08-19 13:24 +0200
        Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-20 17:20 +0000
  Re: enhance an array's static type by a lower length-bound. Roedy Green <see_website@mindprod.com.invalid> - 2011-08-17 22:11 -0700
    Re: enhance an array's static type by a lower length-bound. Lew <lewbloch@gmail.com> - 2011-08-17 23:17 -0700
      Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-18 10:41 +0000
        Re: enhance an array's static type by a lower length-bound. Patricia Shanahan <pats@acm.org> - 2011-08-18 06:34 -0700
          Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-18 18:08 +0000
            Re: enhance an array's static type by a lower length-bound. Roedy Green <see_website@mindprod.com.invalid> - 2011-08-18 17:53 -0700
              Re: enhance an array's static type by a lower length-bound. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-20 17:31 +0000
                Re: enhance an array's static type by a lower length-bound. Lew <lewbloch@gmail.com> - 2011-08-20 10:50 -0700
                Re: enhance an array's static type by a lower length-bound. Robert Klemme <shortcutter@googlemail.com> - 2011-08-21 10:47 +0200
          Re: enhance an array's static type by a lower length-bound. Michal Kleczek <kleku@poczta.onet.pl> - 2011-08-21 20:27 +0200

csiph-web