Skip to content
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

Improve pretty-printing: wrap long lines, and abbreviate long lists and deep structures #15

Closed
julianhyde opened this issue Mar 2, 2020 · 2 comments

Comments

@julianhyde
Copy link
Collaborator

Improve value formatting. Currently, given

val emps =
  [{id = 100, name = "Fred", deptno = 10},
   {id = 101, name = "Velma", deptno = 20},
   {id = 102, name = "Shaggy", deptno = 30},
   {id = 103, name = "Scooby", deptno = 30}];

the shell will print

val emps =
  [{deptno=10,id=100,name="Fred"},{deptno=20,id=101,name="Velma"},
   {deptno=30,id=102,name="Shaggy"},{deptno=30,id=103,name="Scooby"}] : {deptno:int, id:int, name:string} list

but sml would print

val it =
  [{deptno=10,id=100,name="Fred"},{deptno=20,id=101,name="Velma"},
   {deptno=30,id=102,name="Shaggy"},{deptno=30,id=103,name="Scooby"}]
  : {deptno:int, id:int, name:string} list

and we should emulate that. Note how ': type' are on a new line.

@julianhyde julianhyde changed the title Improve how values are printed Improve pretty-printing: wrap long lines, and abbreviate long lists and deep structures Mar 7, 2020
@julianhyde
Copy link
Collaborator Author

Also, abbreviate long lists and deeply nested structures:

  • If lists have more than 12 entries, write '...' for the remaining entries.
  • In deeply nested structures, print '#' for elements more than 5 deep.

@julianhyde
Copy link
Collaborator Author

Fixed in cf2e8da.

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

No branches or pull requests

1 participant