I haven't tried jQuery, but l find myself browsing through the
Prototype API:s from time to time. And as far as I can see, it seems
to provide much the same functionality like MochiKit, but with an
object-oriented syntax and approach (extending built-in object
prototypes with stuff that should have been there from the start).

If you like that style of programming, I think you'd be better off
using one of these other libraries instead of MochiKit. At least their
mailing list wouldn't be hostile to the basic idea of modifying
built-in prototypes. ;-)

But I'm all for collaboration, cross-library compatibility and a free
exchange of ideas and code between these (quite similar) JavaScript
projects. If there is some clever way of bridging the gap or reusing
code I think it is worth having a look at. If only to allow
MochiKit-based code to run in environments where jQuery or Prototype
are already entrenched.

Question: Is mocking with the built-in object prototypes compatible with JS 2.0?

Cheers,

/Per

On Tue, Jun 17, 2008 at 7:35 PM, troels knak-nielsen <[EMAIL PROTECTED]> wrote:
>
> On Tue, Jun 17, 2008 at 5:07 PM, machineghost <[EMAIL PROTECTED]> wrote:
>> 1. Chainability: with this syntax you can chain functions do stuff
>> like:
>>    someObject.update(updateObject1).update(updateObject2);
>
> True, that _is_ something that can't be done with function-oriented
> syntax. Personally, I'm not that found of this "fluent interfaces"
> style; I think it works fine for simple cases, but lose it's punch
> when things get more complex. Plus it can get a bit unintuitive, when
> taken out of context. But I understand, that some people like it.
>
> The way jQuery's api works, should make it possible to provide some of
> these things without messing with built-in prototypes, I reckon? You
> could simply return wrapper objects, which have the methods available?
> I don't even remember if jQuery does this?
>
> On Tue, Jun 17, 2008 at 5:07 PM, machineghost <[EMAIL PROTECTED]> wrote:
>>
>> Actually, come to think of it 5.counter() wouldn't even work (since 5
>> is scalar, it doesn't inherit object.prototype methods).  But
>> hopefully you get the idea.
>
> It works. 5 is a scalar, but it's automagically wrapped in an object,
> when used as such.
>
> --
> troels
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to