View Single Post
08-19-08, 09:05 AM   #15
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
Nil is returned by this API function for a range of conditions however - most of which are 'failures' such as an invalid or non-existant UNIT or SPELL

0 is returned where you have a valid spell and unit but the spellcast would fail as it's out-of-range

1 is returned where you have a valid spell and unit and the spellcast would NOT fail - e.g. the unit is in range of the spell

and then nil is returned if you have a valid UNIT and SPELL but the API 'just knows' that the spell has no range - despite there not seeming to be a way to tell this from the API itself...

I still think that is neither a logical nor a meaningful return value for an API to give in those circumstances...

It's the sort of thing you code when you are coding something 'for yourself only' - not considering the need to offer consistency and clear documentation for others (which is what an API should offer)

It's bad coding and it's a pet hate of mine - it's a sign you're either lazy or lack the logical rigor needed to define an API properly - you leave 'assumptions' in you code because you 'know' about them and it's not a problem to you...

Just my 10p I guess...