开发者

Is there an automated tool for generating script sharp libraries?

I can't believe all that code for jQuery was done by hand.

Edit. Just to be cleaee开发者_如何学JAVAr

Script # has a set of libraries that wrap jquery. This allows me to call jquery functions in natural c# way. But they are large long winded. But they also look neat and consistent. Looks like a tool generated them. But there is no tool in the scripts arp package. Hence the q


Unfortunately there is no magic tool... and I did hand-write the jQuery code.

If you look at it you'll see one really has to look at all the "quirks" ... ummm ... features accomplished by varying parameter sequences/counts etc. to get different behaviors, as well as the possible different return values etc. All of this information is simply not there in the script to be able to create a nice wrapper.

Furthermore there are places where you have to think about what a natural/useful c# experience will be ... for example, use of enums to represent string literals, numeric literals. How to represent different behaviors as overloads or differently named c# APIs that translate to same call at runtime. Same goes for where some generics would be useful.

Its not rocket science, but requires a bit of work. It also depends on the size of the API you're trying to wrap. jQuery core is a fairly large surface area, compared to other jQuery plugins.


I'm not quite sure if I'm getting your question right, but are you looking for a code generation for jQuery ? If so, I don't think there are. However, there are great plugins that you can use with free software such as Aptana Studio. Hope it helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜