Re: [AD] Function parameter ordering conventions

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


Evert Glebbeek wrote:
There are a few cases (the blit functions come to mind) where the API proposal (Bob's version anyway) has the mode as the first parameter. This put me off at first (on the basis of flags last), but there is a rationale for it: it isn't a flag in the sense that it *modifies* the behavior, it is a mode that *defines* the behavior. Having played with this a bit, I actually found that I did like both this distinction and ordering. I'd recommend playing with it for a bit. As I said, my initial reaction was "eeew! Flags should go last!" so don't dismiss the idea from the outset on those grounds.

Well at this point, those flags are modifiers only. The blitting API has been revised: http://wiki.allegro.cc/NewAPI/Blitting.

To turn that 180 degrees around, I don't think I like the strict ordering "src, src_params, dst, dst_params", prefering "src, dst, src_params, dst_params" in general. However, this possibly depends on whatis more natural in a given circumstance.

Well for the graphics API, dst won't be there at all, so it's more like "src, src_params, dst_params".

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"?





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