-
Notifications
You must be signed in to change notification settings - Fork 370
Custom Printers #1141
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
Custom Printers #1141
Conversation
|
Thanks a ton for the effort @gregoryyoung, this looks VERY COOL!. I'll take a look at the code.... |
|
OK, I took a look. I am scared now :-) Mainly because I see you having to make changes to a bunch of our core interfaces which is a breaking change. I'll take a look and see if there is a better way / if dependency injection can help here. |
|
OK so first thing, is you shouldn't expose the Repl object itself to the Repl. We can add the AddCustomPrinter method directly to the Script host and then it will show up as an ambient method one can call. |
|
I am going to pull this down and see if I can refactor it. Then I'll send a PR to your branch. |
|
@gregoryyoung I am working on an approach that will move the AddCustomPrinter method to be exposed off our "env" object. It should require only changing the |
|
@gregoryyoung sent you a PR: https://github.com/gregoryyoung/scriptcs/pull/1. I started from the latest "dev" rather than from your branch, then I pulled from your code and refactored. Take a look. If you want to test, try pulling the latest scriptcs/dev first. |
|
Seems reasonable. As I mentioned Repl on script host didn't see right (it also caused circular dependencies which is why I had to jam in the setter). I will try writing the equivalent of privateeye.fsx against it and see how it works |
|
I would suggest a different route. Since we are talking about customized pretty printing, I would add this to the The benefit is:
|
|
in fact this was brought up before, exposing |
|
Exposing console is one thing and adding pretty print to the console is On Wed, Mar 23, 2016 at 11:05 PM Filip W notifications@github.com wrote:
|
|
I am not sure if I was clear about the motivation but what I am trying to achieve is exposing something that is always usable - and can be consumed for both script and REPL. The current solution here (adding it on the host or The alternative would be to simply expose pretty print on the host but only on the REPL host (so have |
|
It is useful for both script and repl (though usually more useful for repl On Wed, Mar 23, 2016 at 6:17 PM, Filip W notifications@github.com wrote:
Studying for the Turing test |
|
I understood what you are trying to do, though I disagree. The pretty On Wed, Mar 23, 2016 at 11:47 PM Filip W notifications@github.com wrote:
|
well that is my point, then it should be hidden from the There is one more thing. |
|
I am a bit curious on the use case mentioned for abstracting console I know in the windows world things aren't always very composable but in the On Wed, Mar 23, 2016 at 6:40 PM, Filip W notifications@github.com wrote:
Studying for the Turing test |
|
@gregoryyoung what you are suggesting is also possible, the idea was to have it more structured and composable, with clearly defined contracts, that's all |
|
And simplicity. The IConsole abstraction is easy to write unit tests On Thu, Mar 24, 2016 at 12:20 AM Filip W notifications@github.com wrote:
|
|
Hi gents! I believe this is quite en important feature. What I normally need is to quickly print a List This is a little library I did for this purpose: |
|
@gregoryyoung can you resolve the conflicts so I can merge this? |
|
Closing this as I believe #1156 addressed this. |
|
👍 On Tue, Sep 6, 2016 at 3:07 AM, Glenn Block notifications@github.com
Studying for the Turing test |

This is not intended to be accepted but to act as a point of discussion
I have implemented here custom pretty printing into scriptcs. I felt something like this after writing it.
Its really ugly. The code does however now work. Here is an example:
This is a very common thing used in the F# repl. As an example here is a little library that gives you definitions for record types http://fssnip.net/cV so it looks like
We make heavy use of this in privateeye
Now in terms of implementation the one here is a mess but I think it can be improved upon. I don't know all the code that well, In dealing with the dependency graph:
I really don't think Repl should be exposed all the way on ScriptHost but it may actually be useful there as you can easily add quite a few other Repl configurations there. An alternative might be to isolate the dependency into ICustomPrinter and put this on ScriptHost.
Some of the rest will likely require some refactoring of dependencies and how they relate. Before just embarking on that I figured it would be worth bringing it up as a discussion.
So first question, does pretty printing seem like a reasonable feature worth following up on?
Second question, how do people see refactoring things to make dependency handling a bit more sane than it is here?
Greg