Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?

Subs parameters

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 01-22-2010, 11:51 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by mjcoon View Post
Yes, the relaxed implicit-variant treatment of local variables does not work for arrays. This is because all elements of the array have to have the same variant for the indexing mechanism to work
You are making it sound much more complicated than it really is, it is really very simple. Normal variables, both global and local are just string variables. Arrays of the type they are declared as or strings if no type is specified. Numeric operations are always performed on Doubles and variables and arrays are coerced to and from Doubles when required for arithmetic operations. Boolean values are represented as the strings "true" and "false".
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #12 (permalink)  
Old 01-22-2010, 02:59 PM
Junior Member
 
Join Date: Sep 2009
Posts: 18
Default

Quote:
Originally Posted by agraham View Post
You are making it sound much more complicated than it really is, it is really very simple. Normal variables, both global and local are just string variables. Arrays of the type they are declared as or strings if no type is specified. Numeric operations are always performed on Doubles and variables and arrays are coerced to and from Doubles when required for arithmetic operations. Boolean values are represented as the strings "true" and "false".
Do I understand it right that all the time I am using variable in program, Basic converts this variable from string "12345678.9876543" to value? If yes isn't it much time and processor consuming?
Reply With Quote
  #13 (permalink)  
Old 01-22-2010, 03:24 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Yes you understand it right and yes it takes up more CPU cycles during mathematical operations compared to using strongly typed variables but that is the price you pay for the simplicity and ease of use of a weakly typed language and in most applications, even on a device, this is usually not a problem as there are other things that dominate execution time - like the user for many interactive applications.

If you really need to do intensive mathematics in Basic4ppc you can declare one or more arrays or structs as Double and use their elements for numeric calculations. As all numeric operations are done as Doubles this avoids converting to and from string values. In an optimised compiled app this will give you a good speed boost over normal string based non-array variables. To avoid the overhead of the array access for each variable fetch and use non-array variables you could use my http://www.basic4ppc.com/forum/addit...html#post28926 library.

I believe Erel intends to introduce some form of type declaration for normal variables in some future release of Basic4ppc.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #14 (permalink)  
Old 01-22-2010, 03:38 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Quote:
I believe Erel intends to introduce some form of type declaration for normal variables in some future release of Basic4ppc.
Next version will include it.
You will be able to declare the type of all variables (including sub parameters).
The main types will be Number which is mapped to .Net Double, Integer which is mapped to Int32 and String (or undeclared).
__________________
Basic4android documentation
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing arrays to Subs. jesb4ppc Questions (Windows Mobile) 12 04-24-2009 10:05 AM
IDE subs list width klaus Beta Versions 1 09-28-2008 04:56 AM
How to use timer to clock speed of subs? Stellaferox Questions (Windows Mobile) 4 02-28-2008 08:07 AM
Passing references to tables to subs LineCutter Questions (Windows Mobile) 5 05-31-2007 09:27 PM


All times are GMT. The time now is 10:16 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0