[jquery-dev] Re: Rename bind/unbind?
Since jQuery itself is a function, jQuery.bind gives the wrong impression - even though binding jQuery to anything else wouldn't work anyway. On Jul 21, 2:23 pm, Julian Aubourg aubourg.jul...@gmail.com wrote: I've been watching this thread from afar and I don't really get it. This is OO programming and it's quite common to have different classes having methods with the same name but different semantic (obviously since, again, they are different classes). someFunction.bind() has semantic within the Function world, jQuery.bind() has semantic within the jQuery world. I mean, I wouldn't mind a .reverse() method for a string, an array or a video, perfectly knowing they obviously wouldn't behave the same. Unless a new pure Object method appears which name clashes with jQuery, I see no reason to break backward compatibility to circumvent what happens to be a feature in an OO programming language. Aren't we thinking a little Pascal here? ;) 2009/7/14 aHeckman aaron.heckm...@gmail.com With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
Since jQuery itself is a function, jQuery.bind gives the wrong impression - even though binding jQuery to anything else wouldn't work anyway. You aren't calling jQuery.bind() though, you're calling jQuery(something).bind() - that's a big distinction. You're working against a set of elements - that set is an object. There is no special meaning attached to Object.bind(). I don't particularly care for any of the proposals mentioned here. When jQuery came out in Jan of 2006 - Function.prototype.bind() was already heavily used by the most popular framework at the time: Prototype. And yet developers have been able to grasp the distinction and use the framework well. To put it another way: Let's say that ES6 adds .remove(), .add(), or some other method names that we also use - I don't think we should force ourselves to rename every method on the off chance that they have the same name. --John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
jQuery.bind doesn't exist, jQuery.prototype.bind does (therefore .bind is not in the context of a function). Furthermore, I don't see how this gives the wrong impression at all; nobody expects to be able to call arbitrary methods on a jQuery object just because a function exists on some other global object like Function, String, Date, etc. On Jul 22, 8:11 am, aHeckman aaron.heckm...@gmail.com wrote: Since jQuery itself is a function, jQuery.bind gives the wrong impression - even though binding jQuery to anything else wouldn't work anyway. On Jul 21, 2:23 pm, Julian Aubourg aubourg.jul...@gmail.com wrote: I've been watching this thread from afar and I don't really get it. This is OO programming and it's quite common to have different classes having methods with the same name but different semantic (obviously since, again, they are different classes). someFunction.bind() has semantic within the Function world, jQuery.bind() has semantic within the jQuery world. I mean, I wouldn't mind a .reverse() method for a string, an array or a video, perfectly knowing they obviously wouldn't behave the same. Unless a new pure Object method appears which name clashes with jQuery, I see no reason to break backward compatibility to circumvent what happens to be a feature in an OO programming language. Aren't we thinking a little Pascal here? ;) 2009/7/14 aHeckman aaron.heckm...@gmail.com With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
I see your points. Since jQuery.prototype.bind exists it overrides Function.prototype.bind. Gotcha. What I'm really trying to get at is if this community feels the following is clear, and if not, is it worth the trouble to change it? jQuery(someElement).bind('click', someFunction.bind(this)); So far it sounds like we feel this is good enough. On Jul 22, 10:05 am, Scott González scott.gonza...@gmail.com wrote: jQuery.bind doesn't exist, jQuery.prototype.bind does (therefore .bind is not in the context of a function). Furthermore, I don't see how this gives the wrong impression at all; nobody expects to be able to call arbitrary methods on a jQuery object just because a function exists on some other global object like Function, String, Date, etc. On Jul 22, 8:11 am, aHeckman aaron.heckm...@gmail.com wrote: Since jQuery itself is a function, jQuery.bind gives the wrong impression - even though binding jQuery to anything else wouldn't work anyway. On Jul 21, 2:23 pm, Julian Aubourg aubourg.jul...@gmail.com wrote: I've been watching this thread from afar and I don't really get it. This is OO programming and it's quite common to have different classes having methods with the same name but different semantic (obviously since, again, they are different classes). someFunction.bind() has semantic within the Function world, jQuery.bind() has semantic within the jQuery world. I mean, I wouldn't mind a .reverse() method for a string, an array or a video, perfectly knowing they obviously wouldn't behave the same. Unless a new pure Object method appears which name clashes with jQuery, I see no reason to break backward compatibility to circumvent what happens to be a feature in an OO programming language. Aren't we thinking a little Pascal here? ;) 2009/7/14 aHeckman aaron.heckm...@gmail.com With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
jQuery instanceof Function = true jQuery.prototype instanceof Function = false Both ‘bind’ methods do what they are intended to do and do not interfere with each other. On Jul 22, 8:10 pm, aHeckman aaron.heckm...@gmail.com wrote: I see your points. Since jQuery.prototype.bind exists it overrides Function.prototype.bind. Gotcha. What I'm really trying to get at is if this community feels the following is clear, and if not, is it worth the trouble to change it? jQuery(someElement).bind('click', someFunction.bind(this)); So far it sounds like we feel this is good enough. On Jul 22, 10:05 am, Scott González scott.gonza...@gmail.com wrote: jQuery.bind doesn't exist, jQuery.prototype.bind does (therefore .bind is not in the context of a function). Furthermore, I don't see how this gives the wrong impression at all; nobody expects to be able to call arbitrary methods on a jQuery object just because a function exists on some other global object like Function, String, Date, etc. On Jul 22, 8:11 am, aHeckman aaron.heckm...@gmail.com wrote: Since jQuery itself is a function, jQuery.bind gives the wrong impression - even though binding jQuery to anything else wouldn't work anyway. On Jul 21, 2:23 pm, Julian Aubourg aubourg.jul...@gmail.com wrote: I've been watching this thread from afar and I don't really get it. This is OO programming and it's quite common to have different classes having methods with the same name but different semantic (obviously since, again, they are different classes). someFunction.bind() has semantic within the Function world, jQuery.bind() has semantic within the jQuery world. I mean, I wouldn't mind a .reverse() method for a string, an array or a video, perfectly knowing they obviously wouldn't behave the same. Unless a new pure Object method appears which name clashes with jQuery, I see no reason to break backward compatibility to circumvent what happens to be a feature in an OO programming language. Aren't we thinking a little Pascal here? ;) 2009/7/14 aHeckman aaron.heckm...@gmail.com With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
If the all name is still around then it is ok, it's just sometimes in the past changes where made that would not support earlier ways of doing thing which lead to plugins no longer working. If it's more an alias that is created than I am up for it. I like Daniel's idea of event(), couldn't make more sense than that really :) On Jul 20, 11:03 am, Már mar.orlygs...@gmail.com wrote: jQuery(someElement).bind('click', someFunction.bind(this)); I think as `Function.prototype.bind` becomes more mainstream (years from now) this will indeed become common cause of confusuion for jQuery newcomers. However, all mature libraries are bound have their share of idiosyncratic/lame-duck legacy naming baggage to confuse newcomers. jQuery has a couple or so already: * `$.fn.load()` has fundamentally different semantics depending on the arguments you feed it. * `$.fn.remove()` is not a normal `removeChild()`, but actually a destroy method. * etc. ...and it's very difficult to avoid these sort of things completely - without either A) clean restart (breaking backwards compatibility) - or B) building up a large stack of depricated method names that lie hidden/forgotten only to spring on unsuspecting developers when they least need to have to deal with cryptic bugs in their code. Design is damn hard. ;-) -- Már --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
I like $.connect(ev, fn) ;) Gilles wrote: If the all name is still around then it is ok, it's just sometimes in the past changes where made that would not support earlier ways of doing thing which lead to plugins no longer working. If it's more an alias that is created than I am up for it. I like Daniel's idea of event(), couldn't make more sense than that really :) On Jul 20, 11:03 am, Már mar.orlygs...@gmail.com wrote: jQuery(someElement).bind('click', someFunction.bind(this)); I think as `Function.prototype.bind` becomes more mainstream (years from now) this will indeed become common cause of confusuion for jQuery newcomers. However, all mature libraries are bound have their share of idiosyncratic/lame-duck legacy naming baggage to confuse newcomers. jQuery has a couple or so already: * `$.fn.load()` has fundamentally different semantics depending on the arguments you feed it. * `$.fn.remove()` is not a normal `removeChild()`, but actually a destroy method. * etc. ...and it's very difficult to avoid these sort of things completely - without either A) clean restart (breaking backwards compatibility) - or B) building up a large stack of depricated method names that lie hidden/forgotten only to spring on unsuspecting developers when they least need to have to deal with cryptic bugs in their code. Design is damn hard. ;-) -- Már --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
I've been watching this thread from afar and I don't really get it. This is OO programming and it's quite common to have different classes having methods with the same name but different semantic (obviously since, again, they are different classes). someFunction.bind() has semantic within the Function world, jQuery.bind() has semantic within the jQuery world. I mean, I wouldn't mind a .reverse() method for a string, an array or a video, perfectly knowing they obviously wouldn't behave the same. Unless a new pure Object method appears which name clashes with jQuery, I see no reason to break backward compatibility to circumvent what happens to be a feature in an OO programming language. Aren't we thinking a little Pascal here? ;) 2009/7/14 aHeckman aaron.heckm...@gmail.com With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
jQuery(someElement).bind('click', someFunction.bind(this)); I think as `Function.prototype.bind` becomes more mainstream (years from now) this will indeed become common cause of confusuion for jQuery newcomers. However, all mature libraries are bound have their share of idiosyncratic/lame-duck legacy naming baggage to confuse newcomers. jQuery has a couple or so already: * `$.fn.load()` has fundamentally different semantics depending on the arguments you feed it. * `$.fn.remove()` is not a normal `removeChild()`, but actually a destroy method. * etc. ...and it's very difficult to avoid these sort of things completely - without either A) clean restart (breaking backwards compatibility) - or B) building up a large stack of depricated method names that lie hidden/forgotten only to spring on unsuspecting developers when they least need to have to deal with cryptic bugs in their code. Design is damn hard. ;-) -- Már --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
Daniel - exactly. I would prefer to deprecate bind and move forward with a cleaner name, tho I agree with Gilles on bind being a great name right now. It just won't be in the near future. On Jul 17, 4:19 pm, Daniel Friesen nadir.seen.f...@gmail.com wrote: Renamed are best done by creating the new name and leaving the old name around for compatibility. This isn't a rename bind to something else and force everyone to change it's a give a new standard name for bind leaving the old name in place for old code so that new projects have a name they can use which isn't ambiguous with ES5's .bind() I kindof like .event() On 17-Jul-09, at 9:19 AM, Gilles gil...@netxtra.net wrote: element.bind('click', someFunction, this); - This way allow backward compatibility. Your way, renaming the functions the most uses in plug-in, will mean an aweful lot of developers will have to go through their code and update it. And to be honest I don't see how anything else could describe better what the function already does. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
element.bind('click', someFunction, this); - This way allow backward compatibility. Your way, renaming the functions the most uses in plug-in, will mean an aweful lot of developers will have to go through their code and update it. And to be honest I don't see how anything else could describe better what the function already does. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
Renamed are best done by creating the new name and leaving the old name around for compatibility. This isn't a rename bind to something else and force everyone to change it's a give a new standard name for bind leaving the old name in place for old code so that new projects have a name they can use which isn't ambiguous with ES5's .bind() I kindof like .event() On 17-Jul-09, at 9:19 AM, Gilles gil...@netxtra.net wrote: element.bind('click', someFunction, this); - This way allow backward compatibility. Your way, renaming the functions the most uses in plug-in, will mean an aweful lot of developers will have to go through their code and update it. And to be honest I don't see how anything else could describe better what the function already does. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
In jQuery 1.3.3 the above code could be written as element.bind('click', someFunction, this); On Jul 14, 4:20 pm, aHeckman aaron.heckm...@gmail.com wrote: With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Rename bind/unbind?
I know that with 1.3.3 it is possible to pass the third argument but that is not my point. I am proposing a cleaner API around event listening to avoid any confusion between function(){}.bind() and jQuery.bind(). They serve two different purposes. On Jul 14, 8:57 am, Azat Razetdinov razetdi...@gmail.com wrote: In jQuery 1.3.3 the above code could be written as element.bind('click', someFunction, this); On Jul 14, 4:20 pm, aHeckman aaron.heckm...@gmail.com wrote: With the inclusion of Function.prototype.bind in ECMAscript 5, I'd like to open discussion around possibly modifying the API around bind/ unbinding events. I feel changing jQuery would help keep it's API cleaner. For example, the following seems dirty and will cause unnecessary confusion: jQuery.bind('click', someFunction.bind(this)); Maybe listen/unlisten, watch/unwatch, or something similar would be better. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---