What are the features and benefits of API 2.0

Today I was asked, why was I still using API 1.0. I rattled off a bunch of reasons. At the end of it, I asked myself why would I use API 2.0?

So what I’d like to know, and from people who’re proficient in API 1.0, what do you like about API 2.0?

If you don’t have any positive advantages to API 2.0, then please don’t post 'em here. Maybe start a “What are the features and benefits of API 1.0” thread instead.

should all the indexs start from 0 now with API 2 ?
better for me than all the 1-based and 0-based mixture of API 1

The fact that you need to ask says volumes.

(ps- I don’t know for certain either, I believe so - but the fact that this has changed at all immediately makes me want to avoid migrating an API1 project to API2… how many obscure bugs will that introduce into a legacy app…?)
Obviously, starting a brand new project is a different matter.

1 Like

Except for String.NthField which always confuses me.

1 Like

Don’t confuse API 2 with Web 2. New controls and responsive feature is part of Web 2.
No idea whether new APIs are faster.

it’s only because I don’t use api 2 so I read that, and think it’s a benefice

  1. Consistent 0-based indexes. Makes porting code from other languages easier

That’s it as far as I can tell.

1 Like

Same, but with a little more readability.

  • Confusing arrays with rows because inexperienced Excel users are so much more important than experience Xojo users.
  • New DateTime with less options to shoot yourself in the foot. But requiring more time to replace from Date.
  • Replacing errors with exceptions which doesn’t make much sense to me.
  • Replacing function(argument) with argument.function. But not in all cases.

Good one, consistency (currently not complete)… for example in Web 2.0 we have WebControl.Style… (this is a class for styling).
But on WebToolbarButton we also have a .Style but this is an enumeration for WebToolbarButton.ButtonStyles… Which seems inconsistent…

But I can finally make Windows and Mac show the same date(time) strings in a table. Before, the results did not always match fully, at least not for a localized system.

So you are asking yourself why you’d use it but only want to here positive reasons… might as well just go and use it then…

1 Like

Thanks Christian. I overlooked just now while answering in haste. :sweat_smile:

I think the gol was trying to enhance the consistency and modernizing the language, We should do whatever.method() instead of function(whatever), so we could write modern and readable chains like

Var myval = mydata.Trim().Left(10).Upper()

Instead of the reverse notation

Dim mystr As String = Upper(Left(Trim(mydata), 10)

Zero based consistency should be another plus.

Don’t know if we reached proper zero based consistency and we still don’t have all sets of what we need for proper chaining, e.g. we don’t have (literal or expression).method(), so today we still need to write mixed content as

Var mastercode As String = MyCode("My key String").Upper()

Instead of

Var mastercode As String = "My key String".Encoded().Upper()


Var mastercode As String = ("My key String"+saltVar).Encoded().Upper()
1 Like

I have no intention to move my big applications to API 2.00. If it ain’t broke, don’t fix it.

However, for new projects, API 2.00 can be fun to use.