locked
scope RRS feed

  • Question

  • I know that the global variable idea has been used in Small Basic to avoid beginners having to deal with scope; but, I wonder if perhaps some limited scope might be possible.  For example, suppose that all variables are global except for variables within functions.  Regular subroutines could continue with global variables.

    The benefits of this would be two-fold.  First, users could create actual reusable libraries of code that could be plugged into their programs without needing modifications.  Secondly, when and if users do move on from Small Basic to another programming language (such as Visual Basic), they will need to deal with scoping issues.  I wonder whether it is helping new users to entirely insulate them from scope considerations.

    Thursday, August 25, 2011 6:49 PM

Answers

  • The scope of SmallBasic is global as you say - there have been several discussions on this and no clear opinion consensus either way.  My preference is for global scope as it is, but others disagree.  This is a fixed rule, no detailed explanation of when, what, where variables may be available or change, especially for beginners who are just getting started with the idea of a variable containing a value that can be changed.

    When someone moves from SB they will have to deal with LOTS of things (scope is just one of the easier concepts that will hit them) - keeping the SB as simple as possible is important - concentrating on program logic, conditionals, loops, arrays and having fun!


    Thursday, August 25, 2011 7:43 PM

All replies

  • You used wrong thread type !

    And also i got no idea what you were explaining to do... the only thing i understand is that you want local, global variables.


    I love game design and programing.
    Thursday, August 25, 2011 6:55 PM
  • The scope of SmallBasic is global as you say - there have been several discussions on this and no clear opinion consensus either way.  My preference is for global scope as it is, but others disagree.  This is a fixed rule, no detailed explanation of when, what, where variables may be available or change, especially for beginners who are just getting started with the idea of a variable containing a value that can be changed.

    When someone moves from SB they will have to deal with LOTS of things (scope is just one of the easier concepts that will hit them) - keeping the SB as simple as possible is important - concentrating on program logic, conditionals, loops, arrays and having fun!


    Thursday, August 25, 2011 7:43 PM
  • The fun part was my issue for long this Small Basic turned it to the correct way =), but i got some hates on syntax like for loop which is just weird, but atleast not a shorter while loop so it is useful. (Stuff i hate is just being asked so don't mind this <.<)
    I love game design and game programing.
    Friday, August 26, 2011 12:43 AM
  • Scope inside Small Basic program is global and all subroutines (functions, voids) and variables are static and type for variables is Primitive.

    Best thing in Small Basic is that I don't have to worry about scopes, type conversations, error handling, object initialization, object disposing, code security, invoking native code and many other things.

    And if I have understated right target users of Small Basic are under 12 year old students and people who just wanna have fun with simple programming.

     


    Sorry My Bad English
    Saturday, August 27, 2011 7:47 PM
  • I would love more libraries <.< for the greater fun <.<... i don't have any idea what exactly that company guy's extension gives in total... it gives XML files stuff but i don't have a clue what those can do.
    I love game design and game programing.
    Sunday, August 28, 2011 9:35 AM
  • Small Basic extension is really a dll file and xml file that is documentation for dll.

    Both files go to [Small Basic Installation Directory]\lib\ ( C:\Program Files (x86)\Microsoft\Small Basic\lib or C:\Program Files\Microsoft\Small Basic\lib )

    Small Basic extensions doesn't really require installation but I use installer with Data Extension so it's sure that user has rights to install the extension, right version of small basic installed and .Net 3.5 SP1.


    Sorry My Bad English
    Sunday, August 28, 2011 10:20 AM
  • Don't really... know... wait your saying xml contains stuff for InteliSense ? Or just us ?
    I love game design and game programing.
    Sunday, August 28, 2011 11:19 AM
  • That is correct. InteliSense comes XML documentation.

    Sorry My Bad English
    Sunday, August 28, 2011 6:27 PM