All,
You might be aware that we're planning for the 2.5 release to introduce
jQuery into the TiddlyWiki core.[1]
Today Martin, Phil and I were discussing whether we should use this
opportunity to improve the way plugins are handled in TiddlyWiki,
rectifying legacy issues and ensuring support for existing jQuery-plugins.
So here are our preliminary thoughts and conclusions - we'd very much
appreciate getting some feedback on this so we can get it right from the
start, thus avoiding painful changes later on:
* plugin indicator
It might be desirable to use a tag other than "systemConfig" to indicate
new-style/jQuery-aware plugins. (In fact, if the contract for such
plugins ends up being significantly different, this would be required to
ensure backwards compatibility.)
Also, I personally think the "systemConfig" tag is somewhat
inappropriate (semantically speaking), so I'd prefer something like
"systemExtension".
[undecided]
* evaluation scope
Currently, plugins are being evaluated in the global scope - this might
not be desirable (although we're struggling to explain why... ).
Ideally we'd also impose certain restrictions for security purposes.
However, that's more of an issue of the JavaScript language, so it's not
something TiddlyWiki should (or could) handle.
We're currently leaning towards establishing a convention of wrapping
plugins in an anonymous function (jQuery-style)[2], without actually
enforcing this though.
[undecided]
* namespace
Plugins should be attached to the jQuery namespace by default (this also
ensures jQuery plugins can be used directly; essential core components
that are implemented as generic jQuery-plugins would use a dedicated
sub-namespace like jQuery.tiddlywiki).
This probably renders the current namespace conventions[3] obsolete.
[undecided]
* exception handling
Currently exceptions within plugins are caught and then handled by the
PluginManager[4], which can make debugging somewhat difficult.
This is most likely the right thing to do from an end-user's
perspective. We might, however, provide an option for developers to
deactivate this (similar to chkDisplayInstrumentation).
[irrelevant]
* return values
Perhaps plugins' return values could be used in a meaningful way to
communicate with the plugin manager - we're not quite sure how yet, but
it's worth considering.
(As far as we can tell, jQuery plugins do not use return values in such
a way.)
[undecided]
* dependency handling
What's been discussed previously also applies here:
http://trac.tiddlywiki.org/ticket/632#comment:6
http://www.tiddlywiki.org/wiki/Dev:Best_Practices#Dependency_Handling
[irrelevant]
* access to plugin tiddler
In some cases it might be desirable for a plugin to know which tiddler
it originated from (as the tiddler name doesn't necessarily match that
of the plugin).[5]
It turns out that this is already possible, as plugins do have access to
the respective tiddler object.[6]
[irrelevant]
* slices
The core currently recognizes certain slices[7] within plugin tiddlers.
We should reexamine which one of those are relevant, and which ones
should be enforced.
For example, if a plugin is missing the Name slice, the plugin manager
could raise a warning (not an error).
[undecided]
So overall, it seems like there aren't any changes required that would
break backwards-compatibility.
Any thoughts?
-- F.
[1] cf. http://groups.google.com/group/TiddlyWikiDev/t/fb47ccef2db67576
[2] cf. http://www.tiddlywiki.org/wiki/Dev:Best_Practices#Creating_Aliases
[3] http://www.tiddlywiki.org/wiki/Dev:Best_Practices#Namespacing
[4] cf. http://trac.tiddlywiki.org/browser/Trunk/core/js/main.js#L151
[5] Note that macros' context variables are a separate issue:
http://trac.tiddlywiki.org/ticket/444
[6] cf. http://trac.tiddlywiki.org/browser/Trunk/core/js/main.js#L146
[7] cf. http://trac.tiddlywiki.org/browser/Trunk/core/js/main.js#L170
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---