-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service methods should be possible to specify its error type #38
Comments
Design critics by @Kroisse. The current design forces analyzer to determine whether the type need to inherit I am with him. Even worse, it doesn't make sense at all when primitive types (e.g. Several workarounds come to my mind, but any of them are sufficient. For instance, we can generate a wrapper subclass of Anyway the design should be adjusted. |
A good idea from @Kroisse: Annotating types to be used as an error types e.g.:
(Although we currently don't have annotations without arguments. Annotation syntax also has to be adjusted.) |
nirum-lang/nirum-python#71 is following issue. since nirum compiler dosen't need to be updated anymore, i close this issue. |
Service clients don't process error values from the service server. Need to fix this to close this issue. |
Although we can declare every
Either
-like union types to represent successful/failed result of methods, there are several downsides:Either
-like union type, such approach to represent errors is not that natural to many programming languages having exceptions (e.g. Java, Python, JavaScript). It would be great if errors can be dealt in the most natural way of each programming language.If service methods can have an error type alongside of a return type errors can be dealt in multiple ways so that each language target choose its own translation to represent errors in the most natural way of the language.
For example:
(The
: error-type
syntax is just a pseudocode.) The the above code can be compiled to Haskell usingEither
monad:whereas be compiled to Java using checked exceptions:
The text was updated successfully, but these errors were encountered: