At XDC 2019 Paul Lefebvre and Travis Hill did a session on API 2.0. For those not familiar with API 2.0 it’s the result of the best parts of the Xojo Framework getting merged back into the global framework without the heavy use of the Text and Auto datatypes.
The first version of Xojo (AKA REALbasic) was in 1998. Supported Mac 8. Now in 2019 MacOS, Linux, Windows, iOS, Web, Raspberry Pi and soon to be Android.
The goals of API 2.0:
Utilities language improvements. In 1998 no shared methods and other features available now.
Improve Consistency. Naming was often based on specific OS things that don’t exist before.
Exceptions, not Error Codes. Error codes get ignored – Exceptions are now.
More Enumerations. Constants lead to enforcement issues.
Similar API for Controls
But overall, don’t want to change what works. The global framework has worked great for many years.
Large portion of API 2.0 will be rolled out soon. “All” from Geoff’s keynote may not be accurate
When it happens they’ll be deprecated – NOT removed. It’ll be there for many many years.
Stop using in documentation and code examples.
API 2.0 Benefits
Code is more readable.
Easier for new users to learn. Most consistent for existing users.
Easier for all when working across project types.
Notable New Features
URLConnection. New in 2018 R4. Added Synchronous to the Asynchronous option. Uses OS API’s.
Var and ResizeTo. Synonyms for Dim and Redim. Var is better term and used in other languages.
Exception Handling. No longer uses error checking. Works on Connect, ExcecuteSQL, SelectSQL.
DatabaseField -> DatabaseColumn
Recordset -> RowSet
Binding is now embedded in the SelectSQL. Infers the BindType from the DataType.
Open methods moved to more appropriate classes (OpenAsMovie, OpenAsSound, OpenAsVector)
Item -> Child
ListCount -> RowCount
ListINdex -> SelectedIndex
Cell -> CellValueAt
DeleteAllRows -> RemoveAllRows
RemoveRow -> RemoveRowAt
ColumnFromXY -> ColumnAtPoint
Header -> HeaderAt
ToString/FromString on Date and numeric types
String.BeginsWith, EndWith, IndexOf. All methods will be zero based.
Date intervals and time zones
Random is now a singleton class.
Point, Size, Rect no longer need the “Realbasic” prefix.
Desktop is first. Then Web 2.0 and then mobile (first with Android then iOS).
You’ll be able to change code at your own pace. None of the existing methods are going away.
This is a one way move. The goal is to let older versions of the IDE still *open* API 2.0 projects. Obviously you’ll get compile errors then.
Will deprecated stuff will not show in AutoComplete. It’s doubtful if it will improve AutoComplete performance.