Re:Luna: Visual and textual functional programming language
by wdanilo on Sunday February 21, 2016 @04:32PM
(#11146662)
Oh, thank you for spotting the error. Of course, there should be `fileAge.catch` there. I'll fix that in a moment. I will prepare a visual example of exceptions and put it in the website later today. For now think of it like that: running an operation results in a data and this data is transmitted over connection between nodes. If you read data from file it can be "broken" in different ways, for example it did not exist on disk. If you convert it to integer - it still could be broken or become broken (for example we were not able to convert this text to integer). So far you've got such graph of nodes: open --> to Int --> ... and the resulting edge could be broken if one of the exceptions occured. If you put there `catch` node you can either double click it and define its subgraph, that has input of the `e` variable or simply connect other input that would be used if the error occurs. Thats all - in contrast to imperative languages exceptions in Luna do NOT propagate over blocks of code - they propagate over the data dependencies. In fact the exceptions in Luna are just algebraic data structures that could have 2 values - Just ok or Error e - something like Either in Haskell (side note for Haskellers). Does it make sense to you? :)
Are you referring to this?
First, I think you probably meant to write fileAge.catch there. Second, what would that look like as a graph? Having a visual programming language is not really interesting if you have to go back to text for exception handling. Maybe you should show a side-by-side comparison of the other examples as well.