Do Flexibility and Inconsistency,Unsafety Overlap?

I was lately doing some research about different programming languages. I was interested particularly to learn unique features of popular programming languages and situations where these assets shine. I believe this can help me to decide what language to use depending upon the problem to solve.

I found that many languages offering high level of flexibility (“can adapt to new, different, or changing requirements”) are also inconsistent,
for example in JavaScript (just an example, no offense to js people), arguments of a function get be manipulated either by naming them in the function declaration (classic approach):

function max(x,y)

Or by using the arguments variable:

function max() {
    if (arguments[0] < arguments[1])
        return arguments[1];
    else
        return arguments[0];
}

c = max(1,2);

The arguments variable is useful for many situations such as function overloading, however, it defeats the purpose of function prototyping (which is to give information about the function), and I saw many JavaScript samples where the argument variable is being used despite there is no need for it, which clearly makes the code harder to understand and debug.

I know that this depends heavily on the users of the language, but usually, code written in a language offering high flexibility tends to be unsafe, harder to understand,optimize and to debug.

Do flexibility and inconsistency overlap? How do languages designers make the choice?

Edit: I’m not critiquing any particular language here, I’m rather focusing on the relation between Flexibility,Safety,Consistency of programming languages.

3

I don’t think flexibility and inconsistency overlap or have a natural 1:1 relationship. More on this in a bit.

As for your other question, I would assume that language designers make these choices the same way they make any other choice; by comparing the pros and cons and deciding which one is the most suited for the language and the problem. Inconsistency is a con but there are pros that outweigh it.

For example, in your specific question about the arguments keyword, it’s very useful in a functional context where you apply arguments to function calls. In fact, documentation for apply indicates such. Otherwise you would specifically have to loop through arguments that you might not even have named. This can be a significant benefit.

Consider:

function f() { console.log(arguments); }
f(); // [ ]
f(1, 2, 3); // [1, 2, 3]

In JavaScript, the binding between named arguments happens automatically based on position, but you can provide any number of arguments to any function. Because of this behavior, it doesn’t seem inconsistent to provide a facility to interact with the arbitrary arguments. Additionally, you could view the named argument binding as the special case; syntactic sugar over var arg1 = arguments[0]; etc.

As far as flexibility and inconsistency, I think they’re primarily two separate measurements of modifications. I don’t really have any references to discussions of the two forces, however, in C#, for example, you could increase the flexibility of generic constraints quite a bit by providing mechanisms to constrain generics to delegates or enumerations. This is completely consistent with the existing language.

It just so happens that often a price to pay for flexibility is inconsistency, for example, C++11 added trailing return type declarations simply to support lambdas and a couple other compile-time type inference features. This was completely inconsistent but it allowed a new dimension of flexibility which was deemed important enough to allow the inconsistency.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật