Code Monkey home page Code Monkey logo

Comments (5)

passsy avatar passsy commented on June 14, 2024 2

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.

simc avatar simc commented on June 14, 2024

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.

shinayser avatar shinayser commented on June 14, 2024

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.

simc avatar simc commented on June 14, 2024

This doesn't bother you?

I don't have any problems with auto-complete. What problems do you experience?

from dartx.

yongjhih avatar yongjhih commented on June 14, 2024

We can split those duplicated methods into other flavored packages if they are really unnecessary.

from dartx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.