Re: [AD] Function parameter ordering conventions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Trent Gamblin wrote:

For example al_put_pixel(color, dx, dy),
Don't like this ordering for put_pixel one bit, possibly because I've never seen a put pixel function anywhere that used this ordering ever. If that's right, I would recommend against deviating from the norm.

I would rather stay consistent with the rest of the API. If you're calling "draw picture at x, y" why not "draw color at x, y"?

I consider a sprite to be an object and a colour to be an attribute.

As for paramater ordering, the way I'm used to is that the 'thing being operated on' should be the first paramater (unless you're doing C++-style coding in C, in which case, if you're coding a 'class-method', the first paramater should be the 'this' pointer). However, with blit() it would mean that dst_params would come first, which might make things a bit messy/confusing.

In general, as long as we can make the API consistent, It does not matter which comes first or last. As well as agreeing on the order, we also need to agree on what is an object and what is an attribute.



AE.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/