Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@bettinaheim
Copy link
Contributor

Currently, the implementation requires that for a cycle, the verification is invoked for each node. I'll see if I can find some time to be more clever about it. As a first thing to work with, this should do however, and also gives a good base line to test.

Copy link
Contributor

@ScottCarda-MS ScottCarda-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting to be a lot of comments, so I thought I would break it up a bit. I still need to look over the inner details of the TryCombineTypeResolutions method and the unit tests.

A lot of them are small things, or things that I can do I my end after the PR is in, if you are eager to get the PR. If there is any comment you'd rather I address after the fact, just put a response saying as much.

Once thing in particular I am hoping we can change is the signature for TryCombineTypeResolutions. I know we tend to use the Try-method pattern a lot in this code base, and sometime it is especially convenient, but using out parameters is generally to be avoided if possible, especially if the method also has a variable number of parameters as the TryCombineTypeResolutions does.

Here are two resources to consider when considering out-parameters:

@bettinaheim
Copy link
Contributor Author

bettinaheim commented Apr 6, 2020

Getting to be a lot of comments, so I thought I would break it up a bit. I still need to look over the inner details of the TryCombineTypeResolutions method and the unit tests.
A lot of them are small things, or things that I can do I my end after the PR is in, if you are eager to get the PR. If there is any comment you'd rather I address after the fact, just put a response saying as much.
Once thing in particular I am hoping we can change is the signature for TryCombineTypeResolutions. I know we tend to use the Try-method pattern a lot in this code base, and sometime it is especially convenient, but using out parameters is generally to be avoided if possible, especially if the method also has a variable number of parameters as the TryCombineTypeResolutions does.
Here are two resources to consider when considering out-parameters:

Avoid Out Parameters: https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-2.0/ms229053(v=vs.80)
Out Parameters Best Practices: https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/parameter-design

Ah, that's a tough one. What is your concrete suggestion? Instead having the signature be
public static (bool, ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>) TryCombineTypeResolutions (QsQualifiedName parent, params ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>[] resolutions)?
It just seem weird to me since all the C# methods like TryParse, TryGetUri, Try* follow the pattern of returning a boolean and giving the value - if any - as out parameter. I would also argue that implementing this method is not exactly "designing for a general audience", given its purpose.

Copy link
Contributor

@ScottCarda-MS ScottCarda-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the logic for the TryCombineTypeResolutions method is still a bit confusing to me. I am hoping that once you address some of the comments I left, it will be clearer to me.

bettinaheim and others added 2 commits April 6, 2020 13:44
Co-Authored-By: Scott Carda <55811729+ScottCarda-MS@users.noreply.github.com>
Co-Authored-By: Scott Carda <55811729+ScottCarda-MS@users.noreply.github.com>
@bettinaheim bettinaheim merged commit 2f8e71f into sccarda/CallGraphWalker Apr 10, 2020
@bettinaheim bettinaheim deleted the beheim/typeResDicts branch April 10, 2020 02:39
@bettinaheim bettinaheim restored the beheim/typeResDicts branch April 24, 2020 01:15
@bettinaheim bettinaheim deleted the beheim/typeResDicts branch April 26, 2020 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants