Comments (9)
In case someone needs it, for now you can import null safety version in pubspec.yaml
like this
dependencies:
crclib:
git:
url: https://github.com/google/crclib.dart.git
ref: nullsafety
from crclib.dart.
I have published 3.0.0 a few minutes ago. It should be live soon.
from crclib.dart.
Does https://github.com/google/crclib.dart/tree/nullsafety have the feature you want?
from crclib.dart.
The nullsafety branch seems perfect. Can you publish a new version on pub.dev @postmasters ?
from crclib.dart.
I've planned to wait a little bit longer to release that branch as a new version (maybe August / September so that the null safety concept has time to sink). For now, may I ask you to please specify Git tag/commit hash to use it in your pub.yaml
?
from crclib.dart.
Hi @postmasters, I don't understand why you are suggesting to wait to release a null safe release when the whole ecosystem is making the move and this library looks pretty stable.
I feel it's bad practice tagging onto a commit hash (especially in a build which you need to be reproducible in the future) as it could go away at any time with a force-push in git whilst a published library will remain available.
Why not publish a 3.0.0+nullsafe.0
prerelease which has null safety if you're worried about API stability?
I had a quick look at your nullsafety branch and it looks pretty standard for a null-safe migration, I do have a couple of questions / changes.
- Turn CrcValue into an abstract class with a factory constructor and separating out the int/BigInt implementations. This will tidy up the use of nulls in CrcValue.
abstract class CrcValue {
factory CrcValue(dynamic value) {
if (value is int) return CrcValueInt(value as int);
if (value is BigInt) return CrcValueBigInt(value as BigInt);
throw Exception("CrcValue must be an int or BigInt");
}
}
It would be cool if IntCrcValue and BigIntCrcValue could be done using a generic CrcValueImpl but I don't think there is a common interface for the two off the top of my head.
-
In
solveAugmentedMatrix
- null is returned when "The pivot index is not in range, the system is inconsistent". Should this be an Exception? -
flipWithValue
- null is returned whenallowedPositions
is empty. Should this be checked prior to callingflipWithValue
/flipWithData
so the return value offlipWithValue
becomes non-nullable and instead throws an Exception if an empty list is encountered? MakingsolveAugmentedMatrix
non-nullable also gets rid of the null check question mark
With 2 & 3 I'm unsure if they are unexpected cases which are serious enough to throw exceptions as you currently let them fail through null.
Many thanks for a great lib!
James
from crclib.dart.
Thanks for the inputs, James! I'll go through them in order.
- Why not publish nullsafety branch? This is pretty much a personal preference. I don't want to maintain two packages. So I'll wait for an arbitrary cut over date and will rebase
main
on thenullsafety
branch. And that will go out as one single package versioned3.0.0
. I can commit to keep the tagnullsafety
where it is before that cut off going forward, if that helps you pin the version.
And these side discussions (feel free to open new issues):
- Turning
CrcValue
into an abstract class is a nice touch. PRs welcomed! On the other thand, I'm not happy withCrcValue
. This shim class does not contribute to speed, nor space. I might later decide to up-castint
toBigInt
and make it the result of a CRC calculation. - Should
solveAugmentedMatrix
throw an exception? I think not. It's perfectly valid to have a system of equations that does not have any solution. - Similarly, a
null
fromflipWithValue
signals no solution, rather than an exception (i.e. provided inputs were handled fine). Also, if the final value is the same as the initial value, then no flipping is required either. I thought it was handled but the placement in current code was wrong (it should have been done before the emptyallowedPositions
check).
Thanks and keep new issues coming!
from crclib.dart.
So null safety is now main stream.
Can we get this package published please.
from crclib.dart.
Ah right. So sorry for dropping the ball and thank you for the ping. I'll get to it ASAP.
from crclib.dart.
Related Issues (11)
- calculated CRC16 ARC HOT 6
- package:crclib/catalog.dart not found HOT 3
- Web Support HOT 1
- Does this package have Python crc_hqx function equivalent? HOT 10
- BadState with null safety version HOT 2
- Dart CI workflow failed because of no VM image
- Getting incremental CRC value HOT 2
- Replace usage of tuple with records
- Automatically extract parameters from `reveng` catalog HOT 1
- Does the lib support for CRC_16 [ISO3309]? 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 crclib.dart.