Le 01/08/2021 à 17:59, Serhii Smirnov a écrit
I was more interested in autoconst keyword that reduces copy/pasting constant
name as it's value. camelcase and snakecase is an addition. A real example why
I wanted to use autoconst: on the past project, we had class that holds
constants with the
Thank you! Seems like Enum covers this case.
вс, 1 авг. 2021 г., 21:58 Rowan Tommins :
> On 01/08/2021 16:59, Serhii Smirnov wrote:
> > class Features
> > {
> > const FEATURE_FLAG_WITH_SOME_LONG_NAME =
> > 'feature_flag_with_some_long_name';
> > const FEATURE_SOME_ANOTHER_COOL_FEATURE =
>
On 01/08/2021 16:59, Serhii Smirnov wrote:
class Features
{
const FEATURE_FLAG_WITH_SOME_LONG_NAME =
'feature_flag_with_some_long_name';
const FEATURE_SOME_ANOTHER_COOL_FEATURE =
'feature_some_another_cool_feature';
}
That looks like it falls into my first category: the actual value
> 1 авг. 2021 г., в 17:08, Rowan Tommins написал(а):
>
> On 01/08/2021 12:21, Serhii Smirnov wrote:
>> instead of defining constants like:
>> const FOO = 'FOO';
>>
>> they could be defined like:
>> autoconst FOO; // defines a constant FOO with the value 'FOO'
>
>
> While I've certainly seen
On 01/08/2021 12:21, Serhii Smirnov wrote:
instead of defining constants like:
const FOO = 'FOO';
they could be defined like:
autoconst FOO; // defines a constant FOO with the value 'FOO'
While I've certainly seen constants like this in the past, I think they
mostly fall into two categories:
I am surprised that you called this proposal makes code less readable. Which
code is more readable:
const SOME_LONG_NAMED_CONSTATN_FROM_ENVIRONMENT =
'SOME_LONG_NAMED_COSNTATN_FROM_ENVIRONMENT';
or
autoconst SOME_LONG_NAMED_CONSTATN_FROM_ENVIRONMENT;
?
Also, could you see a typo error in the c
вс, 1 авг. 2021 г., 14:22 Serhii Smirnov :
> instead of defining constants like:
> const FOO = 'FOO';
>
> they could be defined like:
> autoconst FOO; // defines a constant FOO with the value 'FOO'
Sorry, but I'm not a fan of this proposal. Features should not be aiming at
minor savings of keyst
>
> Hello!
>
> This is my first RFC proposal. I have an idea about introducing autoconst
> keyword.
> Motivation:
> reduce duplicated code (copy/pasting constant name as value)
> reducing potential typo errors in constant values
>
> instead of defining constants like:
> const FOO = 'FOO';
>
> they
Hello!
This is my first RFC proposal. I have an idea about introducing autoconst
keyword.
Motivation:
reduce duplicated code (copy/pasting constant name as value)
reducing potential typo errors in constant values
instead of defining constants like:
const FOO = 'FOO';
they could be defined like: