bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

Suggestion: add "?development" or make "?release" working #572

Open GWRon opened 2 years ago

GWRon commented 2 years ago

Hi,

I just got asked by a user who "recently" started with BlitzMax -- about the "?release" conditional. They assumed that it can be used to for "release" builds (so not developer builds - but also no "slow" debug builds).

So ... I thought "nah, for now this is the same as ?not debug" and had a closer look.

?release is not defined in BCC (but mentioned in the docs: https://blitzmax.org/docs/en/language/conditional_compiling/)

So I ask if either ?release could become a special build mode (by bmk then) which you add if you plan to "release" your project, or if there could be a new conditional added - like ?development which can be used to distinguish between an "inhouse" build and an "release" build.

Yes, you could always modify a piece of code which sets a "isDevBuild:int = True" or similar, but this requires file changes (which might trigger Backup systems, VCS observers or similar).

If that is not possibly: why is there ?release at all (not defined now - and if defined and acting like ?not debug it would be kind of a duplicate)?

What do I see of benefits from a ?release or ?development conditional?

SuperStrict
Framework Brl.StandardIO

?development  'or ?not release
Import "logger.with.inhouse.dependencies.bmx"
Import "developer.assets.and.functions.bmx"
?

You cannot use ?debug in all cases as certain code structures (like for loops with function calls) will lead to sluggish / slow code. So ?debug is only useful to test for "crashes" but not during normal development like "balancing" (which often requires "cheating", manual manipulation).

GWRon commented 2 years ago
SuperStrict
Framework Brl.StandardIO

?debug
Print "I am a debug build"
?Not debug
Print "I am NOT a debug build"
?

?Release
Print "I am a release build"
?Not Release
Print "I am NOT a release build"
?

?unknown
Print "unknown"
?Not unknown
Print "not unknown"
?

For now this prints

release:

Building untitled1
[ 10%] Processing:untitled1.bmx
[ 91%] Compiling:untitled1.bmx.console.release.linux.x64.c
[100%] Linking:untitled1
Executing:untitled1
I am NOT a debug build
not unknown

Process complete

debug:

Building untitled1
[ 10%] Processing:untitled1.bmx
[ 91%] Compiling:untitled1.bmx.console.debug.linux.x64.c
[100%] Linking:untitled1.debug
Executing:untitled1.debug
I am a debug build
not unknown

Process complete

So interestingly it somehow ... ignores ?release completely ?

Edit: maybe this is because of the "release" keyword? Yeah ... try it with "?throw" and it fails to print too.