DEV Community

Szikszai Gusztáv
Szikszai Gusztáv

Posted on

Mint - A refreshing programming language for the front-end web

TL;DR: Mint is a typed programming language which compiles to JavaScript for building single page applications. https://www.mint-lang.com

Why?

The first obvious question is: why build another programming language that compiles to JavaScript? To answer that question we should look at how front-end development could be done in an ideal world.


Imagine that you sit down before your computer in the morning and start working on the project that has gone on for a while. It’s not a big project so to speak, it’s just the front-end of some business that sells stuff, it connects to an API to get the data and display it for the user.

You cd into the project directory and start it up with a single command. After a second or two, you open up your editor and your browser and are ready to implement a new feature.

You start working on it, and make some mistakes, which is not a big deal because the compiler shows you these awesome error messages that enables you to fix them quickly.

Changes you make are compiled quickly, so you are making good progress, but as it happens you need a third party package to complete the feature, you look it up on-line, add it to your projects dependencies and install it with a single command and are ready to go.

After that you need to look up the documentation for a function that is needed for the feature, you start the documentation server of the locally installed packages and open it up in the browser, after a minute or so you have successfully found what you need.

After business logic is finished, you add some styling to the components you have created, easily and without hassle because it’s part of the language.

At the end of the day, you write some tests for it and run in different browsers to make sure that is all good. Then you document your code with some comments, format it with the build in formatter and the feature is ready to go.

As you commit and push your changes, you look back on the day, pleased that no big issues came up and you were able to finish the feature quickly, but it does not surprises you because most days are like that.


Sadly the current development process is not really like that, but it could be. In short, the goal of Mint is to give you that experience.

What is Mint?

Mint is programming language and a framework which offers a complete package for writing single page applications.

It has the following language features:

  • Everything is typed using a simple type system
  • 200+ unique error messages to help you on the way
  • Everything is an expression
  • Components are the building blocks of the language
  • HTML can be written with minimal differences
  • Scoped CSS can be written for elements in components
  • Modules for organizing functions
  • Stores to handle data which can be connected to components
  • Routes can be defined inside the application
  • Easy JavaScript interoperability
  • Constructs for synchronous and asynchronous computations
  • and much more…

The language has the given tools built in:

  • A command to initialize your application/package
  • A decentralized package manager
  • A development server which reloads when files are changing
  • A formatter that formats your code in a unified style
  • A testing system which runs in headless browsers
  • A server to browse the documentation of the used packages
  • A build system to produce production ready files
  • and many more…

Mint vs X?

At this point you might wonder how Mint compares to other languages / frameworks such as TypeScript or Elm or Vue, this post is not about that. There will be a series of articles comparing them with Mint.


This post aims to give you a sense of what Mint is. Keep an eye on this space for more posts about the features of Mint which will describe them in detail.

Website: https://www.mint-lang.com
Github: https://github.com/mint-lang/mint
Source code of the website Mint: https://github.com/mint-lang/mint-website

Top comments (22)

Collapse
 
paulmatencio profile image
Paul Matencio

You forget Dart in the list of typed language. Furthermore dart is the language of flutter.io therefore you will learn to develop progressive web app, web components and native application for Android and iOS. Conclusion it is better to learn Dart if you want to learn a strong types language.

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez • Edited

I love to see Innovation and wheel reinvention (not saying it in a bad way). People often like to say why to create something that has already been created, but that's precisely how we arrived to the loved angular/react/vue mainstream combo today, the three reinvented someone else's wheel and I'm pretty sure people often said that when these things were very new.

I think new concepts, langs like these are the reflection of how our actual wheels are going, and this seems a fine and precise work on how to correct some issues that people are still facing today.

Question

I would just ask if there's the intention of using mint to compile web component projects (something like what polymer tries to do), I think this is a good place where Mint can target and be succesfull taking in mind that components are already the building blocks of the language.

Collapse
 
gdotdesign profile image
Szikszai Gusztáv

Thank you for that comment!

It could certainly be compiled to web components, it's technically possible, but I don't think it's the right way to go:

  • the spec is not very well supported: caniuse.com/#search=web%20components it can be polyfilled but that's not ideal.

  • if components would be reused outside of the language then we would lose type safety or we would need to implement runtime type checking on the boundaries.

  • there is no spec as far as I am aware for virtual DOM to be implemented in a browser, dropping this requirement would mean that either the implementation still have to be in the application or we would lose performance rendering with innerHTML.

Collapse
 
emkographics profile image
Emko

We need to add this to the vast list of existing javascript frameworks. en.m.wikipedia.org/wiki/List_of_Ja...

Keep'em coming. It is never enough.

Collapse
 
gdotdesign profile image
Szikszai Gusztáv

Thanks for the comment!

How open are its constructs to extension to support future patterns and strategies?

The language and the compiler is structured to be easily extendable, so supporting future patterns should be easy.

Are you looking at a wasm compiler target as well?

It's not likely, as WASM is still very young, maybe once it matured enough. Check out this issue for further information: github.com/mint-lang/mint/issues/4...

Do you have a bnf grammar for the language?

No, if there is enough interest one can be created.

Collapse
 
nssimeonov profile image
Templar++

A couple of other languages, that compiled to JS sort of "died" in the past year, yet you create a new one. So the most serious questions are:

  1. You are about to compete with TypeScript - do you believe you can catch up? They are many years ahead plus they are very very close to JS and people with JS background can start using it right away with minimal changes in their habits.
  2. Your decentralised package manager is going to compete with npm and it's enormously big codebase. Will you build some sort of package import and how do you plan to attract developers?
Collapse
 
gdotdesign profile image
Szikszai Gusztáv

Thank you for the comment, here are my answers:

  1. As you wrote TypeScript is very similar to JavaScript and Mint is very different from both, it has more things in common with Elm or Reason so that can be one of the factors. I think that the main reason people might use Mint is that it's compact, it has all the tools needed in one single binary, only one thing to learn.

  2. The idea for a decentralized package manager is actually coming from the Crystal programming language (which the compiler is written in), it seems to be working for them so far. It really simplifies things because any Git repository can be a package so there are no servers to manage, and for private packages the only thing needed is an SSH key.

Will you build some sort of package import

NPM packages are not compatible with Mint packages, it's easy to include external JavaScript files in a package so porting popular libraries should not be a big issue.

how do you plan to attract developers?

It will be difficult for sure. I am planning to write many posts about the parts of the language for education purposes, posts about how it compares to an other language, and Mint packages and applications for demonstration purposes.

Collapse
 
nssimeonov profile image
Templar++

What language Mint is similar to is irrelevant. If the language is superior to another is also irrelevant. Take for example PHP - it's not superior to any language. It's actually a big pile of crap, yet it became popular.

If you will compete with other languages you need to consider all other pieces of the ecosystem like NPM packages and compatibility with already existing software. TypeScript is very close to JS and it can use existing NPM packages without any effort. With minimal effort they get type information too.

JS is very very popular at the moment, not so sure about Elm and definitely not Crystal or Reason (I had to google these and I have over 20 years of experience and I tend to keep the pace and know what is going on around here).

My point is, that choosing this language over JS or TypeScript for a project seems to be a hard business decision and only a few companies may risk investing in it...

 
jvarness profile image
Jake Varness

Choosing to use a hybrid app platform can be a tough decision, especially with how many choices developers have now adays: Cordova, Ionic, NativeScript, React Native, Flutter... The list goes on and on.

There are going to be pros and cons with all of these options if you compare them to true native apps: managing 2 sources vs 1 (which, if you're lucky, won't turn into 3), the amount of support you can get, the tools and libraries available to you, etc.

Here are some perspectives from individuals who have used these frameworks professionally:

youtu.be/MeBNODUCLfc
medium.com/airbnb-engineering/suns...

A good comparison of hybrid app frameworks:

youtu.be/rb8smP_xTTY

Collapse
 
leob profile image
leob

Okay, so why not Elm? A fairly well established strongly typed language that compiles to JS and does most things that you mention ...

Collapse
 
gdotdesign profile image
Szikszai Gusztáv • Edited

Thanks for the comment!

I'm going to write a more lengthy post about it, but in short:

I used Elm for a while, it is a nice developer experience. It made me realize that there is a better way to develop things. I tried to expand that ecosystem and contribute to the community (check out my Github repositories if like) but it didn't turn out well, since my vision is different then their core teams.

But in my experience (and opinion) it's really restricting (both development and community wise), it has a lot of unnecessary boilerplate an doesn't address the main issues well:

  • there are no components, everything is a function
  • there is no local state so reusing logic is difficult
  • styling, routing, testing is done with a third party package
  • it is more academic then useful, for example there are more data structure packages and less UI / component like packages
  • it is constantly changes with every release, things that are working fine are refactored for reasons I cannot fathom
  • interacting with Web APIs which don't have an official package is a hard

I could probably go on for a while but so I'll stop now :)

Collapse
 
leob profile image
leob • Edited

Elm is a pure FP language, which is clearly not for everyone, that's probably the issue. Thanks for this incredible project (Mint lang), putting together a completely new programming language with all of the tooling around it ... impressive!

Question: how does this work with things like React, Virtual DOM, etcetera? Could you write React apps in Mint?

(however it's not recommended yet for production purposes? "Mint is currently in alpha stage, although it's usable for testing purposes")

Collapse
 
osninja_io profile image
The OpenShift Ninja

Going to check this out. Looks refreshing - hence a really good name. :)

Collapse
 
yashank09 profile image
Yashank Varshney

Lol to be honest those steps mentioned above sounds just like my process with frameworks/libraries like Angular or React.....

Collapse
 
kozlown profile image
Nigel

Looks cool ! I'll keep an eye on this for sure 🤔

Collapse
 
jvarness profile image
Jake Varness

It's gaining a lot of popularity. Flutter especially is gaining a lot of popularity.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.