I don't think the FLTK coding standards cover the issue of naming
new methods regarding 'setting' vs. 'getting'.

It seems FLTK likes to use set_xxx() to 'set' things, and xxx() to 'get'.
There's a pretty long list of these, as noted in my Nov 5th comment in this STR:
http://www.fltk.org/str.php?L2083

I'm thinking the FLTK coding standards should probably explicitly cite this
under the section for "Function/Method/Variable Naming", eg. something like:

        Methods whose operations set and get values should be named
        set_xxx() to 'set' the values, and xxx() to 'get' the values, e.g.

            widget->set_modal();            // set it
            if ( modal() ) { .. }           // get it

            widget->set_changed();          // set it
            if ( widget->changed() ) { .. } // get it


..and should probably weigh in on how to 'set' vs. 'clear' should
be specified, eg. whether to use separate methods for each:

    set_xxx();
    clear_xxx();

..or to only have one set_xxx() method that takes an optional bool:

    set_xxx();          // set: same as set_xxx(1);
    set_xxx(0);         // clear
    set_xxx(1);         // same as set_xxx(void);

I'm not sure myself which FLTK prefers, or if it should be one over the other.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to