Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Extended BASIC+ Syntax

...


For Each Loops

For each loops offer a convenient way to walk through a dynamic array from beginning to end. If you have an @FM delimited array, you can do this:

...

Note that this syntax should only be used for the stored procedure's final Return statement, not for returning from a gosub. Anchorserviceservice


Service Modules

SRP has been a big advocate for organizing code into Service Modules: stored procedures in which the first parameter identifies a service to execute. Normally, this involves branching to gosubs, mapping the input variables, and making sure the stored procedure has enough parameters to cover all the services' needs. Here is a traditional example:

...

Moreover, the SRP Editor will autofill the event's parameters, saving you valuable time.

eventautofill

...

Unit Test Modules

Unit Test Modules are stored procedures containing multiple related tests.

...

This statement is key to making unit tests work. When the evaluation fails, the SRP Editor will display the two values side by side for easy comparison. Anchorunpackingunpacking


Unpacking

IMPORTANT: Unpacking was added in 2.1.1 and is not supported in prior versions.

...

This syntax is useful for smaller arrays when readability is important to you. This is not useful for parsing large records.

NOTE: You can only unpack into individual variables, not into other arrays or matrices.

Caveats

The SRP PreCompiler will work in any BASIC+ editor, but there is an important caveat to using Enhanced BASIC+ in anything other than the SRP Editor. The SRP Editor recognizes the new syntax and highlights code accordingly whereas the builtin OI Editor will not. Everything will still compile and run, but it will a little harder to read. Moreover, some features of the PreCompiler, such as the metadata, won't impede your code, but you also won't get the most out of your development outside of the SRP Editor.

...

Lastly, if you are using SRP PreCompiler, it's best to avoid using variable names that match the keywords Service, Test, and Event. The SRP Precompiler will do it's best to avoid confusing variables with keywords, but it's not bulletproof. It's better to avoid using them at all if you can help it.