What is “Orthogonality”?

前端 未结 17 1564
离开以前
离开以前 2020-12-12 09:42

What does \"orthogonality\" mean when talking about programming languages?

What are some examples of Orthogonality?

17条回答
  •  暖寄归人
    2020-12-12 09:55

    Real life examples of orthogonality in programming languages

    There are a lot of answers already that explain what orthogonality generally is while specifying some made up examples. E.g. this answer explains it well. I wanted to provide (and gather) some real life examples of orthogonal or non-orthogonal features in programming languages:

    Orthogonal: C++20 Modules and Namespaces

    On the cppreference-page about the new Modules system in c++20 is written:

    Modules are orthogonal to namespaces

    In this case they write that modules are orthogonal to namespaces because a statement like import foo will not import the module-namespace related to foo:

    import foo;            // foo exports foo::bar()
    bar ();                // Error
    foo::bar ();           // Ok
    using namespace foo;
    bar ();                // Ok
    

    (adapted from modules-cppcon2017 slide 9)

提交回复
热议问题