In some of my formulas I didn't put in a version parameter and I want to change the formula without breaking old fractals.

If I had included something like

    int param version
    caption = "Version"
    default = 240330
    visible = @version < 240330
    endparam

then I could have used code like

    if @version <= 240330
        ; old stuff
    else
        ; new stuff
    endif

but I didn't define @version. Is there any way to code around this?

In some of my formulas I didn&#039;t put in a version parameter and I want to change the formula without breaking old fractals. If I had included something like ```` int param version caption = &quot;Version&quot; default = 240330 visible = @version &lt; 240330 endparam ```` then I could have used code like ```` if @version &lt;= 240330 ; old stuff else ; new stuff endif ```` but I didn&#039;t define @version. Is there any way to code around this?
 
0
reply

I've always thought that a version parameter is also not the ideal way to deal with backwards compatibility. In my mind, the best way to do this is add an enumerated parameter, e.g. Mode, with settings like "Compatibility" and "New". The default is Compatibility, and when the user sets it to New, the behavior can change and new parameters can appear.

The only disadvantage with this system is that formulas always start with the old behavior, and you might want to default them to the new behavior instead to encourage this for new use. That however is not possible because that would cause old parameter sets to load incorrectly.

I&#039;ve always thought that a version parameter is also not the ideal way to deal with backwards compatibility. In my mind, the best way to do this is add an enumerated parameter, e.g. Mode, with settings like &quot;Compatibility&quot; and &quot;New&quot;. The default is Compatibility, and when the user sets it to New, the behavior can change and new parameters can appear. The only disadvantage with this system is that formulas always start with the old behavior, and you might want to default them to the new behavior instead to encourage this for new use. That however is not possible because that would cause old parameter sets to load incorrectly.

Ultra Fractal author

 
0
reply

Another way to deal with my problem with backward compatibility would be to allow $ifdef to refer to a parameter

$ifdef @version
    ; new stuff
$elseif
    ; old stuff
$endif

or

$ifdef @version
    ; new stuff
$endif
$ifndef @version
    ; old stuff
$endif

My current way, when I remember to include the version parameter is:

int param version
    caption = "Version"
    default = 250507
    visible = @version < 250507
endparam
heading
    text = "(Current is 250507.)"
    visible = @version < 250507
endheading

Then the user with a fractal using the old code will see the current version number, and can change to the new code by changing the parameter.

Another way to deal with my problem with backward compatibility would be to allow $ifdef to refer to a parameter ```` $ifdef @version ; new stuff $elseif ; old stuff $endif ```` or ```` $ifdef @version ; new stuff $endif $ifndef @version ; old stuff $endif ```` My current way, when I remember to include the version parameter is: ```` int param version caption = &quot;Version&quot; default = 250507 visible = @version &lt; 250507 endparam heading text = &quot;(Current is 250507.)&quot; visible = @version &lt; 250507 endheading ```` Then the user with a fractal using the old code will see the current version number, and can change to the new code by changing the parameter.
edited May 8 at 1:10 pm
 
0
reply

In the new code, the parameter would always be there so $ifdef is perhaps not the right way to test it.

What would also be possible, is to allow a parameter to have a different default value when loading a parameter set, than when selecting a new formula or resetting the parameters. But all this would only work in a new UF version.

In the new code, the parameter would always be there so $ifdef is perhaps not the right way to test it. What would also be possible, is to allow a parameter to have a different default value when loading a parameter set, than when selecting a new formula or resetting the parameters. But all this would only work in a new UF version.

Ultra Fractal author

 
0
reply
57
views
3
replies
2
followers
live preview
Enter at least 10 characters.
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft