dmah42 / dart-box2d

Box2D for Dart
http://dart-lang.github.io/dart-box2d/
34 stars 5 forks source link

Remove use of call chaining #41

Closed Fox32 closed 4 years ago

Fox32 commented 10 years ago

There is a pull-request landing in vector_math soon that removes call chaining from the library (and also comes with many dart2js related improvments). The problems that my changes to vector_math introduce can be solved by using the .. operator.

This change also works without the pull requets in vector_math. But I'm not sure if I covered all required changes. The demos are working fine, but during testing the demo I noticed that the analyzer missed at leas one problem (http://dartbug.com/17680).

dmah42 commented 10 years ago

It looks like you've been overly aggressive about changing the code. Any direct access to a vector/matrix should be fine with a single '.'. As such, we should only change those places where we need to chain calls.

Fox32 commented 10 years ago

I only changed the minimal amount required for box2d to work with the future version of vector_math. At many places the code contains combinations of calls and assignments. This will not work it the future if we don't change it to use Darts call chaining syntax, or as an alternative split it up into two seperate statments. But that would be a huge change compared to this change.

Fox32 commented 10 years ago

Ok I misssed somethings: If you look at these changes it only makes scense if you do it in the context of my PR to vector_math. You can use the following dependency override:

dependency_overrides:
  vector_math:
    git:
      url: https://github.com/fox32/vector_math.git
      ref: feature/cleanup
dmah42 commented 10 years ago

@johnmccutchan we should coordinate this with vector_math#63