yuchi / hyperloop-macros

Sweet.js macros to accelerate Hyperloop development
GNU Lesser General Public License v2.1
6 stars 0 forks source link

[ObjC] Automatic casting of method arguments #3

Closed yuchi closed 10 years ago

yuchi commented 10 years ago

I sometime see that you need to explicitly cast things in their type (see https://github.com/appcelerator/hyperloop-ios/blob/bc3f69539f3fd65334bca6589b456537156e7096/examples/distanceTraveled/app.js#L40)

Should be this done automatically? I mean something like:

- (void) locationManager:(CLLocationManager *) locationManager
      didUpdateLocations:(NSArray *) locations {

  // Automatically **ALWAYS** done by the macro
  locationManager = locationManager as (CLLocationManager *)
  locations = locations as (NSArray *);
}

Is it the correct approach?

What do you think @infosia, @jhaynie?

jhaynie commented 10 years ago

yeah, this is cool idea.

yuchi commented 10 years ago

Names must be different, otherwise hyperloop will go in infinite loop parsing the code. Sweet.js’ hygene should do the job.

yuchi commented 10 years ago

Currently the uncasted value is not available for use. And I’m also casting to id.

What do you think?