Huh?
tenhobi opened this issue · comments
I am really not sure what this repository is about. Almost all mentioned stuff is totally not a wtf and is rather matter of static typing or language specs.
The original JS repository contains a list of actual wtf moments when something should logically work and does not. This is just a list of things that might differ slightly from other languages and their specs. 🤷
Null is not null
How surprising is it that type is not a value?
Switch case fall-through
That works like that in a lot of languages...
Recursive function with no base case
Stack Overflow, is that a surprise?
Type Mismatch and Comparison Error
Even the IDE screams that this is an error...
String indexing
Works almost everywhere...
Using is with !
How is that a wtf?
Function with optional positional arguments
How is that a wtf?
Using await without async
How is this a wtf? Even the IDE screams at you that it's an error.
Mixing var and final
Again, how is that an error? Even the IDE tells you "Members can't be declared to be both 'final' and 'var'".
Comparing doubles
Well, I would be ok with that. Though this is like math works in computer math. :)
Using as with null
Is it wtf moment when you force casting that doesn't make sense and it throws?
Accessing private members
Dart has a library private. Not a wtf moment, read the spec.
Using assert with side effects
Why it the side effect should not propagate?
Using try without catch or finally
Dart has rethrow
keyword for cases when you don't want to process the exception.
Method Chaining with the Cascade Operator
How is that wtf?
Operator Precedence and Grouping
Yep, different precedence. https://dart.dev/language/operators
Copying Maps with Map.from()
Not a wtf.
String Concatenation without the + Operator
Not a wtf.
Surprising Results with num.parse()
Not a wtf. The result is correct.
String Interpolation with Conditional Expressions
Not a wtf.
Behavior with Optional Variables
Not a wtf.
👀 that’s why it is open source… feel free to make your updates