DART on Googlen avoimen lähdekoodin ohjelmointikieli, joka toimii verkkosivuilla ja servereissä, ja jolla voi JavaScriptiä paremmin hoitaa suurten verkkosovellusten koodaamisen. DART kielen kehitys aloitettiin 9/2011 ja 1.0-versio kielestä julkistettiin loppuvuodesta -2013. Nyt jo on olemassa lähes valmiit työkalut Chrome selainta varten. Blogger-blogien pitäjiä varten saamme ehkä kiintoisia Gadgetteja sivupalkkeihin ja muuta toiminnallisuutta verkkosivuille.
TÄMÄ blogi sisältää pääosin omia pohdintojani ja muistiinpanoja, eikä se varmaankaan tuo kovinkaan paljon uutta DART-kielen opiskeluun. Materiaali on pääosin KOPIOITU :( Dartlang-sivustoilta, josta kannattaa KÄYDÄ TARKISTAMASSA kielen viimeiset syntaksit.

perjantai 20. huhtikuuta 2012

Pohtimassa <> merkkien käyttöä, T, E , DART:issa

Lisäksi DART kielessä on näitä <T>   <E>  ilmaisuja.  Muiden sulkumerkkien jälkeen ne pysähdyttävät hieman miettimään...    Miksi juuri  T   ja  E  ?
(K,V)  Tarkoittaa siis Key ja Value,  sehän on selvää.
Kokoan leikkeitä ohjeista:

http://www.dartlang.org/language-tour/#generics

Generics

If you look at the API documentation for the basic array type, List, you'll see that the type is actuallyList<E>. The <...> notation marks List as a generic (or parameterized) type—a type that can declare formal type parameters.
For example, if you intend for a list to contain only strings, you can declare it as List<String> (read that as "List of String"). 
....
Generic types can save you the trouble of creating all these interfaces. Instead, you can create a single interface that takes a type parameter:
interface Cache<T> {
  T getByKey(String key);
  setByKey(String key, T value);
}
In this code, T is the stand-in type. It's a placeholder that you can think of as a type that a developer will define later.

Using collection literals

Both built-in collection types are parameterized: lists and maps. Parameterized literals are just like the literals you've already seen, except that you add <type> before the opening bracket. For example:
List<String> names = <String>['Seth', 'Kathy', 'Lars'];
Map<String, String> pages = <String>{ // specify value type: String
    'index.html':'Homepage',  // (the key type is implicitly String)
    'robots.txt':'Hints for web robots',
    'humans.txt':'We are people, not machines' };


NO?  Näyttää siltä siis, että <> merkinnän sisällä on "tyyppi"...
..
To specify one or more types when using a constructor, put the types in angle brackets (<...>
..

Generic collections and the types they contain

Dart generic types are reified, which is a fancy way of saying that they carry their type information around at runtime. 
= = = = = = = = = = = = = = = = = = = = = = = = = 



SIIS:  E   T   K   V 
What is this T  in <T>  ?

Interface Future<T>

Future is used to obtain a value sometime in the future. Receivers of a Future obtain the value by passing a callback to then

========================================================

What is this   E   in <E>  ?  

===========================================

Typedefs can be parameterized.
typedef int Compare<T>(T a, T b);

class SortedCollection<T> {
  Compare<T> compare;
  SortedCollection(this.compare);
}

main() {
  SortedCollection<int> s = new SortedCollection<int>((a,b) => a - b);
  print(s.compare is Compare<int>);  // true
  print(s.compare('a','b'));  // checked mode throws exception
}
dartlang  0.08

typeParameter:
identifier (extends type)?
;
typeParameters:
`<' typeParameter (`,' typeParameter)* `>'
;
A type parameter T may be suffixed with an extends clause that specifies
the upper bound for T.

A type parameter T may be suffixed with an extends clause that specifies
the upper bound for T.   ....

Tässäpä hieman sulattelemista...    Täydennän tekstiä vielä...  


http://c.dart-examples.com/learn/variables/collections
Tämä kirjoitus tuo hieman lisävalaistusta asiaan...

.

sunnuntai 15. huhtikuuta 2012

Dart Editor 6442 Highlights


    Highlights ... build 6442

    - full debugging turned on by default
    - initial cut of new html + css editors (work in progress)
    - live css editing...
    - your css edits get pushed up to Dartium live,
    - without you having to refresh or relaunch the browser
    - new Callers view
    - debugging field inspection and Dartium stability improvements
    - rename local variable (work in progress)
    - parser recovery and code completion improvements
    - dartdoc hover text improvements  

Oh!  it seems that I dont have time to load even this, still using  6167...
Too much learning just now...