Xojo Stepped in it

There are things where counts (1 based) make more sense logically and are more intuitive, and there are cases where indexes (0 based) make the most sense and are most intuitive.

API 1 made that distinction which IMO is the correct thing to do, but unfortunately was not always consistent about doing so… which is what caused the confusion that existed…

IMO, instead of dealing with the core issue (a few inconsistencies) they threw the baby out with the bath water. Everything being 0 based does make everything more intuitive and it makes converting old code a LOT trickier than it had to be.

Off by one errors are IMO one of the hardest to see and find because overall the code “looks” right.

That combined with inevitable little bugs in the API 2 implementation that will keep being found, make things a pain for some (many?) long term customers.

-Karen

Not sure I understand
If you are aware that API2 is 0 based then how if and when you update API 1 code make everything trickier?

3 Likes

Yeah I’m not sure either. API1 was zero based as well. The only things that changed were things like InStr to IndexOf. And since Indexes are zero based that makes sense to me.

1 Like

The hard part is knowing which parts of the language use “IndexOf” - as far as I know, the online language reference can’t be globally searched for all instances of “IndexOf” to find those things that need changing.

If Xojo would make a conversion table that shows all of the old syntaxes next to the new, it would be much simpler to go down the list and, change by change, go through our code to find everything that needs modifying, in an organized way. IMHO, simply having that comparative list (which would not include things that haven’t changed) could go a long way towards cooling the heat around this subject.

I think the only thing it changed on is strings when InStr was eliminated in favor of IndexOf. And that makes sense. I don’t know if anything else that went from 1 to 0. Maybe I missed them?

I think most things were 0 based anyway API just fixed the few stragglers that were not
Not really sure if going from 1 based to 0 based would cause anyone to stress and give up on any project moving towards API 2

NumberedField or IndexedField may have been better namings

Right, Brian. I agree.

In general I don’t mind the API2 improvements. I think forcing us to use them in certain instances is not good (ie: mobile - but mobile never existed before API2 so maybe they have an excuse). My biggest issue is with all the different control names and the fact that everything is fragmented. I don’t like the fact that event names changed, etc. That I can live with. But the multitude of different controls we now have to contend with and the documentation headaches that follow are my biggest issues.

2 Likes

There are better names for a lot of things.

But please don’t suggest further name changes. We had enough of them the last 5 years.

19 Likes

Oh gosh no! While I don’t mind things like String.IndexOf instead of InStr (but hey - that was one of the first BASIC functions I learned in the 1980s…) and Integer.FromString instead of VAL, other things are necessary. VAR instead of DIM (which I continue to use), MessageBox instead of the much shorter MsgBox, etc. And Opening instead of Open and similar were frankly unnecessary.

3 Likes

I agree! When I first learned PHP, it was the user comments at the bottom of each page of the documentation that often taught me more than anything else.

6 Likes

Yes, this is a very useful feature of the PHP docs system and one that wpuld be very useful for Xojo docs too.

3 Likes

I was actually thinking of going one step further: letting volunteers update entries that need it. Xojo would probably want to limit that to certain people who apply to do so, as opposed to commentators being anyone with an account. And I’m sure Xojo would want to have final say over approving/publishing any changes. But I bet people would volunteer and it would get the documentation up to speed much sooner.

2 Likes

So like a wiki. Moderated crowd sourced knowledge. Hmm… could work.

I must be an API2 “antivaxer” because I too plan to stick with API1. I tried to upgrade a large project to API2 and after two days of solid work, gave up. But I wonder why you say API1 is useless? Am I missing something?

2 Likes

Took me more than two days, but it did converge, eventually.

Tim, I am currious how many errors were reported when you started out. I had over 3000 and at the rate I was going, it was going to take me two weeks.

Errors, or warnings? I had over 6000 warnings at first.

See my thread entitled API1 to API2 conversion experience

I had well over 9000 and it took month‘s. :slight_smile:

Xojo says it is no more updated. So any found bug set its use less…

Also, try to open your API1 project you work with Xojo 2021r3.1 with… 2019r1 for example… (or any non API2 Xojo, or Xojo 2021r1… I think).

In theory, you are correct, and with time (this year ?)…