dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
268 stars 53 forks source link

add pretty print to object mod #732

Closed briandowns closed 7 months ago

briandowns commented 7 months ago

Resolves: #682

What's Changed:

Added pretty print function into the Object module.

Type of Change:

#

Housekeeping:

#

Screenshots (If Applicable):

Jason2605 commented 7 months ago

A question for you, would you expect a method called prettyPrint to actually output to stdout rather than return a string? I think a method that returns the pretty output as a string would be useful but potentially under a different name, what do you think?

briandowns commented 7 months ago

Yeah, that's a good point. I'll update this to print to stdout. What would you want the method name to be that would returned the "pretty" string?

Jason2605 commented 7 months ago

Actually we probably don't need the non-print version as you can just use JSON.stringify - at least for the minute until we extend it so we can pretty print more objects that aren't JSON serialisable

briandowns commented 7 months ago

Good point.

Jason2605 commented 7 months ago

Thanks so much for this!