Known Limitations Of PlayBASIC



I N D E X:






Enforced Limits of PlayBASIC DEMO / Learning Editions


* No Exe Creation
* Runtime Media Limits


      Note: Limits are subject to change at any time.




Open Screens - Clearing Previously Loaded Images


      It's not recommended you load Video IMAGES (see LoadImage) before using OpenScreen to set the display mode you want. As the OpenScreen commands can destory any previously loaded images in video format.




For/Next Loops and dynamic end variables


      FOR NEXT loops only support dynamic END variable for explicit local 0r global variables, expressions/arrays/functions are all protected by the loop structure, so changing their value will NOT alter the loop length..

I.e. Meaning this is not possible

  
  
; Dimension integer array
  Dim Counter(1)
  
; set the value at index 1 to 50
  Counter(1)=50
  
; The loop structure will pull the value
; from Counter(1) once.  So it computes the end
; value and then never, runs that expression again.
  For lp=0 To Counter(1)
     
   ; here we're changing what we think is the END
   ; of the for loop, but the looping structure never reads
   ; the Counter(1) value again, rather it's held in a temp
     
     
     If LP>25 Then Counter(1)=lp
     
   ; display the Loop counter
     Print LP
  Next
  






#IF / #ENDIF Directives and Functions / Psubs


      The PlayBASIC compiler is multi pass compiler by design. The process consists of three main passes over the source code, the first pass is a quick pre-screen skimming pass to find and prototype function / psub and labels. The second pass actually parses your source code and generates the byte code, while the final pass applies patches any relocations required ready for final execution.

      This process is what allows us to seemingly call a function name or label prior it's declaration in the code, unlike say arrays which have a strict declare first then use policy. However since not everything is detected during Pass #1, this can create a catch 22 situation with #IF / #EndIF directives, since those directives are only detected during pass #2.

      Unfortunately what this means is that you place a #IF / #EndIf directive around say a Function or Psub in your code, this won't work as you might expect. What happens is pass#1 skims the source looking for function/psub declarations. When it finds one, it gets it's name and the input parameters it has, the problem is that it doesn't parse directives, so the parser will ignore any directives during this pass completely.

      Meaning the following isn't possible in current editions of PlayBASIC

  
  Constant  Include_This_Function = no
  
  test(10)
  
  
  #IF Include_This_Function=yes
     
   ; Pass #1 will see this function regardless of the directive,
   ; since those are only processed during pass #2
     
Function TEst(YEah)
  
  
EndFunction
  
  #ENDIF
  
  






FUNCTIONS & PSUB CAN'T RETURN GLOBAL VARIABLES


      You can NOT return GLOBAL variables from a PSUB declartions. This is a catch 22 of a two pass compile process. As the Psub declartions are parsed during pass #1, but global variables don't exist until pass #2. So any variables following the ENDPSUB statement will be a LOCAL version of that variable and not it's global counterpart.





Functions - Local Arrays are not recusively local


      Arrays in Functions are _NOT_ local to the function call. This will only effect recursive function calls at this time.





Recursive function calls within For / Next loops


      The PlayBASIC runtime in V1.64N2 & V1.64N3 (and possibly newer versions) have altered the behavior of FOR/NEXT loops. While these changes make the looping structure execute faster, you can run into problems if recursively calling a function from inside a for/next loop. It's a pretty rare situation, but if you run into it, we recommend using a different looping structure at this time.





Array Passing - Run Time Errors:


      There is possible situation that may arise when a user want to redim arrays being passed to functions. If the re-dimed array has different number of dimensions,the interpreter ignores all checking current dimensions. This could possibly bring down the PlayBASIC runtime with an illegal memory access.. It's a very rare situation however, and protecting against it would mean every array access requires more screening. Something i'm not too keen on adding, given it'd make all array access slower.

i.e.

  
  Dim Table(100)
  Stuff Table()
  Dim Table(100,10)
  Stuff Table()
  
Function Stuff(mearray())
  Print myarray(1)
EndFunction
  




 
Related Info: AboutPB | Bugs | Credits | Functions&Psub | HelpFiles :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com