-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Contracts #3049
Comments
The feature was requested by David Morgan; I am generally sympathetic in principle, but do nor expect this to happen for some time (if ever). It is a complex topic. Added this to the Later milestone. |
Added Area-Language label. |
This comment was originally written by [email protected] Thanks for filing on my behalf. The full link for cofoja is http://code.google.com/p/cofoja/ |
This comment was originally written by [email protected] This was for many years in the top 25 RFE for Java (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4449383). Contracts can quickly become very complex and perhaps there's a law of diminishing returns, but they have a good deal of value. All code has a contract. Most code has an implicit contract: this means a reader must READ THE CODE (all of it) to understand what it does. This makes for much lower productivity in the long-run. DbC just makes the contract explicit rather than relying upon My experience of DbC has interesting parallels with unit-testing in that they both result in the developer writing smaller, tighter classes. Another useful benefit of DbC is that static analysis tools can make a much more reasonable analysis. If DbC doesn't happen (as I expect it won't), then Dart should at least add non-null types (http://code.google.com/p/dart/issues/detail?id=22). Source code expressing correctness is a good thing. This link outlines DbC: http://www.eiffel.com/developers/design_by_contract.html |
This comment was originally written by [email protected] Maybe some simple way to mark type annotations and asserts as part of library api contract - which are used in production mode: @contract int test(int x) { } |
This comment was originally written by [email protected] Library based solution? https://groups.google.com/a/dartlang.org/forum/?fromgroups#!topic/misc/w02qkmFYqE0 |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
Issue #15390 has been merged into this issue. |
FYI. The addition of native C# support for method contracts was discussed at the Jan 21, 2015 C# Design Meeting. The issue used to track this specific feature is dotnet/roslyn#119. |
New commits in this version: git -C third_party/pkg/pub log --oneline cd7a43f2109f7e5eb22e73c7f4e15d25fd57598e..d95c5713dda518ed53ada70e00789e6aadbfbe48 d95c5713 (HEAD, origin/master, origin/HEAD) Remove duplicate global invocation on Windows (#3055) 4c5198df master->main (#3101) e793fd52 More tool/test.dart tweaks (#3097) 1b228edd Report retracted packages (#3093) 4fedb6c5 Tweak strict dependencies error message for `_validateBenchmarkTestTool` (#3087) e608ab6e Improve test script (#3091) abf702c4 Detect potential leaks in `dart pub publish`. (#3049) 9941c1f9 Fix broken simplification of prerelease constraints (#3078) f0cdfa27 format (#3086) 5a1242c6 Fix unicode terminal detection windows (#2933) 58e2296d Dart format (#3084) 1426601c use incremental compilation in the tool/test.dart script (#3075) 9954f851 Fix a typo (#3062) 44489b31 Use relative import for path.dart (#2959) 77702ab1 Always precompile scripts before running them (#3074) Change-Id: I913ab9e3b5bc7181d483a2de96ec4ad917028b75 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213262 Reviewed-by: Jonas Jensen <[email protected]> Commit-Queue: Sigurd Meldgaard <[email protected]>
…3 revisions) https://dart.googlesource.com/dartdoc/+log/c58f21042ebd..8549817bb1b5 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3 to 3.0.2 (#3048) 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 1.0.26 to 2.1.11 (#3049) 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 3.0.0 to 3.1.0 (#3050) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/dart-doc-dart-sdk Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: [email protected] Change-Id: I14041ce5576cc0efadcc897603f8b7893b891b22 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245721 Reviewed-by: Kevin Moore <[email protected]> Commit-Queue: DEPS Autoroller <[email protected]> Commit-Queue: Kevin Moore <[email protected]>
See Eiffel for an example of core language support, C#/.NET and Java (including http://go/cofoja developed at Google) for less pretty but fully functional implementations.
This is a complex feature, filing now so it can be considered at the appropriate time.
(It might appeal to the people who have been asking for non nullable types.)
The major pieces that are needed are:
1.1 Tagging of classes with predicates: invariants
1.2 Tagging of methods with predicates: preconditions, postconditions, (exceptional postconditions)
2.1 "result" refers to the method result
2.2 "old(foo)" refers to the value of foo on method entry
3.1 But not when evaluating a contract predicate
3.2 With facility to enable/disable contracts by library
3.3 With invariants ignored for "private" method calls (whatever this means for Dart)
3.4 Inheriting contract predicates from superclasses, interfaces
The text was updated successfully, but these errors were encountered: