On Apr 21, 4:26 am, FND <[email protected]> wrote:
> > not just 'eval'... custom macro handlers, toolbar handlers, hijacks,
> > etc... can also get invoked within the scope of a locally-declared $
> > (...) alias
>
> I don't believe this is correct - please take a look at this test case:
> http://fnd.lewcid.org/tmp/alias_scope.html
>
> It boils down to the following:
> ---------------
> var $ = "lorem ipsum";
> var foo;
>
> (function($) {
>
> foo = function() {
> console.log(typeof $); // prints "function", referencing jQuery
>
> };
>
> // hijack
> foo_orig = foo;
> foo = function() {
> foo_orig.apply(this, arguments);
> console.log(typeof $); // prints "string", referencing custom $
>
> };
>
> foo(); // prints both "function" and "string"
> ---------------
>
> Am I missing something?
>
> -- F.
As your tests illustrate, understanding and recognizing the current
scope of $(...) can be difficult, especially when considering the use
of hijacks, plugins, inline scripts and third-party libraries.
Even with these tests, it's still not clear to me when the scope of $
would be problematic and when it would be OK. In any case, keep in
mind that TiddlyWiki is not just an open source application... it's an
open source *development platform*... thus, while it might be possible
for us to do the work to avoid a $(...) scoping problem within the
core code, there is still a great potential for conflicts with other
code that could create a major burden for anyone else attempting to
develop new features.
Except for the core team, we are already facing a paucity of
TiddlyWiki developers in the community (primarily because of the
learning curve and lack of core API documentation). Creating
additional complexities (i.e., needing to comprehend the $(...)
scoping issue) will simply discourage yet more people from even
attempting to learn how to write new things for TiddlyWiki.
-e
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---