Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an automated tool for generating script sharp libraries?

Tags:

script#

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

Edit. Just to be cleaeer

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

like image 536
pm100 Avatar asked May 03 '11 04:05

pm100


1 Answers

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.

like image 175
Nikhil Kothari Avatar answered Dec 26 '22 00:12

Nikhil Kothari