#### Topic: Arithmetics of constants in language Go

Authors of language considered that with rules of coercion of types for numbers in language of Si there are big problems. It seemed to them that one of vital issues in Si are the errors connected to misuse of arithmetical operators for numbers of different types. As a result they invented something: https://blog.golang.org/constants the Essence that for constants one rules, and for variables others operate. It leads to following effects: var a =-1; fmt. Println (uint32 (a));//OK const b =-1; fmt. Println (uint32 (b)); constant-1 overflows uint32 Why for overflow variables it is authorized, and for constants is not present? (Because in one case at the moment of compilation it is possible to check up, and in other is not present. Seriously?) Or such: var a = 9223372036854775296 + 1.0; const b = 9223372036854775296 + 1.0; fmt. Println (uint64 (a), "", uint64 (b));//9223372036854775808 9223372036854775297 It is comparable from a C ++: auto a = 9223372036854775296 + 1.0; constexpr auto b = 9223372036854775296 + 1.0; std:: cout <<uint64_t (a) <<"" <<uint64_t (b);//such approach seems to 9223372036854775808 9223372036854775808 Me illogical in the absence of uniformity in rules of calculation of variables and constants. In the approach With ++ it is necessary to understand as coercion of types and arithmetics works.  expressions a calculation method does not influence. In Go, as well as in any other language with  numbers, from necessity of understanding of arithmetics to leave it does not turn out, but unlike With ++, it is necessary to remember different rules for constants and variables. Looks so that wanted to secure programmers against "difficult" rules of arithmetics of numbers, and as a result only all complicated and made less convenient. It not that area of programming in which it is necessary to try to simplify something. Apparent complexity of arithmetics of numbers is unremovable. It is impossible to write the qualitative code, without knowing and without thinking of it. What think of it?

#### Re: Arithmetics of constants in language Go

Hello, netch80, you wrote: N> At compilation - a failure from standard  and "a sunset manually" with the  and the optimizer, certainly more feeble, than  like LLVM At them one of the major purposes - speed of compilation, for the sake of it are ready to go on foolish grammar and  optimization. And LLVM brake as a reptile.

#### Re: Arithmetics of constants in language Go

Hello, vsb, you wrote: N>> Invariable sharpening GC on a minimum of time delays though not all it is necessary for tasks. vsb> And here what not so? Nish  it is small web services where it is important to answer quickly, thus overall performance is less important, since if the server does not consult, it should be scaled simply. If they aim on pauses to 100 microsecond, it already in any way web services. It is level which comes nearer to small HFT. vsb> it is clear that is good, if there is heap GC for all occasions as in Java, but it costs money, generally. Or in the language there are any decisions which do not allow to do others GC? Like there are no such. Generally, stop the world it is possible to make with any language. vsb> problem Go (and some other technologies like React) that is bits from intrigues of corporations which they throw out in audience. Long thought, than to object, but did not find. We will consider valid. vsb> For now Go forms in Google and its overall objective - to service specific interests of Google, the priority will be given to that is important for Google. And if for Google  are not important, they there will not be. Similar on that. They and in a C ++ do not resolve an exception.

#### Re: Arithmetics of constants in language Go

Hello, D. Mon, you wrote: N>> * At compilation - a failure from standard  and "a sunset manually" with the  and the optimizer, certainly more feeble, than  like LLVM DM> At them one of the major purposes - speed of compilation, for the sake of it are ready to go on foolish grammar and  optimization. With optimization still it somehow agree, but at what here grammar? On grammar of brakes now generally it is not enough. C brakes ++ follow the account multimeter ,  and the subsequent optimization to the reasonable code. Remaining  languages very quickly understand. DM> and LLVM brake as a reptile. On optimization, likely. Parcers quite comprehensible on speed, as for normal tasks of such language.

#### Re: Arithmetics of constants in language Go

Hello, netch80, you wrote: N> With optimization still it somehow agree, but at what here grammar? Go it is very easy , of it specially cared. Not only for speed, it still  simplifies, but also for speed too. And at the first acquaintance to language it is well felt - grammar did first of all for the machine, for simplicity of the compiler, in the second only for people.