On 26/08/13 22:34, David Matthews wrote:
You would have to write your own version of PolyML.prettyPrint and your own REPL to use it. Neither of these are very complicated and I can point you at the existing code as a basis. PolyML.print and PolyML.makestring, if you actually use them, would use the original pretty-printer. You would not need your own PolyML.addPrettyPrinter. That just adds a function that generates a "pretty" data structure to a particular type and doesn't care whether the data structure includes your own ContextProperty values.
Yes, I?d certainly be interested in seeing how to write my own REPL. I?ve long meant to try this as it would allow us to use a custom lexer as well. Please let me know where to look for the relevant docs/sample code. I assume that without an addPrettyPrinter function, this custom REPL would not be extensible in the same way that the default one is. I don?t think this would be a big deal in practice.
I can see the advantage of changing PrettyString to include an explicit length; it's just that doing that would involve changes to nearly all the existing pretty-print functions. That's not just in Poly/ML code but any user code as well. It might be simpler to add a new constructor to the pretty datatype. I'll give it some thought but just at the moment I want to get the current version released before making any more changes.
I agree that you?d want to keep the existing constructor without the size information. With luck, adding a new constructor with explicit size information would be minimally intrusive.
Thanks, Michael