Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Personal Todo] Check if making all bodied expressions non-lambda makes sense #88

Closed
shpaass opened this issue Apr 3, 2024 · 4 comments
Assignees

Comments

@shpaass
Copy link
Owner

shpaass commented Apr 3, 2024

Currently some of the bodied expressions are suggested to be lambdas when some others are not.
Recently, I have noticed that I would understand the properties faster if they were to be implemented as non-lambdas. Let's see if that's true for the rest of lambda-suggestions to see if I need to change editorconfig.

@shpaass shpaass changed the title [Personal Todo] check if making all bodied expressions non-lambda makes sense [Personal Todo] Check if making all bodied expressions non-lambda makes sense Apr 3, 2024
@shpaass shpaass self-assigned this Apr 6, 2024
@shpaass
Copy link
Owner Author

shpaass commented May 8, 2024

Turns out lambdas are not that hard to read. Let's see if everyone else is fine with them.

@shihan42
Copy link
Collaborator

I am fine with them for one-liners.

Using ternary operators with one-line lambdas is a little bit ugly, though. But that's just me, I won't object if you guys like it that way 😉

@shpaass
Copy link
Owner Author

shpaass commented May 10, 2024

ternary operators with one-line lambdas is a little bit ugly

I agree. Arrows don't fix readability by themselves.
However, I noticed that it's not the problem of arrows themselves being bad, but rather that the code structure has a lot of them together with one-liners.

I have a faint suspicion that the solution to that consists of more formatting and introducing the Inversion of Control pattern, and I'll see what I can do about it. Feel free to reformat one-liners into something more readable when you feel like.

shpaass added a commit that referenced this issue May 10, 2024
It turned out all those inspections that were re-enabled and didn't fix
anything were just dormant for some reason. Perhaps I should've
restarted Visual Studio for them to work.

This PR includes three parts:
* The changes mentioned
#88. Essentially,
now everything is lambdas.
```
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:suggestion
csharp_style_expression_bodied_operators = true:suggestion
```
The main reason for these changes is that we already enabled arrow
notation for the properties, and the other parts of the code stop
looking weird with arrows if you read them for a bit.
* The improvements from unmuted suggestions.
* A
[bugfix](72de773)
that I found when applying suggestions.

QA: checked the basic functionality on an existing Pyanodons project
file.
@shpaass
Copy link
Owner Author

shpaass commented May 11, 2024

Closed by #116

@shpaass shpaass closed this as completed May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants