4D v16.3

SET ASSERT ENABLED

Home

 
4D v16.3
SET ASSERT ENABLED

SET ASSERT ENABLED 


 

SET ASSERT ENABLED ( assertions {; *} ) 
Parameter Type   Description
assertions  Boolean in True = enable assertions False = disable assertions
Operator in If omitted = command applies to all the processes (existing or created subsequently) If passed= command applies to current process only

The SET ASSERT ENABLED command can be used to disable or re-enable any assertions inserted into the 4D code of the application. For more information about assertions, please refer to the description of the ASSERT command.

By default, assertions added in the program are enabled in interpreted and compiled mode. This command is useful when you want to disable them since their evaluation can sometimes be costly in terms of execution time and you may also want them to be hidden from the final user of the application. Typically, the SET ASSERT ENABLED command could be used in the On Startup database method in order to enable or disable assertions according to whether the application is in "Test" mode or in "Production" mode. 

By default, the SET ASSERT ENABLED command affects all the processes of the application. To restrict the effect of the command to the current process only, you can pass the * parameter.

Please note that when assertions are disabled, expressions passed to ASSERT commands are no longer evaluated. The lines of code that call this command no longer have any effect on the operation of the application, neither in terms of behavior, nor in terms of performance.

Example  

Disabling assertions:

 SET ASSERT ENABLED(False)
 ASSERT(TestMethod) // TestMethod will not be called since assertions are disabled



See also 

ASSERT
Asserted
Get assert enabled

 
PROPERTIES 

Product: 4D
Theme: Interruptions
Number: 1131

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v12

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)