Closed sledorze closed 13 years ago
Well, because it may return an Array, see lower part of http://api.jquery.com/closest/
cheers, Andy
Mmmmm.. I see the problem, pretty annoying.. got inference wrong with that. looks like native does not work for methods.. too bad:
public function closest(selector:Dynamic):JQuery;
@:native("closest") public function closest_Context(selector:Dynamic,
context:Dynamic):Array
has it been discussed already on the ML?
On Wed, Jun 8, 2011 at 10:57 AM, andyli < reply@reply.github.com>wrote:
Well, because it may return an Array, see lower part of http://api.jquery.com/closest/
cheers, Andy
Reply to this email directly or view it on GitHub: https://github.com/andyli/jQueryExternForHaxe/issues/1#comment_1325424
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
You can use inline to help creating the typed version of the method, something like
inline public function closest_Context(selector:Dynamic, context:Dynamic):Array<Dynamic> {
return closest(selector, context);
}
Actually you can find that I used this method for cssSet
and others in JQueryExtern.
I've proposed on the ML to have method overloading for extern, not sure if Nicolas will implement it. I will try implementing a macro version of method overloading, which seems like possible.
Yes, in fact both could be typed:
public function closest(selector:Dynamic):JQuery;
inline public function closest_Context(selector:Dynamic,
context:Dynamic):Array
Would you add this to JQueryExtern??? (closest_Context or another naming) I think that JQuery is all about the way one can build inliner. It hurts less in my mind if we add a conventionnal way to call typed version of functions rather than having to trouble shot Dynamic issue and unfold the code over several lines.. :\
What do you think? Stephane
On Wed, Jun 8, 2011 at 12:04 PM, andyli < reply@reply.github.com>wrote:
You can use inline to help creating the typed version of the method, something like
inline public function closest_Context(selector:Dynamic, context:Dynamic):Array<Dynamic> { return closest(selector, context); }
Actually you can find that I used this method for
cssSet
and others in JQueryExtern.I've proposed on the ML to have method overloading for extern, not sure if Nicolas will implement it. I will try implementing a macro version of method overloading, which seems like possible.
Reply to this email directly or view it on GitHub: https://github.com/andyli/jQueryExternForHaxe/issues/1#comment_1325685
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
oh sorry; I missed the js(" "); stuff..
On Wed, Jun 8, 2011 at 12:11 PM, Stephane Le Dorze < stephane.ledorze@gmail.com> wrote:
Yes, in fact both could be typed:
public function closest(selector:Dynamic):JQuery; inline public function closest_Context(selector:Dynamic, context:Dynamic):Array
{ return untyped closest(selector, context); } Would you add this to JQueryExtern??? (closest_Context or another naming) I think that JQuery is all about the way one can build inliner. It hurts less in my mind if we add a conventionnal way to call typed version of functions rather than having to trouble shot Dynamic issue and unfold the code over several lines.. :\
What do you think? Stephane
On Wed, Jun 8, 2011 at 12:04 PM, andyli < reply@reply.github.com>wrote:
You can use inline to help creating the typed version of the method, something like
inline public function closest_Context(selector:Dynamic, context:Dynamic):Array<Dynamic> { return closest(selector, context); }
Actually you can find that I used this method for
cssSet
and others in JQueryExtern.I've proposed on the ML to have method overloading for extern, not sure if Nicolas will implement it. I will try implementing a macro version of method overloading, which seems like possible.
Reply to this email directly or view it on GitHub: https://github.com/andyli/jQueryExternForHaxe/issues/1#comment_1325685
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
Oh but juste realized how much js(".."); is wrong, there's definitively an isue with that multi params..
On Wed, Jun 8, 2011 at 12:11 PM, Stephane Le Dorze < stephane.ledorze@gmail.com> wrote:
oh sorry; I missed the js(" "); stuff..
On Wed, Jun 8, 2011 at 12:11 PM, Stephane Le Dorze < stephane.ledorze@gmail.com> wrote:
Yes, in fact both could be typed:
public function closest(selector:Dynamic):JQuery; inline public function closest_Context(selector:Dynamic, context:Dynamic):Array
{ return untyped closest(selector, context); } Would you add this to JQueryExtern??? (closest_Context or another naming) I think that JQuery is all about the way one can build inliner. It hurts less in my mind if we add a conventionnal way to call typed version of functions rather than having to trouble shot Dynamic issue and unfold the code over several lines.. :\
What do you think? Stephane
On Wed, Jun 8, 2011 at 12:04 PM, andyli < reply@reply.github.com
wrote:
You can use inline to help creating the typed version of the method, something like
inline public function closest_Context(selector:Dynamic, context:Dynamic):Array<Dynamic> { return closest(selector, context); }
Actually you can find that I used this method for
cssSet
and others in JQueryExtern.I've proposed on the ML to have method overloading for extern, not sure if Nicolas will implement it. I will try implementing a macro version of method overloading, which seems like possible.
Reply to this email directly or view it on GitHub: https://github.com/andyli/jQueryExternForHaxe/issues/1#comment_1325685
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
I've commited a change that split closest
into closest
and closestMulti
.
From the doc of jQuery, the type signature of closestMulti
is
primarily meant to be used internally or by plugin authors.
So I agree it is safe to type the return of closest
as JQuery
and let ppl use closestMulti
if they need the other.
I will have a haxelib release after I align the extern with jQuery 1.6.1.
Thanks for the comment :)
Thank you for maintening this! ;)
On Thu, Jun 9, 2011 at 1:28 PM, andyli < reply@reply.github.com>wrote:
I've commited a change that split
closest
intoclosest
andclosestMulti
. From the doc of jQuery, the type signature ofclosestMulti
isprimarily meant to be used internally or by plugin authors.
So I agree it is safe to type the return of
closest
asJQuery
and let ppl useclosestMulti
if they need the other.I will have a haxelib release after I align the extern with jQuery 1.6.1.
Thanks for the comment :)
Reply to this email directly or view it on GitHub: https://github.com/andyli/jQueryExternForHaxe/issues/1#comment_1333579
Stphane Le Dorze
Tel: +33 (0) 6 08 76 70 15
If not then I would be glad to learn why coz I'm fresh to jqueryism :)