18.1.2 language-based reasoning: Why can't heavy load policies contain returned values?

Source: Internet
Author: User

This series does not discuss the usage or use of keywords, but speculate why such design and specifications are there. It is a brain training factory.

 

 

 

 

In reasoning, we can use a paradox technique, that is to say, if a hypothesis is true, the phenomena that happen in reality will not exist. If it is necessary that the phenomena in reality be reasonable, the assumption must be reset. This model is essentially a language-based reasoning.

Let's first understand what assertion reasoning is: this reasoning is based on the logical nature of the proposition. There are compatibility and incompatibility between the selected statement propositions. Correspondingly, the selected statement reasoning can be divided into two types: compatible statement-Based Reasoning and incompatible statement-based reasoning.

Compatible reasoning is based on the logical nature of compatible proposition. Compatible language-based reasoning has two rules:

N Rule 1: To deny one part of the selected branch, you must affirm the other part of the selected branch.

N rule 2: Make sure that one part of the statement is selected, and do not deny the other part.

A typical case is: A isProgramA is a programmer. A is not a writer. It is very important that Rule 2. If we make such a mistake: A is a programmer or writer, and a is a writer, A is not a programmer. This violates the second rule, because a may be both a programmer and a writer.

Incompatible reasoning is based on the logical nature of incompatible proposition. Incompatible language-based reasoning has two rules:

N Rule 1: To deny one part of the selected branch, you must affirm the other part of the selected branch.

N rule 2: Make sure that one part of the selected statement is rejected.

A typical case is that either a is the champion or B is the champion. If a is not the champion, B must be the champion.

Now let's infer our topic: the function overload does not include the return value! This phenomenon is confusing for many people. In this section, we will explain to readers why reload cannot include the returned value.

Overload: each type of member has a unique signature. A Method signature consists of a method name and a list of parameters (the order and type of parameters. As long as the signature is different, you can define multiple methods with the same name in one type. When two or more methods with the same name are defined, they are called overload. However, the reload policy does not include the return value.

We can design a series of functions with the same method name but different parameter lists to provide a rich combination of functions for class users. As we can imagine, if the overload permits a return value, can we provide users with richer combinations? So why does C # Not Allow the reload Policy to include the return value?

The reason is that there is a function called constructor! Constructor is a function with the same name as the class but no return value.

Now we define the optional proposition: either the overload can be implemented on all function rules, or the constructor is not a function.

Now we have encountered the paradox caused by the selective proposition: If the reload policy contains the return value, then the constructor cannot fully implement the reload policy. If the constructor must have a return value, it is obviously not in line with the facts. If the constructor is required to fully implement the overload policy, the overload policy must not contain the return value.

You see, in order to solve this paradox, we can only make a selective proposition for the preceding statement, that is, the result is that the overload must be implemented on all function rules. To satisfy the rules of all functions, the overload can only discard the returned values.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.