Refactoring Code

ryuukk_ ryuukk.dev at gmail.com
Wed Mar 6 10:39:17 UTC 2024


On Monday, 4 March 2024 at 22:52:18 UTC, kdevel wrote:
> On Sunday, 3 March 2024 at 09:59:28 UTC, ryuukk_ wrote:
>> ```D
>> package CppOperator isCppOperator(const scope Identifier id)
>> {
>>     return switch (id) {
>>         :_cast       => :Cast;
>>         :assign      => :Assign;
>>         :eq          => :Eq;
>>         :index       => :Index;
>>         :call        => :Call;
>>         :opUnary     => :Unary;
>>         :opBinary    => :Binary;
>>         :opOpAssign  => :OpAssign;
>>         else => :Unknown;
>>     };
>> }
>> ```
>>
>> Symbols won't clash, and it has less noise
>
> The code is tagged as 'D' but what is the real name of the 
> language?

"i'd prefer to do it this way"

Contraction for "'i would' prefer", i should have used proper 
english, my bad

That's how improvements happen, you find an annoying it, and 
suggest something to make it better

As for the "tagged as 'D'", it's simply just to give the post 
some colors, i am a person with taste and i care for the reader's 
pleasure and convenience

"switch as expression", and "safer pattern match"


More information about the Digitalmars-d mailing list