2017-04-30

Some thoughts on being a polyglot developer

A few days ago I gave two talks during our company conference MATHEMA Campus. One introduced the jshell, the other one offered a glipse at the Dart programming language. While demoing jshel I entered a lambda expression. I srewed up the input, using => instead of ->. The reason: in Dart => is used for one line functions, as in

test(var i) => i * i;

main() {
  print(test(4));
}

The Dart talk was scheduled for the following day so my brain must have pressed fast forward.

Smile

C#, by the way, uses => for lambda expressions. C, on the other hand, uses -> in conjunction with a pointer to access members of a sctruct or union. Then again, ES6 introduced arrow functions that look like this one:

let test = (x,y) => x*y;

One more thing... Swift also knows ->. Here it is a function type. AnyObject -> Void is the type of a function that accepts AnyObject and returns Void.

That's it for today, I think my next post will be called LET it be. Guess what I will cover...

Smile

If you mixed language constructs while try to be a polyglot developer, please feel free to share them

No comments:

Post a Comment