json icon indicating copy to clipboard operation
json copied to clipboard

init-list guidance

Open vinniefalco opened this issue 3 years ago • 5 comments

The rule for construction should be

"Always use () unless you want an array."

vinniefalco avatar Nov 16 '20 19:11 vinniefalco

Hey @vinniefalco, I am a new contributor. will you please explain this issue? I want to contribute to this repo.

Siddharth-coder13 avatar Nov 26 '20 09:11 Siddharth-coder13

Is this really true? We use init-lists in tests to create objects.

grisumbras avatar May 23 '22 18:05 grisumbras

Is this really true?

I'm not sure but I know that init-list construction is problematic because of C++ and there is nothing we can do about it except warn users in the docs.

vinniefalco avatar May 23 '22 18:05 vinniefalco

Ah, you mean that we should explicitly dissuade users from using complex init-list expressions?

grisumbras avatar May 24 '22 07:05 grisumbras

Something like that, yes. We can probably ignore this until someone reports an actual issue.

vinniefalco avatar May 24 '22 13:05 vinniefalco