How to use ">>>" in Dart programming - dart

This is a description of the dart documentation
But
void main() {
print(3 >>> 1);
}
Unable to compile, got an error
Error: Expected an identifier, but got '>'.

The documentation is ahead of its time.
I assume the table comes from https://www.dartlang.org/guides/language/language-tour#operators
Dart removed the >>> operator in 2012 when it changed its integer type to arbitrary precision integers (except when compiled to JavaScript). There is no longer a >>> operator in Dart, and there haven't been for several years.
In Dart 2.0, Dart changed its integer type to 64-bit integers (still except when compiled to JavaScript). We plan to reintroduce the >>> operator, and have added it to the language specification, we it has not been implemented by all platforms yet, so it is not available.
The document here was just a little too optimistic about when we release that operator. It won't be in Dart 2.3, as was initially planned.

For all I know a signpropagating right shift operator in Dart is a >> b and not >>>. I don't think >>> exists. Either your source is incorrect or they have a mistake in their docs.

Related

Does dart have operator >>>?

The dart docs list of operators includes >>>, it is also in the Dart 2.2 Language Spec. However, it's not included in the list of overridable operators, this answer from 2012 says that it doesn't (or didn't) exist, and dartpad rejects 3 >>> 1. Is this just a mistake in the docs, or does the operator do something I can't figure out?
Short answer: not yet (as of July 2019)
Here's the master tracking issue: https://github.com/dart-lang/sdk/issues/30886

What does ~ mean in Dart?

Seen tilde in a few code examples in Dart. I've seen it used in C++ as a destructor where it can be called to delete the instance of a object Has it the same function in Dart? Is there an equivalent symbol in Java?
Dart doesn't support destructors
https://www.dartlang.org/guides/language/language-tour#operators
~ is currently only used for
~/ Divide, returning an integer result
and ~/= integer division and assignment.
There is not really an equivalent in Java.
In Java the result is an integer if the result is assigned to an integer variable (not sure though, not a Java dev)
The ~ operator is an overloadable operator on Dart objects, so it can mean anything you want it to. In the platform libraries, the only use is int.operator~ which does bitwise negation (like the similar integer operator in C, Java and JavaScript).
As Günther Zöchbauer mentions, the ~ also occurs in the overloadable ~/ operator which the platform libraries uses for integer division as num.operator~/. There is no relation between the ~ or ~/ operators by default.
So, it does not mean "destruction". Dart does not allow explicit destruction, or any destruction at all - the language specification doesn't say when an object dies. (Implementations garbage collect objects that the user code cannot see any more, to preserve memory).

What is the max value of integer in dart?

I have looked everywhere but I couldnt find any information related to this topic.
Also, Is there a java - like Long / BigDecimal datatype in dart?
That depends if you are running in the Dart VM or compiling to JavaScript.
On the Dart VM an int is arbitrary precision and has no limit.
When compiling to JavaScript you are actually using floating point numbers, since that is all that JavaScript supports. This means you are restricted to representing integers within the range -253 to 253
Dart 2
For dart2js generated JavaScript Pixel Elephants answer is still true.
within the range -253 to 253
Other execution platforms have fixed-size integers with 64 bits.
The type BigInt was added to typed_data
Since Dart 2.0 will switch to fixed-size integers, we also added a BigInt class to the typed_data library. Developers targeting dart2js can use this class as well. The BigInt class is not implementing num, and is completely independent of the num hierarchy.
Dart 1
There are also the packages
- https://pub.dartlang.org/packages/bignum
- https://pub.dartlang.org/packages/decimal
I prefer this one:
int hugeInteger = double.maxFinite.toInt()

What is the maximum Tuple Size in Swift, and why? [duplicate]

Each tuple cardinality is represented by its own type in swift (as in any other strongly-typed programming language I'm aware of), so we have
($T1, $T2)
($T1, $T2, $T3)
...
Since we have several different types, one per cardinality, they need to be finite.
In Scala we have up to Tuple22, in Haskell the current limit should be 64.
What's the limit (if any) in swift? Also, are the types implementations generated by the compiler or is there an explicit implementation I couldn't find?
In the current version of Xcode 6 Beta, compilation fails with tuples of arity larger than 1948 (the swift executable exits with code 254; there isn't a specific warning or error).

F# special quotes? (##)

I just ran across
http://frankniemeyer.blogspot.com/2010/04/minimalistic-native-64-bit-array.html
Which contains the line
(# "sizeof !0" type('T) : nativeint #)
I believe the technical phrase is "what the heck?" I have never in my (~8 months) of F# programming run across something even resembling that...
FSI tells me something about deprecated constructs, used only for F# libs...
And google with (# does uh...well, not much
Any direction in this?
This is the notation for inline IL emission. It used to be a more prominent feature during F#'s earlier years, but has been deprecated. A gentleman named Brian from the F# team has indicated that it is currently used mainly to bootstrap the F# compiler, and that the team had intended to mark this construct as an error, not merely a warning.
See his post here for the full story.
It's inline IL (intermediate language) code. This construct is used internally by the F# team to implement bits of the F# core library you just can't do any other way. This code will admit a warning saying it shouldn't be used any where other than the F# core libraries, so you probably don't have to worry about it too much as it should never appear in production code.
Fascinating. But I think F# already gives us the conversion operations (for this particular operation!) you need without resorting to IL.
[<Unverifiable>]
let inline ArrayOffset (itemSize:int64) (length:int64) (start:int64) (idx:int64) =
if idx < 0L || idx >= length then raise(IndexOutOfRangeException())
NativePtr.ofNativeInt(nativeint(start + (idx * itemSize)))

Resources