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

Tutorial fixes #7

Merged
merged 7 commits into from
May 17, 2023
Merged

Conversation

nilslindemann
Copy link
Contributor

I have read through the tutorial again and have applied some corrections on the way.

The commits are sorted by category of the fix. It is probably most efficient to read them commit by commit.

  • The first are obvious typos
  • The next three are suggestions by LanguageTool, I agree with them
  • The fourth wraps some things in inline code
  • The sixth is a typo which LanguageTool doesn't report, but I think it is one
  • The seventh are reformulations, not always fixes

@gdotdesign
Copy link
Member

Damn I'm awful at spelling 😂 🤪 I'm using LanguageTool in the browser, but what I really need is a Sublime Text package.

Thank you very much! 🙏


On a side note welcome back to Mint! 🎉 What do you think about the recent changes?

@gdotdesign gdotdesign requested a review from Sija May 16, 2023 10:26
Copy link
Member

@Sija Sija left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nilslindemann
Copy link
Contributor Author

nilslindemann commented May 16, 2023

What do you think about the recent changes?

I guess you mean this? I can only judge from my relatively inexperienced point of view:

Allow multiple statements per block (...)
Added block expressions.
Added the ability to define default values for function arguments.
The pipe operator |> now puts the left hand side value as the first argument instead of the last. mint-lang/mint#571
Promises changed to take a single parameter instead of two Promise(value).
Added optional await keyword to statements.
Added optional await keyword to the condition of case expressions.
Added the ability to create decoder functions using the decode feature by omitting the decodable object: decode as Array(String).
Records are now using : instead of =.

I like all these changes. Very useful, improves, simplifies and adds useful to the language.

Removed try, parallel, sequence, with, where, catch, finally and then language features.

I also like these changes, though parallel could have stayed. How do we do it now? Do we have something comparable to Promise.all()? Isn't parallel {...} a nice syntax for that?

(...) added standalone block notation.

Unsure what this is, is it the same syntax as block expressions?

Removed partial application language feature (conflicting with default arguments) until we can figure out a solution for the ambiguity.
Removed safe operators &. and &(.

I guess these are good changes, as it didn't go into my head when I read the tutorial the first time XD

Added here document support:

I have seen it already when skimming through the tutorial files. I like it, but the syntax for the start and end markers is not the prettiest one in my opinion. Something like

markdown {{{
  ...
}}}

... would fit more to Mints syntax, in my opinion. markdown could be a user definable parser, like Peggy, which creates an AST which Mint can understand. So users can inject DSLs.

Standard Library improvements

I have not closer inspected that (yet), so I can not say anything relevant. What is missing in the API, in my opinion, are complete "How to use" copypasteable examples at the start of each document (not just the code snippets, which are also great). An idea which comes to my mind is a link to a thread in the forum or to a page in the project wiki with the same name, where users can add examples. The devs can then later cherry-pick the best ones to be added directly to the page.

Language Server
Fix 100% CPU in Language Server when receiving EOF from STDIN mint-lang/mint#573 @jansul
Housekeeping
Maintain dependencies for GitHub Action @Sija
Fix typos throughout the codebase @Sija
Update CI workflows @Sija
Drop support for Crystal versions (< 1.7.0) @Sija

Thanks also for these.

Maybe not the best place for such a long post, but as you asked ...

🙏

@gdotdesign
Copy link
Member

I also like these changes, though parallel could have stayed. How do we do it now? Do we have something comparable to Promise.all()? Isn't parallel {...} a nice syntax for that?

You can drop down to JavaScript and use Promise.all (we can add it to the standard library). It's not in yet but my idea for the language level is to automatically make statements execute parallelly where possible by inferring from the code:

{
  let a = await something()
  let b = await somethingElse()
  
  a + b
}

a and b can be run in parallel since they don't reference anything else from the block.

Unsure what this is, is it the same syntax as block expressions?

Yes, { ... } can be used by itself:

fun render : String {
  let x = {
    let z = "A"
    z
  }
  
  x
}

Here Documents (https://en.wikipedia.org/wiki/Here_document) are the standard way of adding string data without the need for interpolation.

I have not closer inspected that (yet), so I can not say anything relevant. What is missing in the API, in my opinion, are complete "How to use" copypasteable examples at the start of each document (not just the code snippets, which are also great). An idea which comes to my mind is a link to a thread in the forum or to a page in the project wiki with the same name, where users can add examples. The devs can then later cherry-pick the best ones to be added directly to the page.

We can have a section in the sandbox with hand-picked sandboxes for this, and users can nominate their own sandboxes for inclusion.


Thank you for the feedback, appreciate it 🙏 If you would like to further discuss any of the topics here please create a discussion and we can continue there 👍

@gdotdesign gdotdesign merged commit 03675d1 into mint-lang:master May 17, 2023
@nilslindemann nilslindemann deleted the tutorial-fixes branch May 17, 2023 16:44
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants