TW v5.3.0-pre: It is proposed to add $:/tags/Global for global procedures, functions, widgets, macros

This points are important. It should be add it. But I find it a bit confusing it when I use a new pragma but I have to reuse the old tag $:/tags/Macro. I like this proposal by @twMat (here):

IMHO, $:/tags/Global is perfect. These are a kind of variables, then we will reuse them as global variables with this tag.

However, Procedure Definitions does explicitly mention the $:/tags/Macro tag as a means of creating for creating global procedures.

I would like to have $:/tags/Global instead of $:/tags/Macro

3 Likes

$:/tags/global would need to co-exist with $:/tags/macro for compatibility reasons. I donā€™t see how the latter could ever be deprecated/removed.

AFAIU, ā€œdeprecatedā€ can mean to simply leave it working but not to really use it from now on. So $:/tags/Global could achieve all that $:/tags/Macro does but also more, and the latter tag is replaced in all places but it still works the way it has always worked.

2 Likes

An additional tag makes sence in so far as $:/tags/Macro is the legacy, in many cases these can be moved to $:/tags/Macro/View OR the suggested $:/tags/Global. Dont know?, use $:/tags/Macro, However also document along side the use of the import pragma to make such macros available in specific places without global definition.

Iā€™m OK with the proposal to have a $:/tags/Global too ā€¦ As long as it does not influence the performance because of the additional filters needed.

If we face a performance hit, we should stay with $:/tags/Macro only

Just my opinion

3 Likes

Of course, staying with $:/tags/Macro only causes a ā€œhit on comprehensibilityā€ to people learning TW, so I guess it should be weighted against this.

Anyway, is there a way to test/measure for a potential performance hit?

1 Like

The challenge with adding support for $:/tags/Global alongside $:/tags/Macro is that many of the TiddlyWiki core templates repeat this same code to import the global macros:

\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]

That line will need updating in each case to add a reference to $:/tags/Global. However, many users will have copied these templates to make their own custom templates. While we can update the core templates, the clones wonā€™t be automatically updated. So, if we go ahead and add support for $:/tags/Global then users will sometimes run into problems with macros not being available in certain situations.

Nonetheless, I think this is worth doing. We can mitigate the problems to some extent by ensuring that all core globals are tagged with both $:/tags/Macro and $:/tags/Global so that they are visible within templates using the old import filter.

Iā€™ve now added support for $:/tags/Global here:

I think there might still be quite a few docs updates needed.

8 Likes

Thank you Jeremy! In TW 5.3.0 $:/tags/Global is really a semantic tag. It shouts its meaning! For newcomers it is much easier to understand than the old tag, specially when it is used for procedures and functions!

Thank you!

3 Likes