
Mint-lang: a language for the front-end web - galfarragem
https://www.mint-lang.com/
======
sriku
What I would really like is for JS to have a good macro system so I don't have
to subscribe to the two caste hierarchy of language creator and language user.

Sweet.js [1] did it for me initially as cspjs[2] had async, await and more
years before ... but I never found the time to ramp up to the updated version
sadly so I can't comment on its state now.

[1] [https://www.sweetjs.org/](https://www.sweetjs.org/)

[2] [https://gitHub.com/srikumarks/cspjs](https://gitHub.com/srikumarks/cspjs)

~~~
Willamin
The two caste hierarchy is my biggest issue with Golang. Macro capability
exists in Golang, but only for the upper caste of language creators. It makes
me feel like the language creators of Golang purposefully decide that users of
the language aren’t smart.

~~~
tonyg
Rob Pike, in his own words, claims that programmers at google are "not capable
of understanding a brilliant language", and that this is the reason why Go is
designed the way it is.

The full quote:

> The key point here is our programmers are Googlers, they're not researchers.
> They're typically, fairly young, fresh out of school, probably learned Java,
> maybe learned C or C++, probably learned Python. They're not capable of
> understanding a brilliant language but we want to use them to build good
> software. So, the language that we give them has to be easy for them to
> understand and easy to adopt.

\-- Rob Pike, 2014, at ~20m50s of [https://channel9.msdn.com/Events/Lang-
NEXT/Lang-NEXT-2014/Fr...](https://channel9.msdn.com/Events/Lang-NEXT/Lang-
NEXT-2014/From-Parallel-to-Concurrent)

~~~
daxfohl
That's been my experience at Microsoft. I'd love to start a new project there
in F#. And I think the kids there would eventually grasp it and create better
code. They're certainly smart enough. But it would take a while to unlearn
OOP. My first year or two of F# code was complete crap. So given average
tenure of a fresh grad bigcorp employee is a couple of years, it would not be
worth it. I think this is a good decision though an unfortunate reality by Rob
Pike.

~~~
bgorman
A solution might be to change the hiring process to test FP concepts instead
of OO, or to use a lisp- so users do not need to learn a complex type system
in addition to FP.

~~~
dvlsg
If they are using C# (I'm making that assumption - I could be mistaken), the
type system in F# isn't a huge leap in terms of learnability. It wasn't that
way in my experience, anyways.

The learning curve seems to be with other aspects - like where the hell do I
put my I/O? Error handling? How do I trace (or write) all these functions that
are piped or composed together? Questions like those are what I tend to see.
Both personally and when pointing other people to F#.

~~~
seanmcdirmid
As an ML, F# isn’t a pure FP, so I/O and error handling shouldn’t be that
hard.

But ya, functional oragami will make debugging harder even in C#.

------
cprecioso
For the ones who want to get (a similar) developer experience while coding
actual JS(X): you can use `react` together with `mobx` to the same effect.
Additionally, take a look at `mobx-state-tree` to get more structured code.

And of course, there's Elm if you want to get a completely different thing.

~~~
jadbox
mobx-state-tree is really neat and feels like the next step beyond redux. Not
having to create explicit event names and 'action dispatchers' is a real boon
to DRY. The only issue I've had is more to do with typescript and using mobx-
state-tree plus react router... the type definitions and type error messages
can get rather confusing to debug.

~~~
mieseratte
> Not having to create explicit event names and 'action dispatchers' is a real
> boon to DRY.

What about an action creator / reducer isn't dry?

~~~
nightski
You have the name of the action and the name of the action creator which
essentially represent the same thing. I've never seen a project which had
multiple creators for the same action name.

------
laumars
I can see why they colour coded blocks. I think that project would have been
unreadable otherwise. Which is ironic because even the worst of HTML with
inlined CSS and JavaScript is more readable (albeit less maintainable).

------
joshsharp
Cool to see that this is written in Crystal.

------
gdotdesign
Author here, please keep in mind that Mint is still very young and I'm still
working to get things in order for a first stable-ish release (there are a lot
of documentation to write and lot of cleanup work)

------
nedp
I'm glad that this project was written on Crystal. But does it tries to be
like Elm?

~~~
gdotdesign
The author here, I was using Elm for a while invested a lot of time in it so
there are parts of it that I like and that are parts that I don't.

In a sense it tries to be like Elm:

\- good developer experience with nice error messages

\- single binary that have all the tools

\- enforcing types

\- no runtime exceptions is you don't use JS interop

In an other sense it tries not to be like Elm:

\- JSX syntax with easy compose-ability

\- Straightforward JS interop

\- Decentralized and open package management

------
desireco42
I don't think I can make up my mind over small example. I don't think it is
bad it is using patterns from React or Mobx as they are well known and it can
help us think about development.

Syntax is not such that I am immediately sold, but also not put off. What I
didn't see is some performance promise like Elm, or simplicity, where it make
sense to use this over anything else.

I think it is good that a lot of people are thinking about languages and how
to improve development, not everything has to be ground breaking. I will keep
an eye for future work and how it develops.

~~~
gdotdesign
Thank you for this comment! It really helps a lot to get decent feedback.

> What I didn't see is some performance promise like Elm, or simplicity, where
> it make sense to use this over anything else.

I was focusing on the example, it seems I should really put up more
information about this on the website, but to answer for this is basically:

\- it uses React under the hood meaning you have the same performance, the
devtools works the same, it is possible (with some work) to use components
from Mint in React and vice versa.

\- the error messages are really nice (there 281 unique error messages
overall) both for syntax errors and type errors

\- easy JS interop using backticks

\- no import statements

\- fast compile times (the website compiles around 1 second)

\- single binary with all the tools included (development server, production
builder, favicon generator, test runner)

------
wruza
>The else branch must be present, if it's missing you will get a syntax error
this is to make sure that all of the possibilities are covered

Is there itsokay statement to pacify the compiler more?

~~~
always_good
If if/else is an expression, what would be the return type of `if (true) { 42
}`?

~~~
klibertp

        int option 

which is basically a variant/union like this:

    
    
        Result of 'a | Void
    

You could also have a `discard` or `ignore` function/operator, which can
swallow every type, so it doesn't matter what it was. Some languages actually
require you to use such operators, for example, Nim and F#.

------
captainbland
Web languages seem to be the new web frameworks for JavaScript - in the sense
that there seem to be more and more of them coming out all the time.

------
mathgladiator
This is really cool, and I did something very similar (more hackish) ten years
ago. This is a very powerful technique, and I wish the mint team the best. The
downside is really a combination of building a community and educating people
about it; this is where I failed along with SEO.

~~~
gdotdesign
> The downside is really a combination of building a community and educating
> people about it

Yes, this is what I'm worried about.

I'm still tweaking a lot of things and I wanted to share it with HN when I
thought it was ready, but on the other hand it's a nice that it got some
attention already.

I hope there will be enough interest over time to actually build up a
community.

------
herbst
Just a empty white page on my phone.

~~~
Willamin
You'll need to have Javascript enabled to see the page. Mint's website is
written in Mint, which is a compile-to-javascript front-end language that
"tries to solve most common issues of Single Page Applications".

~~~
herbst
I have. Using Opera mobile tho.

------
carapace
Blank page with JS disabled.

"Nothing to see here." literally.

------
faaq
Awesome!!!

~~~
perfectnsphere
Why do you think it's awesome? It's just another zealous implementation of
some guys unearned and unfounded ideology. You know you can write the same
thing with regular JavaScript and cut out the middle-man.

~~~
jack9
A polyglot is harder to reason about than a single language, due to social
concerns. Mostly this is due to the efficiency of singular concern and
custodianship as opposed to disjointed languages with their own.

------
JasonFruit
How about just biting the bullet and writing JavaScript?

If I decided I wanted to use Delphi, but I didn't like Object Pascal, so I
implemented a Scheme over the top that gave weird deep backtraces with wrong
line numbers whenever an error occurred, compiled to a single-line semicolon-
delimited mess of unidiomatic Pascal, and often required me to write some
Pascal anyway, you'd think I was nuts. Why do we think it's a good idea just
because it's in a browser?

JavaScript has its problems, but it's far from the worst language out there.
Just write JavaScript already.

~~~
srgpqt
I think you just described ES6 compiled by Babel pretty well. Most people have
gotten used to this disconnect.

~~~
klodolph
Well, with Babel you at least have source maps so you can get the original
source locations in your backtraces.

~~~
Willamin
There's nothing stopping other compile-to-javascript languages from having
source maps too

~~~
klodolph
Yes, it’s a pretty standard feature which is why it works so well. You can
Typescript->ES->bundled ES->bundled minified ES and Chrome will point you
directly at the original source in the debugger (once you give it permission).

------
ebbv
Working on a project in Angular right now I’m really questioning if the layers
of abstraction on front end code are worth the cost. The compile times and
performance costs over writing standard JS are real.

~~~
mg74
The complexity and maintenance costs of developing a real-world application in
standard JS are also real.

~~~
megaman22
Or you could design your application to not need all the bells and whistles
and complicated shit that modern front-end web UIs throw in. 90% of pages
_could_ be static HTML. Probably 95% of "web applications" could be a set of
forms with post-backs.

If I'm trying to make a thick-client, I'd rather build it in a language and
platform that I don't have to fight quite so much.

~~~
mg74
Have you actually done it? I have, a team of 10 to 15 programmers building it
for over an year (SPA, deployed on web, iOS and Android), and now I lead a
team of 5 programmers maintaining it and developing new features. I will
gladly pay the cost of a good abstraction for lower complexity.

~~~
megaman22
Yes, I actually have. A plain old-school Razor view UI with post-backs was
infinitely easier to maintain than the cobbled together mess of javascript
that we've ended up with trying to move away from that old, unsexy technology.
And almost everything is an order of magnitude harder to do, or to make
changes to.

------
SegFaultCDumped
Do we really need yet another language for the web?

~~~
mariocesar
Every alternative I know is based on Ecmascript, what other alternatives are?

~~~
dom96
Nim. I just finished developing a forum using the Karax SPA framework and it's
been a great experience: [https://github.com/nim-
lang/nimforum](https://github.com/nim-lang/nimforum).

------
alexandernst
This stinks as a masked React

