这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@colombod
Copy link
Member

@colombod colombod commented Aug 28, 2019

Emit different events to clarify the semantic

when code submission evaluates to a value -> ReturnValueProduced -> ExecuteReply
when a value is produced (via display or console redirection) -> DisplayedValueProduced-> DisplayData
when a value is updated (via Update api) -> DisplayedValueUpdated-> UpdateDisplayData

case ReturnValueProduced returnValueProduced:
OnReturnValueProduced(returnValueProduced);
break;
case ValueUpdated valueUpdated:
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this indicate a return value was updated or also a display data?

Copy link
Member Author

Choose a reason for hiding this comment

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

return value maps to ExecuteReply, ma I answering your question?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is ValueUpdated being used for both return values and values produced using display?

Copy link
Member Author

Choose a reason for hiding this comment

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

display(x) produces a ValueProduced event, ValueUpdated is generated by calling the d.Update(x) method


private void OnReturnValueProduced(ReturnValueProduced returnValueProduced)
{
var openRequest = InFlightRequests.Values.SingleOrDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

I've hit a bunch of bugs with this line that was copy-pasted. I changed it to TryGetValue in my PR.

}
}

private void OnValueUpdated(ValueUpdated valueUpdated)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a lot of repeated code here. Maybe a base type for the various "value produced / updated" type events so they can go through the same method?

{
public class ValueProduced : KernelEventBase
{
public ValueProduced(
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this now correspond to display data?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes


events.Should()
.ContainSingle(e => e is ValueProduced)
.ContainSingle(e => e is Events.DisplayedValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

DisplayedValueProduced

Copy link
Member Author

Choose a reason for hiding this comment

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

I will get there .. eventually

namespace Microsoft.DotNet.Interactive.Events
{
public class ValueUpdated : ValueProductionEvent
public class ValueUpdated : ValueProducedEventBase
Copy link
Contributor

Choose a reason for hiding this comment

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

So is this more appropriately called DisplayedValueUpdated?

@colombod colombod merged commit 7d1dd59 into dotnet:master Aug 29, 2019
@colombod colombod deleted the feature/split_value_events branch August 29, 2019 12:17
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