Comments (2)
First change: The overrides which call CheckInitialized ...
Yep, some silly mistakes there. I've taken a different approach to fixing it:
public T Value =>
CheckInitialised(value);
public static implicit operator T(Some<T> value) =>
value.Value;
public override string ToString() =>
Value.ToString();
public override int GetHashCode() =>
Value.GetHashCode();
public override bool Equals(object obj) =>
Value.Equals(obj);
It puts slightly more burden on the Value
access, but I think overall it's cleaner.
For performance reasons, the CLR will not call the default constructor on struct arrays.
It's not the CLR, it's the C# compiler. It could easily call the same series of op-codes that it does for classes. It is however (like you say) an optimisation. I believe the C# team are discussing default constructors for the final C# 6. So we'll see how that goes. Until then Some<T>
will always be a weak solution to this problem.
I do discuss this on the project home page, and explain its limitations. I think only using Some<T>
for method arguments, and never instantiating them manually is probably the best use of a weak solution.
Thanks for the heads up on the bugs!
from language-ext.
No problem -- I like the way you handled everything, I think that makes it work out nicely. Closing this issue now.
from language-ext.
Related Issues (20)
- Question: Good practices for app config when using Aff/Eff HOT 1
- Duplicate MatchAsync extension methods on Task<TryOption> HOT 3
- Using CodeGen with Rider HOT 1
- SeqConcat does not support indexer but no way to determine if a Seq is internally using SeqConcat. HOT 5
- Map method should return R type instead of ValueTuple<R> HOT 1
- Visual Studio 2022 doesn't warn when `TryAsync` is not awaited
- Is it worth adding a ToHashMap that takes Key and Value mappers HOT 2
- Unity iOS build: Constructor not found for type LanguageExt.IntegerRange HOT 3
- README file
- EitherUnsafe MapLeft throws ResultIsNullException HOT 4
- LanguageExt.Fin fails to serialise using Newtonsoft.Json
- CancellationTokenSource not disposed HOT 1
- Stack overflow with MapT on T<Seq> HOT 1
- Proposal: Make .Left/.Right public for Either<> HOT 2
- NewType does not display the derived class that is throwing the error HOT 1
- BindLeftAsync and MapLeftAsync HOT 2
- Pattern Matching [Maybe] Issue with Aff HOT 4
- broken codegen HOT 3
- TryOptionAsync incorrect nullablity HOT 4
- Document using code generation with unity HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from language-ext.