Makes sense? - "current" as synonym for "currentTiddler" in core?

Me want some syntactic sugar, but actually it’d also make things more sensible:

currentTiddler does not actually necessarily refer to the current tiddler, but rather any “name” that happes to be in that variable, be it a tiddlers title or a field name or just any arbitrary value.

I wish we could just use current to refer to this variable - which we already do in e.g all[current]. Aesthetically I also find the long and camelCased currentTiddler an eyesore in otherwise pretty code.

So, would it make sense with a gh request asing for a sugary but also more sensible twin for that long camel!

That would create a huge “name clash

  • The word current (exactly as written here) is used 922 times in 441 files in the whole code-base (tiddlers + js-code)
  • The word current as a “partial” like in “currently” is used 303 times in 132 files.
  • The word currentTiddler is used 999 times in 478 different files in the whole TW code-base.

We will need to check every appearance of the word: current, in full or as a partial, in the current code base to check if it could be confused with the new meaning of the new variable “current”. Where necessary we need to change the wording there.

Since it does not make sense to have 2 names for 1 thing. For consistency we would need to globally rename currentTiddler to current (spoiler: which works surprisingly well)


For fun only – I did a global search and replace from currentTiddler to current for all js-code and all tiddlers.

Running tiddlywiki .\editions\tw5.com-server\ --listen actually worked for a short test.

But that’s not manageable:

  • It will immediately break every existing 3rd-party plugin.
  • It will invalidate all the existing examples posted at the GoogleGroup
  • It will invalidate all examples posted here at Talk.

Conclusion

Even if currentTiddler is somewhat wrong, it is the “standard name” for the most important variable in the whole system. I think we can not change it anymore.

Adding current as a second option is not manageable either since it is used 922 times already. IMO it would be “noise” instead of sugar.

Furthermore, unless we can safely assume that no one has ever used the word current as the name for a variable, this would be a backwards incompatible change that would risk breaking user content/wikitext.

So that sounds like it is only a matter of “hard work”. Yes, easy to say when one is not the one doing it but, still, that is what it is about.

  • The word current as a “partial” like in “currently” is used 303 times in 132 files.

The word c is a “partial” in even more places :wink:

Just looking at the end result and the arguments in my OP, I think it would be an improvement if it was globally exchanged and we kept them as synonyms so to not break 3rd-party plugins, etc.