Skip to content
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

Dart lang improvements #582

Closed
dgrove opened this issue Sep 18, 2019 · 5 comments
Closed

Dart lang improvements #582

dgrove opened this issue Sep 18, 2019 · 5 comments

Comments

@dgrove
Copy link

dgrove commented Sep 18, 2019

@pouloghost commented on Tue Sep 17 2019

I'm new to flutter/dart from android. Dart seems to be more java than kotlin, which makes dart quite outdated. Some great kotlin language features are missing, and will you consider adding them into new versions of dart?

  • immutable at language level ( data class in kotlin)
  • property delegation ( by KProperty in kotlin)
  • inheritance limitation ( default not inheritable)
  • more declarative generic (where clause in C#)
@natebosch
Copy link
Member

immutable at language level

Please follow #314 and #125, and maybe #546

inheritance limitation

We do have @sealed. It's analyzer only and not at the language level. See https://pub.dev/documentation/meta/latest/meta/sealed-constant.html

I'm not sure if we have tracking for a request to make this language level - @leafpetersen do you know of any?

@leafpetersen
Copy link
Member

I'm not sure if we have tracking for a request to make this language level - @leafpetersen do you know of any?

We don't seem to have one.

@natebosch
Copy link
Member

#349 and #704 cover sealing.

  • property delegation ( by KProperty in kotlin)

IIUC this is runtime reflection and not something we plan to add.

  • more declarative generic (where clause in C#)

I'm guessing this is a request for LINQ? I think we'd probably want a more detail description of the use case for something this big.

This issue does not seem actionable outside of the linked duplicates. I'll close for now.

@mateusfccp
Copy link
Contributor

mateusfccp commented Mar 31, 2022

@natebosch The "more declarative generic (where clause in C#)" seems to be referring to the generic type constraint feature.

We already support some of this, like A<T extends B>, but not everything. One of the differences that I think is valuable is constructor constraints, like:

public class MyGenericClass<T> where T : IComparable<T>, new()
{
    // The following line is not possible without new() constraint:
    T item = new T();
}

There is already an issue for this, although closed: dart-lang/sdk#30074.

@natebosch
Copy link
Member

Thanks for the clarification!

There is also some discussion about being able to use some static interface from a generic type variable at #356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants