Comments (5)
And if you allow me to question: why we are only providing methods for the Kotlin users? Why not provide also duplicated methods for Swift, Javascript, PhP, Python, c++... see my point?
Kotlin is relatively new and the the language designers had the chance to created an elegant API by combining the best APIs from tons of other languages (Java, Scala, C#, Groovy, Python, Nice) as mentioned by Andrey Breslav. So it's not that we favour the Kotlin API per se, but a naming convention which is common across many languages.
The Kotlin API isn't perfect though. The language has features which do not exist in Dart (more operators to overload, infix notation, method/constructor overloads) and vice versa. This is where we together have to fill the gap with good names inspired from any language.
In the end, all I want is making programming as easy as possible. This also means instead of closing 20 issues/PRs pointing people to the correct method, I add the alias. I don't want fights about the naming of a method. Depending on ones background and the task at hand the other name might be actually a better fit.
Speaking of clamp
, I'm happy to add an alias for coerceIn
(which I'm not even able to pronounce). But as I understood it, the initial issue was questioning why we even added int.coerceIn(min, max)
, int.coerceAtLeast(min)
and int.coerceAtMost(max)
extensions instead of using the dart:core
clamp(min, max)
, min(a, b)
and max(a, b)
methods. This doesn't make a lot of sense because it questions the existence of this whole project or the static extensions method language feature.
But this causes a problem: too many methods on the auto complete window that does the same thing.
I don't see the problem. If it becomes one we can deprecate rarely used duplicates so that they are recommended last (as we did this with invoke
). Or even add a custom annotation which helps ranking them (which should be relatively easy to implement by the IDE plugin maintainers). Dart recently added machine learning to improve auto-completion. I'm confident we figure something out.
from dartx.
too many methods on the auto complete window that does the same thing
We don't try to add all method names possible, just the very popular ones like filter()
. If you come from Kotlin, you kind of expect Dart to have a filter method ^^
Why not provide also duplicated methods for Swift, Javascript, PhP, Python, c++
That is a valid point. I would suspect that most of the users of Flutter are familiar with Kotlin. But a substantial amount also has an iOS or web background so I think we should also allow pull requests for "super popular" methods from Swift and JS. Since my personal background is Android, I invite everyone who can't live without a method from another language to create a pull request. It should however fit into the Dart ecosystem.
we could add a section to the README file that does a one-to-one correspondency to other languages methods
Great idea. Not sure if the README is the right place for that. Maybe we can mention popular methods of other languages in the documentation of the corresponding dartx
extension. This would allow finding it via search.
from dartx.
This would allow finding it via search.
Adding it to the README file is much easier to find it because all the methods will be on the same page. Adding it to the dartx
documentation would be a problem because every method is separated by contexts, separated by different files.
That is why I am suggesting to add it to the a README section "Methods correspondency", a Ctrl + F would solve this problem in an easier way.
I think we should also allow pull requests for "super popular" methods from Swift and JS
This would only increase even more the problem for the auto complete flooding. This doesn't bother you?
from dartx.
This doesn't bother you?
I don't have any problems with auto-complete. What problems do you experience?
from dartx.
We can split those duplicated methods into other flavored packages if they are really unnecessary.
from dartx.
Related Issues (20)
- Map.mapValue/mapKey HOT 2
- Null Safety Migration HOT 10
- Proposal: modifyWhere and modifyFirstWhere HOT 1
- pub get fails after upgrading flutter version for app developed with previous flutter version HOT 1
- Linear complexity of elementAt HOT 2
- Extension for text coloring based on luminance
- Create proper documentation for dartx HOT 2
- Improve README HOT 3
- Flatten should work with deeply nested lists as well
- Class 'List<List<int>>' has no instance method 'flatten'. Receiver: Instance(length:1) of '_GrowableList' Tried calling: flatten()
- More detailed and clear documentation
- Release update on pub HOT 3
- String isNullOrBlank missing HOT 1
- `takeFirst` and `takeLast` are not index safe HOT 1
- SSL Cert expired HOT 2
- `move` methods on `List` HOT 1
- Feature Request "IndicesWhere" HOT 2
- Update to support flutter 3.10 propoerly and upgrade depedencies HOT 1
- No more updates ? HOT 2
- Add someNullOrEmptyStr.or('not null or empty string') HOT 2
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 dartx.