Allow REPL command return object to be accessible · Issue #814 · scriptcs/scriptcs · GitHub
Skip to content

Allow REPL command return object to be accessible #814

Description

@glennblock

Currently custom REPL commands allow returning an object which is then dumped as a string to the REPL.

This feature will introduce an method that will accessing the return value as an object.

Example using a fictional :http_get command which creates an HTTP request.

:http_get www.yahoo.com
var result = GetResult<HttpResponseMessage>();
Console.WriteLine(result.StatusCode);

In this case :http_get is a REPL command that uses HttpClient to make a request. It then returns the response. GetResult then retrieves the previous result and casts it as a response message.

Another option would be to dynamically create a variable on the fly of type HttpResponseMessage and compile it in via a submission.

Using this approach will allow cleanly to transition from the command world to code.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions