-
Notifications
You must be signed in to change notification settings - Fork 0
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
Lamination: Don't allow errors to occur in constructors of any class. #42
Comments
The |
I like |
So instead of a Result type I opted to just use Optional because the only possible error for all the existing types during construction is OOM. Nearly all types have been converted to a |
|
|
The first two shouldn't be too difficult to do, |
|
The |
|
Move to a
Result<T>
system of static methods on types likeString
andVector
which can fail when allocating memory such that the constructor cannot fail. That means copies like the following:String foo = "something that can fail";
Will no longer compile and instead you'll have to write:
Result<String> foo = "something that can fail";
Which will be enabled by
Result<T>
calling a specialinit_from_result
static method.Similarly, constructors like
Will no longer work, instead you'll write something like:
Which gives a
Result<Vector<Byte>> data
And likewise, copy constructors will call special
copy_from_result
static methods, soThe
Result<T>
type is special in that it will allow anything returningResult<T>
to return anError
type which is just a wrappedString
indicating the resulting error.The text was updated successfully, but these errors were encountered: