Future deprecation of formulas

Hello @jean-emmanuel !

I was thinking about this deprecation is the future, and in fact, the #{} syntax has two benefits:

  • more compact than JS{{}}
  • implicit return value

The latter one is very useful for some cases, for instance if I put in a label:

#{
nb=1;
}
song_number_#{nb}

I can do:
song_nb_JS{{var nb=1; return nb;}}, it works (curiously), but this is far less easy to read…

Would it be possible to have a shortcut for JS{{}} with implicit return value? like @() for instance?

Also, I noticed that this doesn’t work as expected:

JS{{return "aa";}}
JS{{return 1;}}

I would expect a computed value of aa1 or aa\n1, but is seems the value does not evaluate correctly.

are you deprecating formulas to get rid of MathJS dependency?
I totally understand this, but JS{{}} syntax doesn’t yet have all the features of formulas

Please tell us what you think
Thx

Hi,
The next version will be a major release (v1) with many breaking changes which I plan to describe soon in the blog section. Sessions created with the 0.xx versions won’t work with v1. You could almost see it as a different software.
Regarding your question, MathJS will be entirely removed, but

  • #{} syntax will be reused as a shorhand version of JS{{}} with implicit return*
  • the first issue you mention (variable persistence) will be addressed with a local variable storage for each widget*
  • the second issue is a bug :wink:

* This is subject to change as I’m currently working on something else.

wow v1! great!

I fear the breaking changes, but if it’s for good… :wink: