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.
I’m surprised about this statement, I would have said that exceptions are the consequence of an impure operation (that may or may not fail differently every time you call it).
I’m currently learning functional languages and have only limited knowledge, but from what I’ve read now you are right.
Throwing exceptions is pure, but catching them is impure.
In this case I guess the printLine function can throw an exception therefore the calling function must be declared with Exception?
I would even have said that both throwing and catching should be pure, just like returning an error value/handling should be pure, but the reason for the throw/returning error itself is impure. Like if you throw and ioerror it’s only after doing the impure io call, and the rest of the error reporting/handling itself can be pure.
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.
What you expected sounds more like what nim offers.
Agreed, this is exactly Nim
Thanks I’ll check it out
There are no imports, these are type annotations
Do I really have to declare that something requires exceptions?
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
I’m surprised about this statement, I would have said that exceptions are the consequence of an impure operation (that may or may not fail differently every time you call it).
I’m currently learning functional languages and have only limited knowledge, but from what I’ve read now you are right. Throwing exceptions is pure, but catching them is impure.
In this case I guess the printLine function can throw an exception therefore the calling function must be declared with Exception?
I would even have said that both throwing and catching should be pure, just like returning an error value/handling should be pure, but the reason for the throw/returning error itself is impure. Like if you throw and ioerror it’s only after doing the impure io call, and the rest of the error reporting/handling itself can be pure.
Sounds good,
but would the preferred way be to use a wrapper type, which holds either the data or the error and avoid exceptions completely?