smlfmt icon indicating copy to clipboard operation
smlfmt copied to clipboard

SuccessorML syntax

Open frou opened this issue 3 years ago • 8 comments

Hi there - Thanks for the nice tool.

I'm wondering what your stance is on smlfmt being able to format code that uses the SuccessorML syntax additions:

http://mlton.org/SuccessorML

Personally I like allowOptBar, allowOrPats, and allowRecordPunExps of those, and having to choose between being able to use them, and being able to autoformat code, is a tough choice!

frou avatar Jan 11 '22 17:01 frou

Great suggestion. I'm definitely interested in adding these!

shwestrick avatar Jan 11 '22 17:01 shwestrick

Starting work on this. At the moment:

shwestrick avatar Jan 03 '23 16:01 shwestrick

@frou These should now be working:

-allow-opt-bar true -allow-record-pun-exps true -allow-or-pats true

If you have a chance to try them out on your code, that would be really helpful. Please let me know if you encounter any problems!

I'll leave the issue open for now, because I'd like to add support for other SuccessorML features, too.

shwestrick avatar Jan 06 '23 21:01 shwestrick

Sam - thank you very much. They are working, including the hints to enable them if the flags aren't given. Great stuff!

frou avatar Jan 07 '23 08:01 frou

Excellent! Glad to hear.

shwestrick avatar Jan 07 '23 15:01 shwestrick

These features can now also be controlled from within an MLB; see #73.

shwestrick avatar Jan 08 '23 17:01 shwestrick

Nice. If that part gets completely built out, then I think one notable scenario to test is when the MLB author deliberately "overshoots" by enabling everything, and then backs off the one or two that they don't like, e.g.

ann
  "allowSuccessorML true"
  "allowOptSemicolon false"
in
  foo.sml
end

frou avatar Jan 08 '23 20:01 frou

Cool! This makes me think that there are a lot of interesting code linting features that smlfmt could eventually offer.

shwestrick avatar Jan 09 '23 16:01 shwestrick