Skip to content

Conversation

@TIHan
Copy link
Contributor

@TIHan TIHan commented Apr 28, 2020

FsiEvaluationSession didn't have an easy way to get the state of all values bound to an identifier at the root-level. Before, a user had to rely on listening to ValueBound events and not able to query for the current state of the value without having to perform an Eval.

Introducing GetBoundValues and TryFindBoundValue to FsiEvaluationSession simplifies this process.

match tryGetGeneratedValue istate cenv v with
| Some fsiValue ->
yield FsiBoundValue(nm, fsiValue)
| _ ->
Copy link
Member

Choose a reason for hiding this comment

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

When would istate.boundValues have an item, only to not actually be found by tryGetGeneratedValue?

Copy link
Contributor Author

@TIHan TIHan Apr 29, 2020

Choose a reason for hiding this comment

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

I think I see what you are saying. Why would there be a try in the first place? If it's there, then we don't need to try. I can always see tryGetGeneratedValue returning something for each item in boundValues. We could throw an error instead of returning nothing, but I was following the existing pattern of handling results when looking up the generated values.

Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

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

Nice

@KevinRansom KevinRansom merged commit 8b7934f into dotnet:master Apr 29, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
…on (dotnet#9068)

* Added GetBoundValues/TryFindBoundValue to FsiSession. Added FsiTests.

* Added more tests
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

Successfully merging this pull request may close these issues.

3 participants