Tuesday, December 30, 2014

When cloning / theming dart-html example: anagram, I wanted to make it like Dart-learning course, I made this map of casual Dart keywords, that popped to my mind, and setted some time / effort values to them. These values present 1-9 numbers of time / effort / importance, of ao. learning subject... just my opinion.

Saturday, February 15, 2014

At the beginning of 2014 DartLang is still a work in progress. It do not yet have all the goodies that older lanquages have, but it is gonna go far. Dart may not be the best-laquage-possible to-bebuilt-now, BUT it is best, that can survive now, and to get great bunch of developers behind it.

Writing this in Nexus... numbering... must fix it in laptop. (lost in transition lol)

Sunday, February 9, 2014

Collecting links to Pub packages, in ordxer to find those, which are best suited for learning purposes, and to present different Dart properties.
- Trying to avoid using BIG environmets, like Polymer, Angular, Hop, Bot aso.

game_loop http://pub.dartlang.org/packages/game_loop This main loop is responsible for processing inputs from keyboards, mice, gamepads, and time. Also, the main loop manages browser state, e.g., pointer lock and fullscreen.

chess http://pub.dartlang.org/packages/chess A port of chess.js to Dart. chess.dart is a library for legal chess move generation, maintenance of chess game state, and conversion to and from the formats FEN and PGN.

Monday, February 3, 2014

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".

https://www.dartlang.org/articles/event-loop/#use-isolates-or-workers-if-necessary
Note: A Dart command-line app can run code in parallel by creating isolates. (Dart web apps can’t currently create additional isolates, but they can create workers.) Isolates don’t share memory; they’re like separate apps that communicate with each other by passing messages. With the exception of code that an app explicitly runs in additional isolates or workers, all of an app’s code runs in the app’s main isolate. For more information, see Use isolates or workers if necessary, later in this article.

How many isolates should you use? For compute-intensive tasks, you should generally use as many isolates as you expect to have CPUs available. Any additional isolates are just wasted if they’re purely computational. However, if the isolates perform asynchronous calls—to perform I/O, for example—then they won’t spend much time on the CPUs, so having more isolates than CPUs makes sense.

Dart replaces shared-memory threads with isolates
Concurrency is great, but shared-memory threads are error prone. Dart implements an isolate system for safer concurrent programming. Isolates are “isolated memory heaps” that can be spawned from a top-level function or URI. Isolates communicate by passing messages, which are copied before they are sent.
Understanding Futures:
Future is here: https://api.dartlang.org/docs/channels/stable/latest/dart_async.html
https://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-futures

Fun facts about Future:
The function that you pass into Future’s then() method executes immediately when the Future completes. (The function isn’t enqueued, it’s just called.)
If a Future is already complete before then() is invoked on it, then a task is added to the microtask queue, and that task executes the function passed into then().
The Future() and Future.delayed() constructors don’t complete immediately; they add an item to the event queue.
The Future.value() constructor completes in a microtask, similar to #2.
The Future.sync() constructor executes its function argument immediately and (unless that function returns a Future) completes in a microtask, similar to #2.

The event queue has entries from both Dart (futures, timers, isolate messages, and so on) and the system (user actions, I/O, and so on).
My conclusion:
Summary: Futures are: Asked my frend to do it, he returns with result .
I started the process, I get a response in due course.
Are part of (BIG) async.api
Isolates are: Outside workers to enhance our work. And to bring safety.
Are in (small) dart:isolate library api
Command line... parallel
Concurrent programming, independent workers similar to threads

Futures and Isolates work with time factor differently, to enhance programs effectiveness.