Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    js
    @js:nil.im
    [m]
    of enum NSStringEncoding
    per normal conventions it should be NSStringEncodingUTF8
    so, should I do OFUTF8StringEncoding or OFStringEncodingUTF8?
    2 replies
    OpenStep is a lot less consistent than CF even!
    e.g. it's NSMakeRect, instead of NSRectNew or something.
    It's NSRectEqualToRect
    but NSEqualPoints
    WTF was OpenStep smoking?
    clearly they haven't done an API review before release
    jn
    @jn:ccc.ac
    [m]
    i don't know about the points about consistency though
    js
    @js:nil.im
    [m]
    I'm starting to think I should just keep calling it OF_STRING_ENCODING_UTF8 and say "deal with it Cocoa boys, your favorite framework is inconsistent as heck, adapt to ObjFW's consistency"
    jn
    @jn:ccc.ac
    [m]
    having enum variants (OF_FOO_BAR) look different than classes (OFFooBar) seems fine to me
    js
    @js:nil.im
    [m]
    my main problem to solve is inconsistency between external names and internal
    maybe you have an idea jn 🙂
    so:
    thisIsAStaticLocalFunction()
    of_but_global_function_look_like_this
    the of prefix is really annoying here
    hence maybe OFGlobalFunctionLookLikeThis?
    which is what Cocoa does
    but at that point the questions becomes why should enums be all uppercase when that works poorly with swift
    ugh, I hate it
    jn
    @jn:ccc.ac
    [m]
    hm, i don't know about the Swift constraints
    js
    @js:nil.im
    [m]
    I'm leaning towards just changing the style and not giving anything about how Cocoa names stuff, given how inconsistent they are
    jn
    @jn:ccc.ac
    [m]
    maybe you could make a little overview page of the different constraints and influences?
    js
    @js:nil.im
    [m]
    but then again: OFStringEncodingISO885915?
    Cocoa would call it NSISOLatin9StringEncoding, if it had it at all.
    (GNUstep does call it that way)
    /**
     * @brief The encoding of a string.
     */
    typedef enum OFStringEncoding {
        /*
         * UTF-8 *has* to be 0, so that if the current @ref OFLocale is `nil`,
         * `[OFLocale encoding]` returns UTF-8.
         */
        /** UTF-8 */
        OFStringEncodingUTF8 = 0,
        /** ASCII */
        OFStringEncodingASCII,
        /** ISO 8859-1 */
        OFStringEncodingISO8859_1,
        /** ISO 8859-2 */
        OFStringEncodingISO8859_2,
        /** ISO 8859-3 */
        OFStringEncodingISO8859_3,
        /** ISO 8859-15 */
        OFStringEncodingISO8859_15,
        /** Windows-1251 */
        OFStringEncodingWindows1251,
        /** Windows-1252 */
        OFStringEncodingWindows1252,
        /** Codepage 437 */
        OFStringEncodingCodepage437,
        /** Codepage 850 */
        OFStringEncodingCodepage850,
        /** Codepage 858 */
        OFStringEncodingCodepage858,
        /** Mac OS Roman */
        OFStringEncodingMacRoman,
        /** KOI8-R */
        OFStringEncodingKOI8R,
        /** KOI8-U */
        OFStringEncodingKOI8U,
        /** Try to automatically detect the encoding */
        OFStringEncodingAutodetect = 0xFF
    } OFStringEncoding;
    Maybe this isn't all terrible?
    jn
    @jn:ccc.ac
    [m]
    it has the main points that i like to see in enums
    js
    @js:nil.im
    [m]
    values have the enum as prefix?
    jn
    @jn:ccc.ac
    [m]
    yes
    js
    @js:nil.im
    [m]
    you prefer that over enum Foo { FOO_BAR, FOO_BAZ }?
    jn
    @jn:ccc.ac
    [m]
    no, that fulfills my criteria too
    js
    @js:nil.im
    [m]
    ugh, API design is hard
    or, rather, naming consistency is hard
    maybe I should just say "public functions use a different convention to align with C style, deal with it"?
    jn
    @jn:ccc.ac
    [m]
    FOO_BAR style gives visual separation between enum variants and classes; but i don't know if that's good or bad
    js
    @js:nil.im
    [m]
    yes, that's why I initially used foo_t for types, and Foo for classes
    jn
    @jn:ccc.ac
    [m]
    and OFStringEncodingUTF8 (an enum variant) would look like a class
    js
    @js:nil.im
    [m]
    indeed
    maybe indeed best to keep everything as is. Letterus WDYT?
    hmm, would of_thisIsAnExportedFunction be so bad?
    maybe that is what I should use
    to solve the entire inconsistency between local and public
    Letterus
    @letterus:synod.im
    [m]
    I‘d be fine with both
    just don‘t make anything uppercase and underscore that is going to be part of a class instance (methods and properties)
    2 replies
    oh, and write down the rules somewhere so libs can comply to it as well 😉
    js
    @js:nil.im
    [m]
    ah I see
    Letterus
    @letterus:synod.im
    [m]
    private ivars _ivarName of course…