Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] Inconsistent function names and arguments
Home

[Freeciv-Dev] Inconsistent function names and arguments

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Inconsistent function names and arguments
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 22 Jul 2000 20:42:14 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxxxx

Hello

As you may remember I posted an interface for a client side ai
implementation. One of the main reasons to define a new set of functions 
and not to use the one from common was a missing consistency.

Examples 1: There are two function in map.h
map.h:int is_water_adjacent_to_tile(int x, int y);
map.h:int is_water_adjacent(int x, int y);

You can tell the difference? There is a difference. If you know it do you 
choose always the one you want?

Example 2: There is a function
government.h:int government_has_flag(const struct government *gov, 
                                     enum government_flag_id flag);
and there are functions
tech.h:int tech_flag(int tech, int flag);
unit.h:int unit_flag(Unit_Type_id id, int flag);

Why not be consistent and call the last two tech_has_flag and unit_has_flag.
The latter name should be changed another time to unit_type_has_flag.
Nevertheless would it be useful to define a unit_has_flag since a lot of the
usages of unit_flag today are "if (unit_flag(punit->type, F_SOME_FLAG))".
Last point: the government function takes a pointer while the
others takes ids. (And there is the another issue int-vs.-real type for the
flag)

Do developers admit that there some difficulties in respect to function
names and aguments? At least in the two examples above?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Make it idiot-proof and someone will make a better idiot."



[Prev in Thread] Current Thread [Next in Thread]