Coder Social home page Coder Social logo

Comments (6)

lukehutch avatar lukehutch commented on July 3, 2024 1

Sorry, I meant to report this in the language repository... will do.

from sdk.

lrhn avatar lrhn commented on July 3, 2024

This world the way it does because the upper bound operation on StateKey<_AState> and StateKey<_BState> is StateKey<U> where U is the upper bound of _AState and _BState.
Those two are different classes, so the algorithm falls through to the part that tries to give a common super-interface.

And since State<A> and State<B> are different interfaces, they are not the answer. Instead it seems Diagnosticable is the nearest unique shared superinterface.

from sdk.

lukehutch avatar lukehutch commented on July 3, 2024

OK, so it's WAI. Thanks for explaining!

from sdk.

eernstg avatar eernstg commented on July 3, 2024

I'll add a comment here, just to check out the behavior of a proposed update to the underlying algorithm.

The proposal is about modifying the UP algorithm in dart-lang/language#3282 such that it finds the least common superclass rather than supertype. (OK, it's "standard" rather than "least", as usual).

With that proposal we do get the desired result:

UP(StateKey<_AState>, StateKey<_BState>) ==
StateKey<UP(_AState, _BState)> == 
// Standard common superclass of `_AState` and `_Bstate` is `State`,
// superinterface of `_AState`/`_BState` at `State` is `State<A>`/`State<B>`.
StateKey<UP(State<A>, State<B>)> ==
StateKey<State<UP(A, B)>> ==
StateKey<State<StatefulWidget>>

from sdk.

lukehutch avatar lukehutch commented on July 3, 2024

Yes, the issue you identify at the beginning of that report is what I was seeing here. So I will re-open this issue. Thanks!

from sdk.

eernstg avatar eernstg commented on July 3, 2024

Hi @lukehutch!

I'm afraid it is still correct to describe this issue as reporting on a behavior which is specified. That is, there is nothing to fix here from the perspective of the SDK repository.

The issue dart-lang/language#3282 in the language repository is a proposal about changing the behavior of the UP algorithm. In other words, a future version of Dart could have a specification that allows it to behave in the way I described, if that proposal is accepted.

So we could move this issue to the language repository and consider it to be a request for a change similar to the one in dart-lang/language#3282, but it would then basically be a duplicate of that issue.

Perhaps you could write a comment on dart-lang/language#3282 referring to this issue as an example case for that change, and then close this one again?

from sdk.

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.