You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off I would like to apologise because this is not an issue with invariant_collection. I am writing here only because I don't know how to contact you ':-)
Your attention to writing safe and readable code and your contribution to Dart made me reach out to you for assistance.
I am collecting examples of "odd" Dart code for my presentation.
What do I mean by "odd"?
Odd code is code which is either undefined or unclear. Undefined is self-explanatory, but I doubt there is anything undefined in the Dart standard (you tell me :D). Unclear is code which can confuse the reader and induce him to thinking it does thing X, when in reality it does thing Y.
Motivation
I am a member of a discord server focusing on embedded engineering and it features an "odd problems emporium" channel. People post odd code and without using a compiler you need to explain what that code does.
Example:
/* C99 */intmain(void) {
inti=1;
returni / i++;
}
What does this program return? Solution is that this is UB as there is no sequence point.
Return values of methods are allowed to be specialized, while for parameters you need covariant.
I will present this as "odd" because most people will be confused after I show them these two examples in succession:
Conditional member access operator discards the assignment operations
final class Foo {
int i = 0;
}
void main() {
Foo? foo;
int i = 0;
foo?.i = ++i;
print(i);
}
Note
I am not trying to get anyone to dislike Dart and all of these "issues" have a valid reasoning behind their existence.
Thank you for reading this and I hope you can provide some more examples of oddity in Dart. Also, would you like to say something so I can put it as a quote in the presentation?
Cheers
The text was updated successfully, but these errors were encountered:
First off I would like to apologise because this is not an issue with
invariant_collection
. I am writing here only because I don't know how to contact you ':-)Your attention to writing safe and readable code and your contribution to Dart made me reach out to you for assistance.
I am collecting examples of "odd" Dart code for my presentation.
What do I mean by "odd"?
Odd code is code which is either undefined or unclear. Undefined is self-explanatory, but I doubt there is anything undefined in the Dart standard (you tell me :D). Unclear is code which can confuse the reader and induce him to thinking it does thing X, when in reality it does thing Y.
Motivation
I am a member of a discord server focusing on embedded engineering and it features an "odd problems emporium" channel. People post odd code and without using a compiler you need to explain what that code does.
Example:
What does this program return? Solution is that this is UB as there is no sequence point.
What have I collected so far
No real type safety
dart-lang/sdk#55021
Default parameters are allowed to be overriden
the existence of
covariant
Return values of methods are allowed to be specialized, while for parameters you need
covariant
.I will present this as "odd" because most people will be confused after I show them these two examples in succession:
Slide 1:
Slide 2:
void is of type Null and has a size
Pattern matching is falsely non-exhaustive
dart-lang/language#3633
Conditional member access operator discards the assignment operations
Note
I am not trying to get anyone to dislike Dart and all of these "issues" have a valid reasoning behind their existence.
Thank you for reading this and I hope you can provide some more examples of oddity in Dart. Also, would you like to say something so I can put it as a quote in the presentation?
Cheers
The text was updated successfully, but these errors were encountered: