A friendly programming language from the future.

64 points
helloWorld : '{IO, Exception} () 
helloWorld _ = printLine "Hello World"

I wouldn’t call it friendly.

permalink
report
reply
4 points
Deleted by creator
permalink
report
parent
reply
7 points
*

Although, i would agree with it not necessarily being “friendly”, since its a drastically different syntax than many beginners would be used to, the brackets and parenthesis here are not what you think they are.

Unison is a language in the style of Haskell, F#, Purescript, Elm, etc. So that first line is actually type annotations.

In Haskell, this would just be helloWorld :: IO () , meaning a function named “helloWorld” with no arguments and produces what is essentally a potentially-unsafe IO action with a Void return (the empty parenthesis () ).

Here in Unison they call the bracket part “abilities” or something. Its saying the same thing as Haskell, but being more explicit in saying it can raise an exception.

permalink
report
parent
reply
-4 points
*

Yeah sorry - that’s just unnecessarily obtuse. Programming languages just don’t need to be that convoluted. Hello world should look something like this:

print("Hello, World!")

And when you need more complexity, it can still be far simpler than Unison (or Haskel). For example this (in Swift):

func processNumbers(_ numbers: [Int]) -> [Int] {
    return numbers.filter { $0 % 2 == 0 }.map { $0 * $0 }
}

let numbers = [1, 2, 3, 4, 5, 6]
let processedNumbers = processNumbers(numbers)
print(processedNumbers)
permalink
report
parent
reply
1 point

What do you mean by flipped? Parentheses seem to group expressions like in most languages.

permalink
report
parent
reply
1 point

It’s not parenthesis (in the PEMDAS sense), it’s the unit type and it’s normally expressed like that. If you’re not familiar with type systems, it’s the typing equivalent of void.

permalink
report
parent
reply
2 points
Deleted by creator
permalink
report
parent
reply
46 points

Oh, it’s weird ugly Haskell!

… I can write weird, ugly Haskell in Haskell, though.

permalink
report
reply
8 points

Compiler, give me all the language extensions you have. Wait, wait. I’m worried what you just heard was, “Give me a lot of language extensions.” What I said was, “Give me all the language extensions you have.” Do you understand?

permalink
report
parent
reply
34 points
*

Literally the opposite of friendly. Already in the hello world you have two imports for extremely basic functionality (why should I have to import the ability to throw exceptions??) and a completely enigmatic symbol ’ that apparently has a significant function.

A “friendly” programming language should be readable without knowing esoteric symbols.

Really got my hopes up with that headline that it’d be a python-level intuitive-to-read language with static typing.

permalink
report
reply
9 points

What you expected sounds more like what nim offers.

permalink
report
parent
reply
5 points

python-level intuitive-to-read language with static typing

Agreed, this is exactly Nim

permalink
report
parent
reply
1 point

Thanks I’ll check it out

permalink
report
parent
reply
8 points

There are no imports, these are type annotations

permalink
report
parent
reply
-3 points

Do I really have to declare that something requires exceptions?

permalink
report
parent
reply
8 points

Yes, in functional programming you want to use pure functions. Exceptions are impure, therefore it has to be declared.

Other functional languages don’t even have exceptions

permalink
report
parent
reply
1 point
*

Functional languages typically have type inference, so the type signatures are entirely optional. I haven’t looked that deeply at unison, but I’d be entirely unsurprised if it had global type inference and if all or most type signatures were optimal.

It’s less that you have to declare something can do IO or throw an exception, and more that you’re calling something from the standard library that does IO or throws an exception.

Most stuff does neither. There’s a type level distinction between normal, regular pure code, and impure effectful code, so it’s easy to tell from the type signature whether a function is pure or not.

permalink
report
parent
reply
1 point

That’s one of the things I appreciate in a language/framework. Drives me nuts getting an exception from a dependency of a dependency of a dependency.

Even better if its baked into the type system and I can’t run my code without handling it.

permalink
report
parent
reply
14 points

This looks like the opposite of friendly to me. Is it supposed to be targeted towards cloud computing or web apps? I don’t really understand what its ideal use case is.

permalink
report
reply
13 points

V disappointed upon realizing this is not, as I initially read, satirically-typed

permalink
report
reply
2 points

Time for a Java fork: Jaja

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.2K

    Monthly active users

  • 1.8K

    Posts

  • 30K

    Comments