Basic4ppc v6.90 beta (6.85)

Erel

B4X founder
Staff member
Licensed User
Longtime User
The documentation of the new version is not ready yet, so I will use this thread to explain the new features.

- Regular variables can be declared with a specific data type.
Unlike previous versions where regular variables (not arrays / structures) were always stored with the default data type (string), and converted to number as required, it is now possible to declare regular variables with the Dim keyword and specify their data type. Both local and global variables.

The two main data types are String which is the default and Number. Number is a syntactic sugar and actually maps to .Net double.

Using Number variables in numeric calculations is much (10x) more efficient than using untyped variables or strings.
Note that you will only see the performance improvement in the compiled application.

Usage example:
B4X:
Sub SomeSub
 Dim x As Number
 x = 234
 msgbox (x * 2)
End Sub
You can also use the other data types that are already available for Arrays (and Number can be used with Arrays as well).

Another new data type name is Integer which maps to Int32. Note that currently Number (or double) will yield the best performance.

- Subs declaration - It is also possible to declare the type of subs parameters and return type.
- Passing variables by reference - Variables can be passed by reference which can used to return more than one result from a sub.
So the Sub declaration syntax is:
B4X:
[Public | Private] Sub SubName [([ByVal | ByRef] parameter [As Datatype], ...)][As DataType]
ByVal which stands for passing a variable by value is the default behavior.

See this link for more information about passing by value vs passing by reference: Evaluation strategy - Wikipedia, the free encyclopedia

Note that it is still not possible to pass or return arrays and structures.
This feature was initially planned but it will not be ready for this version.

Correctly typing your variables can significantly boost the performance of numeric calculations.

- Better support for dynamic controls and objects.

A new set of keywords for handling dynamic controls and objects is now available.
The new set of keywords can be used as a replacement for the Control keyword.
You can now write the control (or object) type followed by the specific control name as string and then the property or method.
Easier to explain with an example:
B4X:
 i = 1
 Control ("Form" & i, Form).Circle(...) 'old syntax
 Form ("Form"& i).Circle (...) 'new syntax
The main advantage of the new syntax is that it is recognized by the IDE. Therefore when you type '.' you will get the list of properties and methods available for a Form (or any other control).

The same thing is true for objects:
B4X:
Control ("MyBList", bList).AddFromString(...) 'old syntax
bList ("MyBList").AddFromString(...) 'new syntax
Note that the old syntax is still supported.

- Scroll bar indicators - This feature is an improvement in the desktop IDE that is more useful than it may seem at first look.
In previous versions when you selected a word in the IDE (like a variable name), all occurrences of this word were highlighted in the editor. The new feature is that now in addition to the highlighting the vertical scroll bar will be marked with small indicators that indicate the positions which you should scroll to in order to find all the occurrences.
This can be very handy if you want to immediately see where in the code some variable or control is used.

The scroll bar indicators will also show for breakpoints, current debugging line and bookmarks.

- Other improvements include more accurate error messages and bug fixes.

The final version will include some additional minor improvements and bug fixes.

- Backwards compatibility issues
* Up until now it was possible for an array to change its type in runtime. This feature was problematic and was not always handled correctly by the optimized compiler. Arrays can no longer change their types.
It is still possible to redeclare an array and change its size.

* The legacy compiler will not be available in the next version. The optimized compiler is significantly better than the legacy compiler and almost all devices available are supported by .Net CF 2.0.
Removing support for the legacy compiled makes it much more simpler to maintain and improve several core components of Basic4ppc (like the variables handling for example).
 

agraham

Expert
Licensed User
Longtime User
:icon_clap: Let me say that this is an awesome improvement for what looks like merely a 0.1 version increment, it really warrants a major version step to version 7.0. It might at first sight look complicated but once you've got your head around the changes the increase in performance and ease of use is wonderful.

I love the desktop IDE scrollbar indicators :cool:(I've been lucky to have had an early pre-beta preview version of this feature for several months now :) and it helps in locating references to variables etc. a lot). Those of you who have previously used typed arrays to gain an increase in arithmetic performance should notice an even larger increase in speed of calculation over previous versions.

You can look forward to another "trick up the sleeve" in the final release of this version involving improved support for one of my libraries. ;)
 

maXim

Active Member
Licensed User
Longtime User
:sign0060:
Great improvements!
:icon_clap:Thanks Erel
:icon_clap:
:wav:
 

sitajony

Active Member
Licensed User
Can I test me too? I'm very interested to see the last beta version :)
Anyway: Any chance to decrease the output executable at first compiling? Cos I noticed that even If there're no code source and I build a program it's a few too big and too slow to run... I don't know how it's maked but maybe some stuff can be removed or from the compilator check if a code is required and don't compil somes functions or others... else tamps, It's still a really great good soft ;)
 
Top