disco-lang / disco

Functional teaching language for use in a discrete mathematics course
Other
163 stars 23 forks source link

Flag to use only ASCII output #294

Open byorgey opened 3 years ago

byorgey commented 3 years ago

Perhaps the default should be to pretty-print everything using ASCII syntax --- for ease of copy-pasting --- but with an extension to enable pretty-printing with Unicode syntax?

byorgey commented 2 years ago

Nah, copy-pasting is easy enough no matter whether we use ASCII or arbitrary Unicode. Actually, now I am thinking that I like the default of printing things using nice-looking syntax, but we should add a flag to use only ASCII. This is related to #250 --- doing the switch would probably help here.

byorgey commented 2 years ago

We could actually do this pretty easily even without doing #250 --- just add a flag to the read-only context for pretty-printing and use it to select ASCII-only concrete syntax (instead of just using the first thing in the list).

byorgey commented 9 months ago

One original idea I had was to annotate each terminal with its ASCII equivalent, and select which to use at rendering time. But note that doesn't allow prettyprinter to take the different widths into account. So I think this does just need to look like a flag to the prettyprinter so that it selects which concrete syntax to use.