Refactoring Code
ryuukk_
ryuukk.dev at gmail.com
Sun Mar 3 09:59:28 UTC 2024
On Sunday, 3 March 2024 at 09:47:28 UTC, Max Samukha wrote:
> I could list a number of random points in favor of the original.
There was nothing good about the original, the new code is so
much better and easier to read
Although, i don't like the double `with`, i'd prefer to do it
this way personally:
```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
More information about the Digitalmars-d
mailing list