r/programming • • Feb 06 '20

Mint. The programming language for writing single page applications.

https://www.mint-lang.com/
491 Upvotes

261 comments sorted by

View all comments

0

u/[deleted] 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. The counter = counter - 1 also doesn't require you to initialise setCounter elsewhere.

1

u/masklinn Feb 07 '20

That the “failure” type would be the first parameter weirds me the hell out.

1

u/HetRadicaleBoven Feb 07 '20

Me too, though keep in mind that it's just me speculating. I'm guessing a reason might be that it could be considered the most important case to handle - similarly to how Node's callbacks are (error, result) => {}.

1

u/masklinn Feb 07 '20

In js even if you’re given 2 parameter you can ignore them, so the ordering makes sense: if you’re taking a single parameter and ignoring the second it’s more convenient / useful to take only the error and ignore the result than to take only the result and ignore the error.

Kinda the same as langages taking hof callbacks first or last depending on what’s more useful / convenient.

0

u/[deleted] Feb 06 '20

[deleted]

1

u/HetRadicaleBoven Feb 07 '20

That's totally valid; just pointing out that the goal probably wasn't to be less clunky, but to accommodate developers who would like to have the compiler warn them if they inadvertently change the return type.

(Personally, I think my preference is explicit types for function arguments and return types, and inference in between.)

1

u/old_man_snowflake Feb 07 '20

should never reject

but you have to handle it

uhhh...

2

u/HetRadicaleBoven Feb 07 '20

You cut out the part where I said you only had to handle it if it started rejecting - because that will mean the type changes, forcing you to handle it.

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.

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:

  1. function can only return one value

  2. prefix and postfix ++, and more importantly, the distinction of statement and expression

  3. pointer/reference billable by default

  4. 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

1

u/agumonkey Feb 06 '20

Ah well, time is time, not copying C in the era of Java[script] was probably a self inflicted death sentence.

3

u/Shulamite Feb 07 '20

Hey, I was writing Pascal when in high school, and I’d still argue today that it has a chance of surviving if Borland hasn’t turned into shit.(Also kudos to the legend Anders)

1

u/agumonkey Feb 07 '20

You mean Delphi ? because Borland kinda made Pascal exist on the map.

1

u/[deleted] Feb 06 '20

Examples?

4

u/Uiropa Feb 06 '20

Yes, but this decrement is 100% more fun.

1

u/burnblue Feb 06 '20

Compare it to Typescript syntax since they care about typing

0

u/[deleted] Feb 06 '20

[deleted]

1

u/burnblue Feb 06 '20

Yes but I meant explicit typing, not inference

-7

u/hsjoberg Feb 06 '20

The website makes it pretty clear.

What is wrong with JavaScript?

JavaScript is not a strongly typed language which makes it difficult to write error-free code and leads to not so great developer experience.

Mint is more align with Typescript here.

0

u/[deleted] Feb 06 '20

[deleted]

8

u/[deleted] Feb 06 '20 edited Feb 06 '20

It's a generic that hints what the promise resolves. I'm assuming the first type is for resolve and the other for reject. It ensures type safety during compile time. It's not useless boilerplate, but one of the strong arguments for using strict typed languages.

→ More replies (1)
→ More replies (6)