Quotes

Are you quite sure that all those bells and whistles, all those wonderful facilities of your so called powerful programming languages, belong to the solution set rather than the problem set? (Edsger Dijkstra)

Part of the reason so many companies continue to develop software using variations of waterfall is the misconception that the analysis phase of waterfall completes the design and the rest of the process is just non-creative execution of programming skills. (Steven Gordon)

Quotes about Computer Languages

There are some good quotes there. This one is particularly relevant to me right now:

Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration. (Stan Kelly-Bootle)

So not to start a flame war or anything, but I need to decide on the array indexing start for my new Fabric language (AKA the new Formula Language). I'd prefer 0, since every other language I code in starts arrays at 0. But I want this language to be instantly productive for those who already know Formula language, which is 1 based. And until just now, I had never even considered 0.5.

Any thoughts welcome.

Posted December 10, 2005 12:08 PM

Comments

Why not -1?
Think of all the times you will be able to say, "Aw heck, I was off by -1"....

Bob Balaban, December 10, 2005 4:35 PM

Default it to 1, but allow it to be set as in Basic?

I'd like to see a Dictionary type and python-like slice operators for lists along with zip to make a dictionary from two lists. All iterable.

I'm working on some things that could use this kind of back end. Alpha any time soon?

Dan Sickles, December 10, 2005 6:42 PM

The best reason I know of for using 1 instead of 0 is 'last = a[a.len]' instead of 'last = a[a.len-1]'.

Pete Lyons, December 11, 2005 2:57 AM

If I had never programmed before, I would say 1 based makes a lot more sense. If you want to emulate Formula, then by all means, start it at 1. But I'm with you, all the languages I program in start arrays at 0, and I'm well used to that idea.

I don't like the idea of having a variable starting point, it's just asking for trouble. The nice thing about arrays is they have a standard access scheme. You can randomly access any member of the array between 0 (or 1) and length() (or length() -1). If they can start at different points, you have to do more work every time you want to access members. If one person forgets that they can start somewhere other than 0 (or 1), you can have a hard to diagnose memory access error.

Nate Finch, December 13, 2005 10:47 AM

Nate, I agree that variable array index starting points present dsome problesm. Just throwing out some ideas. Since I do most of my development, including much of my Notes development, in python, I have to vote for [0]. If the target audience really is @formula developers then [1].

Damien, any python or xpcom wrappers for the db? Non-rdbms local storage is getting hot.

Dan Sickles, December 14, 2005 1:43 AM

Thanks for asking! I absolutely have plans to create script wrappers for CouchDb, but that's some months away.

Working feverishly until then....

Damien, December 14, 2005 1:51 AM

Here's some of the recent heat around browser local storage. I'm doing a lot of xul stuff, including some xul over domino that could use a more scalable local storage than rdf/xml. A local rdbms would be great but a less structured db would be better for the stuff I'm doing. Yes there are some of out here waiting for a shot at couchdb....but no rush ;-)

http://wiki.mozilla.org/Mozilla2:Unified_Storage

http://www.redmonk.com/jgovernor/archives/001151.html

Dan Sickles, December 14, 2005 11:06 PM

Not everything in Formulas is 1-based. for instance, using @GetViewInfo uses a 0-based index to refrence columns.

I say use 0, cause it will be easier for non-Domino geeks.

Rock, December 22, 2005 11:21 AM

Post a comment




Remember Me?

(you may use HTML tags for style)