upvote
Both Borgo and now Lisette seem to act as though (T, error) returns are equivalent to a Result<T, error> sum type, but this is not semantically valid in all cases. The io.Reader interface's Read method, for example, specifies not only that (n!=0, io.EOF) is a valid return pattern, but moreover that it is not even an error condition, just a terminal condition. If you treat the two return values as mutually exclusive, you either can't see that you're supposed to stop reading, or you can't see that some number of valid bytes were placed into the buffer. This is probably well known enough to be handled specifically, but other libraries have been known to make creative use of the non-exclusivity in multiple return values too.
reply
You are right, and thank you for pointing this out. I've opened an issue:

https://github.com/ivov/lisette/issues/12

I have a few approaches in mind and will be addressing this soon.

reply
To be fair, I feel like the language is widely criticized for this particular choice and it's not a pattern you tend to see with newer APIs.

It's a really valid FFI concern though! And I feel like superset languages like this live or die on their ability to be integrated smoothly side-by-side with the core language (F#, Scala, Kotlin, Typescript, Rescript)

reply
To be honest you could easily mark this as an additional (adt) type if that suits you better. Its a halting situation no matter how you twist it.
reply
How do compile errors propagate back from the target language to the source language?
reply
They are not supposed to produce code that doesn't compile, why would they?
reply
Debugger positions on the other hand are a pain with these things.
reply
Uh yes, that's what I meant ;)

In C/C++ you have the #line preprocessor directive. It would be nice if Go had something similar.

reply
Go has apparently got //line directives, and this project uses them.
reply