Forum > Suggestions

multiple variable initialisation

<< < (2/3) > >>

440bx:
That extension has real value. 

It explicitly shows that two or more variables should start with the same initial state (initial value.)  That is something that single variable initialization does _not_ accomplish.

Leledumbo:

--- Quote from: 440bx on June 11, 2021, 04:50:42 am ---That extension has real value. 

It explicitly shows that two or more variables should start with the same initial state (initial value.)  That is something that single variable initialization does _not_ accomplish.

--- End quote ---
Read again:

--- Quote ---Practically it means it must make something possible that cannot be done otherwise

--- End quote ---
The OP already contains the code how it can be done otherwise, that is NOT a real value mandated by the rule. The quoted sentence above clarifies the meaning of real value because as you've tried, interpretation may vary otherwise.

440bx:

--- Quote from: Leledumbo on June 11, 2021, 04:57:21 am ---Read again:

--- Quote ---Practically it means it must make something possible that cannot be done otherwise

--- End quote ---
The OP already contains the code how it can be done otherwise, that is NOT a real value mandated by the rule. The quoted sentence above clarifies the meaning of real value because as you've tried, interpretation may vary otherwise.

--- End quote ---
I can read that many times BUT, if that were a practical and rational measure then neither "for" (much less "for .. in"), "while", "repeat", not to mention classes and objects would be justified.  All loops can be created with "if" and "goto" and all objects and classes can be created with tables of function pointers (which is what they are anyway.)

If that were a valid reason, we wouldn't even have compilers, we can do everything a compiler can do (and then some) in assembler. 

MarkMLl:

--- Quote from: Leledumbo on June 11, 2021, 04:57:21 am ---
--- Quote from: 440bx on June 11, 2021, 04:50:42 am ---That extension has real value. 

It explicitly shows that two or more variables should start with the same initial state (initial value.)  That is something that single variable initialization does _not_ accomplish.

--- End quote ---
Read again:

--- Quote ---Practically it means it must make something possible that cannot be done otherwise

--- End quote ---
The OP already contains the code how it can be done otherwise, that is NOT a real value mandated by the rule. The quoted sentence above clarifies the meaning of real value because as you've tried, interpretation may vary otherwise.

--- End quote ---

By that argument, we might as well all go back to writing in assembler since anything that can be done with a compiler can be done using an assembler.

Leaving aside for a moment that the Core Developers have repeatedly stated that they won't be doing this, I think that it's necessary to distinguish between this form of multiple initialisation (at the point of definition, with all variables being explicitly the same type) and multiple assignment (where there is a risk that automatic type conversions will be applied).

Multiple assignment is a minefield in any language with automatic conversion, multiple initialisation is arguably useful.

MarkMLl

marcov:
It was exactly for this reason. Avoiding endless decisions for endless suggestions of micro syntax "improvements".

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version