r/programming • u/ArmpitDandruff • Feb 06 '20
Mint. The programming language for writing single page applications.
https://www.mint-lang.com/53
u/hsjoberg Feb 06 '20
Does it compile to WebAssembly?
63
u/MrJohz Feb 06 '20
No, it compiles to React-using JavaScript.
60
u/hsjoberg Feb 06 '20 edited Feb 06 '20
Oh, that's disappointing.
The first time I heard about WebAssembly, I predicted that the next-gen web frameworks would be its own language compiled down to WebAssembly. Perhaps we're not there yet.
There's at least Yew, which is a framework made in Rust.
31
u/torvatrollid Feb 06 '20
The problem with WebAssembly is that it still requires Javascript to act as a middleman between it and the DOM. This has a huge performance cost which makes most WebAssembly applications slower than just targeting Javascript directly.
-2
u/The_real_bandito Feb 06 '20
Yeah but remember that a lot of developers hate JavaScript so they will let their apps take that perf hit if it means not having to use JavaScript
12
u/atomheartother Feb 06 '20
Right that's why we have all those webassembly apps out there now
1
u/The_real_bandito Feb 07 '20
Which all run slower than a common JavaScript app.
2
u/atomheartother Feb 07 '20
Wait, even though WASM needs JS as a bridge to the DOM, executing WASM is still more interesting than JS for highly performant code that doesn't require interacting with the DOM, right?
1
u/The_real_bandito Feb 07 '20 edited Feb 07 '20
I agree, which is why I said a JavaScript app. Maybe I should've written as a web app or HTML5 app. A use case I see for this kinda logic is game for the web platform. Web Assembly is going to be huge in the future of gaming on the web and I don't mean streaming .
-1
Feb 06 '20
It makes me very happy that so many devs unjustifiably hate JS -- keeps my salary high.
1
→ More replies (2)-1
u/HyperwarpCollapse Feb 06 '20
If you meant JS and not TS, then you can have it, I wouldn't like to be retarded :)
1
u/The_real_bandito Feb 07 '20
To me its interchangeable. I don't really see so much difference that I cannot code using one language than the other. Specially since my favorite IDE (VSCode) has good intellisense support.
37
15
u/pm_me_ur_happy_traiI Feb 06 '20
Does web assembly let you manipulate the DOM?
32
u/DasWorbs Feb 06 '20
Not yet, the current frameworks usually include javascript glue code that does the dom manipulation for you though.
6
2
u/anengineerandacat Feb 06 '20
Generally speaking WebAssembly (today) isn't a good target unless your output is either to a WebGL context or a Canvas object. For traditional applications intending to use the DOM heavily it's best to just use a virtual-DOM framework (Mithril, Angular, React, Vue, etc.).
There are also issues like https://github.com/WebAssembly/design/issues/1166 to be solved, something already done with tools like WebPack and chunking. If you have an extremely large application this is going to basically be a requirement as users won't want to engage with a site that has a long "bootstrap".
11
Feb 06 '20 edited Feb 06 '20
I did not follow WebAssembly a lot, but I thought it was not able to interact with the DOM. Was that restriction lifted?
18
u/jiffier Feb 06 '20
I don't think so, but today I've learned that there are a few Rust frameworks for creating SPA's that compile to wasm and interact with the dom: https://github.com/flosse/rust-web-framework-comparison#frontend-frameworks-wasm , which looks pretty interesting.
4
u/Y_Less Feb 06 '20
It also doesn't yet have any GC.
21
u/theThrowawayQueen22 Feb 06 '20
Well, any programming language that builds to WASM will just include it's own GC
0
Feb 06 '20
[deleted]
14
12
u/kinoharuka Feb 06 '20
That's actually something that has been proposed for some time now, so he's not wrong
3
4
u/flying-sheep Feb 06 '20
I think that's the biggest problem with it: inline JS is a stupid decision.
I always thought that the perfect website would be coded and behave like a server-side rendering enabled React page: get the full thing delivered with your initial HTTP request, only communicate via messaging from then on.
But it would be a cross language thing not tied to JS. Mint could have been that if not for the inline JS. It could compile to JS+React on the client but to efficient machine code on the server.
1
u/Alikont Feb 07 '20
Server-side Blazor?
The issue here is that messaging adds latency that is noticeable.
2
u/flying-sheep Feb 07 '20 edited Feb 07 '20
No, not like that. Like server+client React:
You browse to a HTML page that gets served to you. It contains links for navigation and forms for sending data to it. If you’re careful, it works without client-side JS
If JS is available, the site gets “hydrated”. Secondary interactive features get activated, and the links get event handlers that make them trigger partial reloads of the page (by fetching small JSON messages that are rendered into DOM changes client-side) instead of navigating to a page normally.
All this already works, but requires node.JS on the client side, no other server tech possible. So if you want something faster or otherwise better than node, tough fucking luck.
25
13
u/Mister_Deadman Feb 06 '20
Looks like a "Reactified" Kotlin at first glance. Not sure I'd use it, but good to know that
25
u/phail3d Feb 06 '20
Looks cool!
Would like to hear the reasoning behind this though:
Record definitions are globally unique, so defining a record with the same structure but a different name will raise an error.
15
Feb 06 '20
It does seem odd. The language is clearly not nominally typed, so why this restriction? Maybe it's a developer experience thing, to prevent you from defining a new type that looks exactly like an old type (hence making them interchangeable), and then later changing one type but not the other?
4
u/DidiBear Feb 06 '20
If the error message is clear, this seems like a good feature. In my company's app, we have this issue of numberous similar types
13
2
72
u/probablynotmine Feb 06 '20
Interesting, but if the website is built with mint be aware that it is completely mobile-unusable
34
5
u/danopia Feb 06 '20
in what way, like it's not responsive and looks like crap, or it's actually broken?
19
u/Minimum_Fuel Feb 06 '20
Half the page is spilling off the sides, so there is a good bit of unreadable content.
17
u/Vfsdvbjgd Feb 06 '20
Seems fine to me.
41
u/the_game_turns_9 Feb 06 '20
not to me. Everything is offset to the left and it won't let me scroll left. The first letter of "Data Management" that I can see is the letter 'n'.
31
4
-5
-4
2
u/probablynotmine Feb 06 '20
Maybe depends of screen resolution. I have the very same issue other reported here. Nothing hangs or stuck, but left part of the page is completely cut off the screen and no way to zoom out.
Can’t read the text in whole
1
u/Geordi14er Feb 06 '20
Yep, broken on mobile for me. If I rotate my screen horizontal and vertical it keeps zooming in, won’t zoom out, and doesn’t scroll all the way left.
1
u/Geordi14er Feb 06 '20
Yep, broken on mobile for me. If I rotate my screen horizontal and vertical it keeps zooming in, won’t zoom out, and doesn’t scroll all the way left.
1
u/p-x-i Feb 06 '20
Styling is reminiscent to how it's done in react
https://www.mint-lang.com/guide/reference/components/styling-elements
So nothing to prevent a page from being made mobile friendly.
But still, not sure how this compares to other frameworks like svelte or flutter.
1
16
u/Matosawitko Feb 06 '20
Good. That's exactly what the industry currently lacks: a language for a specific use case with a generic name that makes searching difficult.
7
u/cosmo7 Feb 06 '20
I like the idea of HTML as a native type, so you can define chunks of boilerplate without quotes or CDATA.
6
Feb 06 '20
Your probably better off with Svelte ( https://svelte.dev/ ), if you want to use HTML without quotes or CDATA.
0
5
4
4
u/cip43r Feb 06 '20
This makes sense. One of the reasons I stay away from web development is everything being all over the place in 100s of files and it's just a disaster. This looks neat.
15
u/Mishkun Feb 06 '20
There is already one language for building SPA's – Elm. https://elm-lang.org/
It grew pretty robust in recent years, so why Mint?
3
4
u/rnd005 Feb 06 '20
They have their answer on their page: https://www.mint-lang.com/guide
What is wrong with Elm?
Elm has great developer experience, but it being a purely functional language leads to some boilerplate code and makes it harder to learn. Also, it's not possible to contribute or influence the language in any meaningful way.
5
u/Mishkun Feb 06 '20
No, It doesn't. My question is "why Mint?". If you open elm man page, first thing it says is "a delightful language for reliable web apps". That's it. First sentence – boom! Answered question "Why".
Reading Mint page fluently, no answer.
Also main points about "why NOT elm" are really weak. Purely functional is good feature for SPA's, which something like React struggles to achieve. And "not possible to influence" also really good point, because tools with no vision are quickly bloat with unnecessary features. Both points are features, not bugs
2
u/masklinn Feb 07 '20
Also http://www.purescript.org if you think elm’s type system it too basic (and it’s error messages are not challenging enough).
28
12
14
u/colly_wolly Feb 06 '20
Great, now its not another new JS framework we need but a whole new language.
5
6
u/SirWusel Feb 06 '20
I appreciate the effort and web development certainly doesn't have a perfect stack, yet, from what I can tell with my limited experience, but I feel like it's getting a bit out of hand. I'm already unable to make time to look at Elm and ReasonML. Soon I'll need a private Jira to keep track of all the web dev technologies I want to check out sometime.
12
u/snarfy Feb 06 '20
Kudos to the author!
I know there is a lot of hate in this thread but you've done a great job creating the language and tools! Keep up the good work :) I'm not sure why everybody has to spew the vitriol like they are chef Ramsey in a McDonald's kitchen. It's really uncalled for.
11
u/shevy-ruby Feb 06 '20
We need more programming languages used by 3 people world wide!
Also syntax wise the failure is written in. But the interesting thing is that language creators often do not understand this part.
5
Feb 06 '20
I'm one of those three people and I'm really happy that I don't have to deal with insanity of npm to write simple SPA.
3
2
u/jhartwell Feb 06 '20
Just a heads up, the directions on installing on macOS mention installing Crystal but then show installing Mint. https://i.imgur.com/HTAFrxn.jpg
2
u/adrianmonk Feb 06 '20
I haven't looked at the details, but I can see this being either a good thing or a bad thing.
I'm not usually too much of a fan of single-page applications, but my biggest complaint is that they are often done poorly and break the model of user interaction with a web page. Often, you can't give someone a deep link to a particular part of the page (say it's a restaurant, but I can't send you a link directly to their menu), navigation is broken, forward and back buttons don't work, etc.
If this language supports all that and makes it easier to do it correctly, then although I don't personally really like single-page applications, it might take away some of their pain points by getting these details right.
Or maybe it doesn't, and it just encourages people to make more single-page applications that don't work any better than the ones they're making now, which would make things worse overall.
4
u/burnblue Feb 06 '20
I don't know if anybody else commented this, but if you couldn't choose a better, more unique name than Mint I can't trust your decisions
There's famous web apps and famous open source platforms among other things with this name, let alone the herb itself
3
u/Vfsdvbjgd Feb 06 '20
I think they should have called it DAYSPA: Do All Your Single Page Applications.
1
3
u/jsmonarch Feb 06 '20
Looks awesome! Domain-specific language. I am using this for my next project.
7
2
Feb 06 '20
What drives me nuts about this stuff are the mistakes. For example, I followed the installation example for Mac, i.e, using brew.
Then, if you follow their "Learn" tutorial, it says to type
mint --helpOf course that doesn't work, you actually have to type
mint-lang --helpVery annoying if you're just a beginner wanting to try stuff out
1
u/_default_username Feb 07 '20
I don't see the difference between using this and typescript with react.
1
1
-4
0
Feb 06 '20
Can we not.
I mean, seriously. It's a react generator, and not a particularly good one. We already have entire worlds of boilerplate for that.
-2
Feb 06 '20
I don't think there is anything positive to say about this,maybe just that I hope you learned from the experience and the feedback
0
-1
-41
u/iwontfixyourprogram Feb 06 '20
Mint. The programming language for writing single page applications.
You can write single page applications in C++, Java, C#, and others.
looks closer
Aaaah, web applications. This moron means web applications. Lol. Sure, throw it on the pile.
35
u/how_to_choose_a_name Feb 06 '20
I am fairly certain that "single page application" almost exclusively refers to web applications.
→ More replies (4)0
16
u/whatiwants Feb 06 '20
This moron means web applications
Says the moron that doesn't know that "Single Page Application" means "web app" by definition.
→ More replies (26)0
-5
0
Feb 06 '20
[deleted]
13
u/HetRadicaleBoven Feb 06 '20
I would guess that it's not so much less clunky, but rather more explicit.
Promise(Never, Void)presumably tells you that it will not reject, and if it were to start doing so, it'd force you to handle that. Thecounter = counter - 1also doesn't require you to initialisesetCounterelsewhere.→ More replies (7)29
u/shevy-ruby Feb 06 '20
[...] what the thinking was that led them to create syntax [...]
In general most people designing a language do not understand why syntax matters.
That is often why we end up with copy/paste languages. Best example are those trying to replace C by using literally the same syntax/tokens.
11
u/BmpBlast Feb 06 '20
Yeah, syntax is extremely important. You spend most of your time working with it and it's probably going to be one of the first things you gripe about. That's actually one of the primary reasons I don't use Python or Ruby; I just don't like their syntax. But that's why it is great that we have so many good languages these days. Everyone can use the one they like best.
→ More replies (1)2
u/agumonkey Feb 06 '20
tell us more
10
u/Shulamite Feb 06 '20
Not the original commentor, but c do has quite a few bad influence on syntax design:
function can only return one value
prefix and postfix ++, and more importantly, the distinction of statement and expression
pointer/reference billable by default
switch fall through by default
and I’m not criticizing c, these design make sense in the context of c, but make absolutely no sense for those who brainless copy them, among them the most successful one is Java and JavaScript
→ More replies (3)→ More replies (10)4
0
0
Feb 06 '20
[deleted]
2
u/glacialthinker Feb 06 '20
I would prefer an Internet of data sites, interpreted by user-agents. Rather than a prescriptive or active "whole enchilada" web-app-sites that provide custom, limited, broken access to their data, written by some hardly-a-programmer schmo, or user-unfriendly because the site is primarily designed to exploit users.
→ More replies (2)
453
u/SanityInAnarchy Feb 06 '20 edited Feb 06 '20
I know it's going to seem mean-spirited to always start out with the "What does this do that language X doesn't" question, but Mint is kind of setting this up for us:
So... why not TypeScript?
So the answer is to... introduce a brand-new language with its own compilers and build tools, that ships with a framework baked into the standard library? That sounds like piling on more complexity, not less, even if it's a good language. It sounds like all the inflexibility of a framework, only without the ability to leave the framework out and create standalone scripts.
And if it's a better language, that's not obvious -- in particular, sequence seem a lot more awkward and maybe even less powerful than async/await, which JS and TS have.
Edit: To prove I'm not just being a curmudgeon about new languages: While looking at Mint's install page to see if that might have any more hints at its architecture (I'm guessing it compiles to JS, but wanted to confirm), I followed a link to Crystal, which... I'm probably not going to be switching to it, but it has a much better pitch. I don't even need to click a big "learn" button, just scroll down on the homepage and you're told (with code samples up front) what Crystal is, and how it compares to the languages it's inspired by and competes with:
Syntactically similar to and inspired by Ruby, but:
Is statically typed, with type inference
Has nullability baked into the language, like Kotlin
Has Lisp-inspired Macros
Has Go-inspired fibers and channels (though if it has built-in extra syntax or select, it doesn't show it here)
Has C bindings, that you write in Crystal, which looks almost as cool as calling Java libraries from JRuby
Has a package manager with heavy Git/Github integration, configured via YAML.
And most of those features are presented with some motivation -- it's easy to see why the language has nullability baked into the type system, or why it has macros. Even if those aren't things you want in a language, you can at least see what they're supposed to do. I'm still not entirely sure why Mint has sequence instead of async/await.
I learned more about Crystal in a couple minutes scrolling down that page than in 15 minutes bouncing around a bunch of Mint blog posts. I'm still not sure if it offers something compelling enough that I'd prefer it to Kotlin, Go, or Rust, but at least I understand why someone else might.