Bug 1448 - argument names are ambiguous and inconsistent
Summary: argument names are ambiguous and inconsistent
Status: RESOLVED MOVED
Alias: None
Product: UIM
Classification: Unclassified
Component: libuim (show other bugs)
Version: unspecified
Hardware: All All
: low enhancement
Assignee: uim-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 9643
  Show dependency treegraph
 
Reported: 2004-09-23 07:35 UTC by YamaKen
Modified: 2012-10-28 08:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description YamaKen 2004-09-23 07:35:41 UTC
Some argument names in libuim are ambiguous and inconsistent. It should be
modified to provide obvious meanings.

For example, following function uses 'id_' and 'id' to distinguish types between
LISP and int. But such implicit rule is not familiar for ordinary programmers
although '_name' style variable names are well known as 'private name'.
Requiring such unfamiliar treatment may introduce unwanted human errors.

static LISP
im_shift_page_candidate(LISP id_, LISP dir_)
{
  uim_context uc;
  int id = get_c_int(id_);
  int dir;

  if FALSEP(dir_)
    dir = 0;
  else
    dir = 1;
    
  uc = uim_find_context(id);
  uim_schedule_cb(uc, CAND_SHIFT_PAGE_CB, NULL, dir, 0);
  return false_sym;
}

To avoid such ambiguous meaning, I suggest that explicit type indication such as
'lisp_id' or 'c_id'. I think that using 'LISP id' and 'int c_id' is appropriate
because some other functions does not use C version of arguments.

Currently such argument names are inconsistent as follows.

im_set_encoding(LISP id, LISP enc)
im_update_mode(LISP id, LISP mode_)
im_activate_candidate_selector(LISP id_, LISP nr_, LISP display_limit_)

Some names are arbitrarily lacking trailing '_' and others are not. This result
means that the implicit rule ware not recognized by some developers (including
me). This inconsistent naming rule obscures the implicit meaning and confuses
developers.

Removing '_' from arguments and use 'c_' prefix for C versions of the variables
in the functions will resolve the problem for anyone.
Comment 1 YamaKen 2007-01-13 16:35:17 UTC
'var_' style name is not so bad. I'll define coding standard until uim 2.0.
Comment 2 Muneyuki Noguchi 2012-10-28 08:05:57 UTC
Moved to https://github.com/uim/uim/issues/1


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.