On 20-Sep-05, at 12:33 AM, Rob Kinyon wrote:
> On 9/19/05, Laurie Harper <
lau...@holoweb.net> wrote:
>> Hi, I use Scriptaculous in my application. The trouble is, it depends
>> on prototype and JSAN has all sorts of bits from prototype exposed in
>> the global context (i.e. not wrapped in a JSAN namespace or
>> anything). Is this going to cause problems due to incompatibilities
>> between the objects/functions JSAN defines, and the versions supplied
>> in the latest version of prototype.js?
>
> Wow. It seems to be my night to reply. :-)
:-)
> No, there shouldn't be any conflict between JSAN and prototype.js -
> the reason is that JSAN.js doesn't use anything that I've been
> converting from Prototype over into JSAN-friendly distributions.
Sorry, I should be careful; when I say 'JSAN' I mean 'JSAN.js or any
other package distributed through JSAN'. With things from
prototype.js available through JSAN, it's reasonable to expect that
there are or will be distributions that use them.
>> It seems I *should* be able to load JSAN.js then prototype.js and
>> just let prototype.js redefine those things that are in JSAN, but if
>> there's anything in any JSAN distributions that depends on something
>> JSAN adds to an object supplied by prototype, I'm going to be
>> screwed... And what if I use() something that loads a JSAN module
>> which overwrites something defined by prototype, possibly deleting
>> prototype features my page (or scriptaculous) is using?
>
> Everything that I've converted from Prototype is feature-complete
> vis-a-vis prototype.js. So, if it's got the same name, it "should" do
> at least as much as Sam built into prototype.js. It may do more, but
> it should do at least as much. If it doesn't, please provide a
> testcase and I'll fix it.
It's the 'may do more' part that worries me ;-) Any code written to
depend on that 'more' would break if I load a more recent
prototype.js 'over the top of' (i.e. after) JSAN or something
distributed through JSAN. Prototype is a moving target; Scriptaculous
depends on a pre-release version as it is. Are you tracking updates
to Prototype and keeping the code in JSAN in sync?
>> It seems to me that, unless prototype is going to be distributed as a
>> set of JSAN modules by default, JSAN should either have it as a
>> requirement and not redefine things from prototype, or define them in
>> a namespace that wont conflict. Am I missing something here?
>
> Sam has tentatively agreed that, once I convert prototype.js into a
> complete set of modules, he'll consider repackaging prototype.js as a
> wrapper around JSAN modules. (I've already started this wrapper - it's
> the Prototype distribution on JSAN.)
So, there's a possibility that, some time in the future, this concern
of mine might go away? I don't think I feel too comfortable building
a dependency on two things that may or may not end up aligning...
Wouldn't it make more sense to package stuff in prototype.js in its
own namespace and then, if prototype adopts JSAN, the appropriate
symbols just need to be exported from that namespace to the global
scope. If it doesn't, both can co-exist (and potentially diverge)
without conflict.
> Now, I think you're conflating two separate concepts. There's the
> JSAN.js code that adds the concept of on-demand libraries to
> Javascript. Then, there's the JSAN code repository. JSAN.js has no
> outside dependencies on anything. (This is by design.) Various
> distributions in the JSAN repository may have dependencies on other
> items. For example, DOM.Element has a dependency on DOM.Utils because
> it uses the $() function. As far as I'm aware, there are currently no
> distributions in JSAN that depend on pieces extracted from
> prototype.js, except for other pieces from prototype.js (as
> demostrated above).
>
> In short, you should be able to use Scriptaculous and prototype.js as
> well as other items from the JSAN repository without any conflicts.
>
> I hope this helps clear up any confusion.
Yes, you're right, I'm guilty of confaltion, see above ;-). Perhaps
there's a term that would cover JSAN and everything distributed
through it?
It's good to know there are no known current conflicts, but I'm still
not convinced I can rely on that remaining true in the future as long
as JSAN (in the inclusive sense) and Prototype are independently
defining the same symbols in the same scope.
I'm not trying to be difficult, I just want to be sure I understand
my risks so I can manage them effectively and make an informed choice.