I have a formula and want to add a new parameter to it without breaking past fractals. The formula has a version number in it, such as this declaration in the default section:

int param v_SFormula
caption = "Version (SFormula)"
default = 100
visible = @v_SFormula < 100
endparam

If the new version of the formula has "default = 101", how do I put in the new code without breaking the old code? I couldn't find any example in the help file, or in the (limited) search that I did in the public formulas.

I have a formula and want to add a new parameter to it without breaking past fractals. The formula has a version number in it, such as this declaration in the default section: int param v_SFormula caption = &quot;Version (SFormula)&quot; default = 100 visible = @v_SFormula &lt; 100 endparam If the new version of the formula has &quot;default = 101&quot;, how do I put in the new code without breaking the old code? I couldn&#039;t find any example in the help file, or in the (limited) search that I did in the public formulas.
 
0
reply

In general, changing defaults doesn't break continuity. I've done this a few times, tested it with old parameters and all is good. So I'd guess you just change

default = 100
visible = @v_SFormula < 100

to

default = 101
visible = @v_SFormula < 101

However, I've never used a version parameter and I'm not sure what it's for smile
Maybe there are other factors involved?

In general, changing defaults doesn&#039;t break continuity. I&#039;ve done this a few times, tested it with old parameters and all is good. So I&#039;d guess you just change default = 100 visible = @v_SFormula &lt; 100 to default = 101 visible = @v_SFormula &lt; 101 However, I&#039;ve never used a version parameter and I&#039;m not sure what it&#039;s for :) Maybe there are other factors involved?
 
0
reply

For an example, see Image Tiles in reb5.ucl in the public formulas.

For an example, see Image Tiles in reb5.ucl in the public formulas.
 
0
reply

While this use of a version parameter works, I think it isn't particularly user-friendly. If you're just adding a parameter to a formula, you can often set the default value such that it works the same as the previous version. In this case no further action is needed for backwards compatibility.

Sometimes you discover a bug in the original formula and you want to fix it. In this case I think it's best to add an enumerated parameter that sets the behavior, i.e. "Old buggy" and "New" or something like that. The problem with that is that you have to set the default value to "Old buggy" which looks bad. That's what a version parameter can solve, because it hides this in normal use.

Like Otto says, you can freely change default values for existing parameters.

Here are a few other tips on compatibility:
https://www.ultrafractal.com/help/writing/tips/publishingyourformulas.html

While this use of a version parameter works, I think it isn&#039;t particularly user-friendly. If you&#039;re just adding a parameter to a formula, you can often set the default value such that it works the same as the previous version. In this case no further action is needed for backwards compatibility. Sometimes you discover a bug in the original formula and you want to fix it. In this case I think it&#039;s best to add an enumerated parameter that sets the behavior, i.e. &quot;Old buggy&quot; and &quot;New&quot; or something like that. The problem with that is that you have to set the default value to &quot;Old buggy&quot; which looks bad. That&#039;s what a version parameter can solve, because it hides this in normal use. Like Otto says, you can freely change default values for existing parameters. Here are a few other tips on compatibility: https://www.ultrafractal.com/help/writing/tips/publishingyourformulas.html

Ultra Fractal author

edited Nov 15 '19 at 8:16 am
 
0
reply

This has been a helpful thread for me. I'm now adding a version parameter to new formulas, and have made use of it twice to remove minor but annoying bugs. Tested with old and new params, it works a treat. Thanks to physicist, rsidwell and Frederik!

This has been a helpful thread for me. I&#039;m now adding a version parameter to new formulas, and have made use of it twice to remove minor but annoying bugs. Tested with old and new params, it works a treat. Thanks to physicist, rsidwell and Frederik!
 
0
reply
203
views
4
replies
4
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