days
0
-13
-9
hours
-1
-3
minutes
0
-3
seconds
-3
-5
search
Explore minty fresh features

Mint programming language is an alternative to JavaScript for writing single page apps

Sarah Schlothauer
mint
© Shutterstock / Jiri Hera

Mint is a new programming language created in order to make writing single page applications (SPAs) easy, with fast, maintainable, readable code. Developed as an alternative to JavaScript, it includes built-in features similar to React, Redux, npm, Prettier, and Enzyme. View some of the language’s features that set it apart from JavaScript and give it a try in the sandbox.

Mint is a new programming language that focuses on the front-end web, specifically, it aims its focus on Single Page Applications (SPAs). According to its documentation, Mint was created the same way many great ideas are: out of frustration with JavaScript.

One of its main aims is to create safe, maintainable, fast, readable code, in comparison to JavaScript’s error-prone complexity and design flaws.

View its source code and repository on GitHub. The latest version is currently 0.7.1 and the project is currently undergoing development.

SEE ALSO: Best fonts for programming: JetBrains Mono typeface is easy on the eyes

Mint’s key features

What separates Mint from other languages? A few of its notable features include:

  • Use CSS to style elements using style blocks.
  • Contain and manage data with a  globally accessible store .
  • You can add a third party CSS library to a Mint app with just a few lines of code and then use the library in your Mint project.
  • Includes embedded features of the JS stack such as React, Redux, Prettier, npm, Jest, and Enzyme.
  • Functions are called fun instead of function. (View the language creator’s reasoning for this choice.)
  • Instead of using a library, routing is a built-in language feature. Define routes in a routes block.

Sample code. Source.

Mint features JavaScript interoperability and users can inline any and all JS code using back-ticks.

It gives users three ways of interacting with JS code: via inlining, decode expressions, and encode expressions. This allows you to invoke arbitrary JavaScript, convert JS objects to typed values, and convert typed values to JS objects.

Installing Mint

Test it out with the in-browser sandbox mode, create your own, or browse other users’ sandboxes.

Installing Mint requires a single binary file: mint. (You can also run the Mint dev environment with a Docker container.) Since it is written in Crystal, you will need to install the Crystal programming language if you wish to install from source.

View the getting started guide for a walkthrough on how to create a new project and refer to the documentation and API guide for further reference.

SEE ALSO: Programming with Beef: Open source language takes inspiration from C#

Alternatives and advantages

User discussions about the language on Reddit and Hacker News revealed some alternatives, including using TypeScript with React or a pre-configured TypeScript-Vue stack. In response to some questions about its potential advantages, the author of Mint wrote on Hacker News:

Author of the language here, I think it is a major advantage for several reasons:

  • – the documentation is in one place instead of several places
  • – the dependencies of a Mint project is usually a few megabytes since everything is included instead of hundreds of megabytes (I have a production app that does not have any dependencies at all)
  • – only need to learn one (compact) thing, instead of many complex things (complex since there is no compiler to make it simple)
  • – only need to update the code once there is a new version of the language not every time there is a new version of a dependency
  • On top of the libraries mentioned the language also includes a formatter, package manager, builder/dev server and testing environment, also for which you would need to add dependencies.

All of these add up to less cognitive load so I can focus on building the product instead of managing the development environment.

Share your opinion with us: Have you tried Mint? How does it fare and is it a viable alternative to JavaScript?

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Leave a Reply