Monday, February 3, 2014

My note: Dart. Functions. A bunch of instructions, which executes sequentially.


Class. You can pick class methods one at a time, and execute it.

Function. wikipedia; Function: (subroutine)

In computer programming, a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit.

...................


Commands are fullfilled in sequential order. Nothing can stop functions execution. "When a function that returns a Future is invoked, two things happen:

The function queues up work to be done and returns an uncompleted Future object immediately.
Later, when the value is available, the Future object completes with that value or with an error."

spec 1.1 Functions abstract over executable actions. Because Dart is optionally typed, we cannot guarantee that a function that does not return a value will not be used in the context of an expression. Therefore, every function must return a value. A return without an expression returns null.
A function declaration is a function that is neither a member of a class nor a function literal. Function declarations include library functions, which are function declarations at the top level of a library, and local functions, which are functions declarations declared inside other functions. Library functions are often referred to simply as top-level functions.


If a function does not declare a return type explicitly, its return type is dynamic.


From: https://www.dartlang.org/articles/event-loop/
Once a Dart function starts executing, it continues executing until it exits. In other words, Dart functions can’t be interrupted by other Dart code.




https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html
A closure is a function object that has access to variables in its lexical scope, even when the function is used outside of its original scope. Functions can close over variables defined in surrounding scopes.

Typedefs
In Dart,functions are objects, just like strings and numbers are objects. A typedef, or function-type alias, gives a function type a name that you can use when declaring fields and return types. A typedef retains type information when a function type is assigned to a variable.


My note: Nowhere (or where?) in Dart doc is clearly said "Function is a collection of elements/code, which are all evaluated in sequence"
".. bunch of logic".

Published originally  in  etdart.blogspot.fi   

No comments:

Post a Comment