SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
C'EST QUOI ?
         Une "surcouche" javascript
          Langage jeune (déc 2009)
Une syntaxe inspiré de Python, Ruby et Haskell
POURQUOI L'UTILISER ?
Rendre le code plus lisible (donc plus maintenable)
           Rapidité de développement
   Eviter les nombreuses erreurs possible en JS
EN PRATIQUE
1.  Ecrire son code
2.  Compiler en Javascript
   cfe -cmiefl.ofe
    ofe -opl iecfe
   cfe -wth-cmiefl.ofe
    ofe -ac -opl iecfe

3.  Inclure son fichier js
VARIABLES
DÉFINIR UNE VARIABLE

ba="n vral"
 l  ue aibe



vrba
 a l;

ba="n vral"
 l  ue aibe;
mti =[
 arx
  1 0 1
   , ,
  0 1 0
   , ,
  1 0 1
   , ,
]

mp=
 a
  a 1
   :
  b 2
   :
  c 3
   :



vrmp mti;
 a a, arx

mti =[,0 1 0 1 0 1 0 1;
 arx  1 , , , , , , , ]

mp={
 a
  a 1
   : ,
  b 2
   : ,
  c 3
   :
};
TESTER UNE VARIABLE

i ba
 f l?



i (yefba!="neie"& ba!=nl)
 f tpo l = udfnd & l = ul
AFFECTER PLUSIEURS VARIABLES

[a1 vr.. vr]=[,2 3 4 5
 vr, a2., a3 1 , , , ]



vrvr,vr,vr,_,_e,
 a a1 a2 a3 i rf
  _sie=[.lc;
   _lc  ]sie

_e =[,2 3 4 5,vr =_e[] vr =3< _e.egh?_siecl(rf 1 _ =_e.egh-1 :(i
 rf   1 , , , ] a1 rf0, a2   = rflnt  _lc.al_e, , i  rflnt  )  _
 =1 [) vr =_e[i+;
   , ], a3   rf_+]


                                  Output
vr = 1
 a1 >
vr = [,3 4
 a2 > 2 , ]
vr = 5
 a3 >
CONDITIONS
MOT CLÉ
                         if / unless 
                           is / isnt 
i vr i vr
 f a1 s a2
  cnoelgvr
   osl.o a1


cnoelgvr uls vr in vr
 osl.o a1 nes a1 st a2



i (a1==vr){
 f vr = a2
  cnoelgvr)
   osl.o(a1;
}
CONDITIONS MULTIPLES


   Les "classiques" && et || sont remplacés par 'and' et 'or'


i aadbo c
 f  n  r



i ( & b| c
 f a &  | )




i 20<a<30
 f 0    0



i (0 <a& a<30
 f 20   &   0)
CONDITIONS TERNAIRES
i vr i vr te cnoelg""es cnoelg"=
 f a1 s a2 hn osl.o = le osl.o !"

vr =i vr i vr te 3es 4
 a3  f a1 s a2 hn le



vrvr;
 a a3

i (a1==vr){
 f vr = a2
  cnoelg"";
   osl.o(=)
}es {
   le
  cnoelg"=)
   osl.o(!";
}

vr =vr ==vr ?3:4
 a3  a1 = a2    ;
BOUCLES
COLLECTION
         Le mot clé in pour itérer sur les éléments d'une collection
froji cleto
 o b n olcin
  cnoelgoj
   osl.o b


cnoelgojfroji cleto
 osl.o b o b n olcin



vroj _,_e;
 a b, i ln

fr(i=0 _e =cleto.egh _ <_e;_+){
 o _   , ln olcinlnt; i  ln i+
  oj=cleto[i;
   b  olcin_]
  cnoelgoj;
   osl.o(b)
}
FILTRES
         Le mot clé when pour mettre une condition à notre boucle
froji cleto we ojin aohrb
 o b n olcin hn b st nteOj
  cnoelg"bet #oj"
   osl.o ojc: {b}



vroj _,_e;
 a b, i ln

fr(i=0 _e =cleto.egh _ <_e;_+){
 o _    , ln olcinlnt; i ln i+
  oj=cleto[i;
   b   olcin_]
  i (b !=aohrb){
   f oj = nteOj
    cnoelg"bet "+oj;
     osl.o(ojc:   b)
  }
}
WHILE

i=0
wiei<1
 hl   0
  i+
   +

i=0
utli> 1
 ni  = 0
  i+
   +



vri
 a ;

i=0;

wie( <1){
 hl i  0
  i+
   +;
}

i=0;

wie(( > 1) {
 hl !i = 0)
  i+
   +;
}
FONCTIONS
FONCTIONS ANONYMES

( -
 ) >
  cnoelg"ocinaoye
   osl.o fnto nnm"



(ucin){
 fnto(
  rtr cnoelg"ocinaoye)
   eun osl.o(fnto nnm";
};
 )



$aa
 .jx
  ul ""
   r: /
  sces (aa txSau,jXR -
   ucs: dt, ettts qH) >
    cnoelgdt
     osl.o aa
FONCTIONS

sm=(olcin[)-
 u   cleto=] >
  rs=0
   e
  rs+ ee free i cleto
   e = lm o lm n olcin
  rs
   e



vrsm
 a u;

sm=fnto(olcin {
 u    ucincleto)
  vree,rs _,_e;
   a lm e, i ln
  i (olcin= nl){
   f cleto = ul
    cleto =[;
     olcin    ]
  }
  rs=0
   e    ;
  fr(i=0 _e =cleto.egh _ <_e;_+){
   o _     , ln olcinlnt; i ln i+
    ee =cleto[i;
     lm   olcin_]
    rs+ ee;
     e = lm
  }
  rtr rs
   eun e;
};
PORTÉ DES VARIABLES
a=- >
 vr =1
  a1    2
 b=-  >
   vr =2
    a2    3
   vr =1
    a1    3
   rtr
    eun



vra
 a ;

a=fnto( {
     ucin)
  vrb vr;
   a , a1
  vr =1;
   a1   2
  rtr b=fnto( {
   eun      ucin)
    vrvr;
     a a2
    vr =2;
     a2   3
    vr =1;
     a1   3
  };
};
CLASSES
DÉFINIR UNE CLASSE

casBl
 ls al

 cntutr (x0 @=)-
  osrco: @=, y0 >

 mv:(x @)-
  oe @, y >



vrBl;
 a al
Bl =(ucin){
 al  fnto(

 fnto Bl(,y {
  ucin alx )
   ti. =x! nl ?x:0
    hsx   = ul    ;
   ti. =y! nl ?y:0
    hsy   = ul    ;
 }

 Bl.rttp.oe=fnto(,y {
  alpooyemv ucinx )
   ti. =x
    hsx  ;
   ti. =y
    hsy  ;
 };

  rtr Bl;
   eun al
}(;
 ))
HÉRITAGE
casOjc
 ls bet

 cntutr (x0 @=)-
  osrco: @=, y0 >

 mv:(x @)-
  oe @, y >


casBl etnsOjc
 ls al xed bet

 cntutr (x @,@ais -
  osrco: @, y rdu) >
   spr@,@
    ue x y

 epoe -
  xld: >
   #d suf
     o tf



bl =nwBl(
 al  e al)
bl.oe1,1
 almv 0 0
bl.xld(
 alepoe)
PROBLÈMES
WRAP
Tous les fichiers compilés sont englobés dans une fonction anonyme (par fichier)

                                     SOLUTION
                   Compiler avec l'option
                     -n-rp
                      -owa

                   Rendre accessible les variables dans window
                     wno.al=casBl ..
                      idwBl  ls al .

                     wno.al=Bl
                      idwBl  al

                   Joindre les fichiers
                     -ji
                      -on
CONTEXT
           Quand une fonction est appelée par un context différent
$"bl".lc -
 (#al)cik >
  @xld( #eru cr@rmlc pr"hs (eDMciu)
   epoe)  rer a  epaé a ti" l O lqé
  $ti)rmv( #o
   (hs.eoe)  k



$"bl".lc =
 (#al)cik >
  @xld(
   epoe)    #ok
  $ti)rmv( #eru crti etlojc Bl
   (hs.eoe)   rer a hs s 'bet al


                                   SOLUTION
                                A la mano :'(
_hs=@
 ti
$"bl".lc -
 (#al)cik >
  _hsepoe)
   ti.xld(
  $ti)rmv(
   (hs.eoe)
PAS DE MACROS :(

   # DBG=ys
    > EU   e
   # SA =(a1 vr)-
    > WP  vr, a2 >
   #> tp=vr
       m   a1
   #> vr =vr
       a1   a2
   #> vr =tp
       a2   m

   a=2
   b=3
   SA a b
    WP ,
   # i DBGi ys
    > f EU s e
     cnoelga b
      osl.o ,
   # es
    > le
     $"upt)hm ":#a,b #b"
      (otu".tl a {} : {}




#Ae DBGi ys
   vc EU s e                #Ae DBGi n
                               vc EU s o
a=2 ;                       a=2 ;
b=3 ;                       b=3 ;
tp=a
 m    ;                     tp=a
                             m    ;
a=b ;                       a=b ;
b=tpm;                      b=tpm;
cnoelga b;
 osl.o(, )                  $"upt)hm(a "+a+" b"+b;
                             (otu".tl":     , :  )
EQUIVALENT À COFFEESCRIPT
         TypeScript (Microsoft)
         Sweetjs (Mozilla)
         Dart (Google)          


             LIENS UTILES
http://js2coffee.org/
http://coffeescript.org/
https://github.com/jashkenas/coffee­script
ANTHONY ESTEBE
              “
DÉVELOPPEUR WEB FREELANCE
     twitter: @antho1404
      skype: antho1404
        github: antho1404
site:  http://anthonyestebe.com
              ”

Contenu connexe

Tendances

Bases de PHP - Partie 1
Bases de PHP - Partie 1Bases de PHP - Partie 1
Bases de PHP - Partie 1Régis Lutter
 
Code Week 2014 - atelier d'initiation à la programmation avec python
Code Week 2014 - atelier d'initiation à la programmation avec pythonCode Week 2014 - atelier d'initiation à la programmation avec python
Code Week 2014 - atelier d'initiation à la programmation avec pythonbbourgois
 
Evénements spécieaux mandarin
Evénements spécieaux mandarinEvénements spécieaux mandarin
Evénements spécieaux mandarinThomas Fugier
 
JavaScript prise en main et fondamentaux
JavaScript prise en main et fondamentauxJavaScript prise en main et fondamentaux
JavaScript prise en main et fondamentauxVincent Petetin
 
Uniform Variable Syntax
Uniform Variable SyntaxUniform Variable Syntax
Uniform Variable SyntaxDarkmira
 
Meet up symfony 11 octobre 2016 - Les formulaire
Meet up symfony 11 octobre 2016 - Les formulaireMeet up symfony 11 octobre 2016 - Les formulaire
Meet up symfony 11 octobre 2016 - Les formulaireJulien Vinber
 
Javascript : fondamentaux et OOP
Javascript : fondamentaux et OOPJavascript : fondamentaux et OOP
Javascript : fondamentaux et OOPJean-Pierre Vincent
 
La programmation fonctionnelle avec le langage OCaml
La programmation fonctionnelle avec le langage OCamlLa programmation fonctionnelle avec le langage OCaml
La programmation fonctionnelle avec le langage OCamlStéphane Legrand
 
Theme 9(bis)
Theme 9(bis)Theme 9(bis)
Theme 9(bis)salmazen
 
Les bonnes pratiques de l'architecture en général
Les bonnes pratiques de l'architecture en généralLes bonnes pratiques de l'architecture en général
Les bonnes pratiques de l'architecture en généralGeoffrey Bachelet
 

Tendances (18)

Implementing a key/value store
Implementing a key/value storeImplementing a key/value store
Implementing a key/value store
 
Langage Perl
Langage PerlLangage Perl
Langage Perl
 
My sql console
My sql consoleMy sql console
My sql console
 
Bases de PHP - Partie 1
Bases de PHP - Partie 1Bases de PHP - Partie 1
Bases de PHP - Partie 1
 
Code Week 2014 - atelier d'initiation à la programmation avec python
Code Week 2014 - atelier d'initiation à la programmation avec pythonCode Week 2014 - atelier d'initiation à la programmation avec python
Code Week 2014 - atelier d'initiation à la programmation avec python
 
Php1
Php1Php1
Php1
 
Evénements spécieaux mandarin
Evénements spécieaux mandarinEvénements spécieaux mandarin
Evénements spécieaux mandarin
 
Shell
ShellShell
Shell
 
JavaScript prise en main et fondamentaux
JavaScript prise en main et fondamentauxJavaScript prise en main et fondamentaux
JavaScript prise en main et fondamentaux
 
Uniform Variable Syntax
Uniform Variable SyntaxUniform Variable Syntax
Uniform Variable Syntax
 
Tp-jquery
Tp-jqueryTp-jquery
Tp-jquery
 
Meet up symfony 11 octobre 2016 - Les formulaire
Meet up symfony 11 octobre 2016 - Les formulaireMeet up symfony 11 octobre 2016 - Les formulaire
Meet up symfony 11 octobre 2016 - Les formulaire
 
Javascript : fondamentaux et OOP
Javascript : fondamentaux et OOPJavascript : fondamentaux et OOP
Javascript : fondamentaux et OOP
 
Cours php
Cours phpCours php
Cours php
 
La programmation fonctionnelle avec le langage OCaml
La programmation fonctionnelle avec le langage OCamlLa programmation fonctionnelle avec le langage OCaml
La programmation fonctionnelle avec le langage OCaml
 
Cours php
Cours phpCours php
Cours php
 
Theme 9(bis)
Theme 9(bis)Theme 9(bis)
Theme 9(bis)
 
Les bonnes pratiques de l'architecture en général
Les bonnes pratiques de l'architecture en généralLes bonnes pratiques de l'architecture en général
Les bonnes pratiques de l'architecture en général
 

Similaire à Coffee script

Gestion des logs sur une plateforme web
Gestion des logs sur une plateforme webGestion des logs sur une plateforme web
Gestion des logs sur une plateforme webfredcons
 
Beyond F5 - windbg et .Net
Beyond F5 - windbg et .NetBeyond F5 - windbg et .Net
Beyond F5 - windbg et .NetYann Schwartz
 
ALF 3 - Expressions régulières et Lexer
ALF 3 - Expressions régulières et Lexer ALF 3 - Expressions régulières et Lexer
ALF 3 - Expressions régulières et Lexer Alexandru Radovici
 
Les principes de base de PHP
 Les principes de base de PHP  Les principes de base de PHP
Les principes de base de PHP EL JAOUARI Ahmed
 
Trucs et astuces PHP et MySQL
Trucs et astuces PHP et MySQLTrucs et astuces PHP et MySQL
Trucs et astuces PHP et MySQLDamien Seguy
 
ALF 11 - Diagrame de flux de controlle
ALF 11 - Diagrame de flux de controlleALF 11 - Diagrame de flux de controlle
ALF 11 - Diagrame de flux de controlleAlexandru Radovici
 
Présentation Scala
Présentation ScalaPrésentation Scala
Présentation Scalajeremy guido
 
Future of java script web version
Future of java script web versionFuture of java script web version
Future of java script web versionSébastien Pertus
 
Programmation fonctionnelle
Programmation fonctionnelleProgrammation fonctionnelle
Programmation fonctionnelleGeeks Anonymes
 
UML OCL : Cheat Sheet - 10
UML OCL : Cheat Sheet - 10UML OCL : Cheat Sheet - 10
UML OCL : Cheat Sheet - 10megaplanet20
 
Analyse statique et applications
Analyse statique et applicationsAnalyse statique et applications
Analyse statique et applicationsDamien Seguy
 
La référence Clear php
La référence Clear phpLa référence Clear php
La référence Clear phpDamien Seguy
 
Introduction à Python - Achraf Kacimi El Hassani
Introduction à Python - Achraf Kacimi El HassaniIntroduction à Python - Achraf Kacimi El Hassani
Introduction à Python - Achraf Kacimi El HassaniShellmates
 
Solr overview presentation
Solr overview presentationSolr overview presentation
Solr overview presentationspy-seth
 

Similaire à Coffee script (20)

Gestion des logs sur une plateforme web
Gestion des logs sur une plateforme webGestion des logs sur une plateforme web
Gestion des logs sur une plateforme web
 
Compte rendu jess
Compte rendu jessCompte rendu jess
Compte rendu jess
 
ALF 11 - WebAssembly
ALF 11 - WebAssemblyALF 11 - WebAssembly
ALF 11 - WebAssembly
 
Beyond F5 - windbg et .Net
Beyond F5 - windbg et .NetBeyond F5 - windbg et .Net
Beyond F5 - windbg et .Net
 
ALF 3 - Expressions régulières et Lexer
ALF 3 - Expressions régulières et Lexer ALF 3 - Expressions régulières et Lexer
ALF 3 - Expressions régulières et Lexer
 
Les principes de base de PHP
 Les principes de base de PHP  Les principes de base de PHP
Les principes de base de PHP
 
Trucs et astuces PHP et MySQL
Trucs et astuces PHP et MySQLTrucs et astuces PHP et MySQL
Trucs et astuces PHP et MySQL
 
ALF 11 - Diagrame de flux de controlle
ALF 11 - Diagrame de flux de controlleALF 11 - Diagrame de flux de controlle
ALF 11 - Diagrame de flux de controlle
 
Introduction à Ruby
Introduction à RubyIntroduction à Ruby
Introduction à Ruby
 
Présentation Scala
Présentation ScalaPrésentation Scala
Présentation Scala
 
Like virgin
Like virginLike virgin
Like virgin
 
Future of java script web version
Future of java script web versionFuture of java script web version
Future of java script web version
 
Programmation fonctionnelle
Programmation fonctionnelleProgrammation fonctionnelle
Programmation fonctionnelle
 
UML OCL : Cheat Sheet - 10
UML OCL : Cheat Sheet - 10UML OCL : Cheat Sheet - 10
UML OCL : Cheat Sheet - 10
 
Analyse statique et applications
Analyse statique et applicationsAnalyse statique et applications
Analyse statique et applications
 
La référence Clear php
La référence Clear phpLa référence Clear php
La référence Clear php
 
Introduction à Python - Achraf Kacimi El Hassani
Introduction à Python - Achraf Kacimi El HassaniIntroduction à Python - Achraf Kacimi El Hassani
Introduction à Python - Achraf Kacimi El Hassani
 
C++ 11/14
C++ 11/14C++ 11/14
C++ 11/14
 
Support programmation orientée objet c# .net version f8
Support programmation orientée objet c#  .net version f8Support programmation orientée objet c#  .net version f8
Support programmation orientée objet c# .net version f8
 
Solr overview presentation
Solr overview presentationSolr overview presentation
Solr overview presentation
 

Coffee script

  • 1.
  • 2. C'EST QUOI ? Une "surcouche" javascript Langage jeune (déc 2009) Une syntaxe inspiré de Python, Ruby et Haskell
  • 3. POURQUOI L'UTILISER ? Rendre le code plus lisible (donc plus maintenable) Rapidité de développement Eviter les nombreuses erreurs possible en JS
  • 4. EN PRATIQUE 1.  Ecrire son code 2.  Compiler en Javascript cfe -cmiefl.ofe ofe -opl iecfe cfe -wth-cmiefl.ofe ofe -ac -opl iecfe 3.  Inclure son fichier js
  • 6. DÉFINIR UNE VARIABLE ba="n vral" l ue aibe vrba a l; ba="n vral" l ue aibe;
  • 7. mti =[ arx 1 0 1 , , 0 1 0 , , 1 0 1 , , ] mp= a a 1 : b 2 : c 3 : vrmp mti; a a, arx mti =[,0 1 0 1 0 1 0 1; arx 1 , , , , , , , ] mp={ a a 1 : , b 2 : , c 3 : };
  • 8. TESTER UNE VARIABLE i ba f l? i (yefba!="neie"& ba!=nl) f tpo l = udfnd & l = ul
  • 9. AFFECTER PLUSIEURS VARIABLES [a1 vr.. vr]=[,2 3 4 5 vr, a2., a3 1 , , , ] vrvr,vr,vr,_,_e, a a1 a2 a3 i rf _sie=[.lc; _lc ]sie _e =[,2 3 4 5,vr =_e[] vr =3< _e.egh?_siecl(rf 1 _ =_e.egh-1 :(i rf 1 , , , ] a1 rf0, a2 = rflnt _lc.al_e, , i rflnt ) _ =1 [) vr =_e[i+; , ], a3 rf_+] Output vr = 1 a1 > vr = [,3 4 a2 > 2 , ] vr = 5 a3 >
  • 11. MOT CLÉ if / unless  is / isnt  i vr i vr f a1 s a2 cnoelgvr osl.o a1 cnoelgvr uls vr in vr osl.o a1 nes a1 st a2 i (a1==vr){ f vr = a2 cnoelgvr) osl.o(a1; }
  • 12. CONDITIONS MULTIPLES Les "classiques" && et || sont remplacés par 'and' et 'or' i aadbo c f n r i ( & b| c f a & | ) i 20<a<30 f 0 0 i (0 <a& a<30 f 20 & 0)
  • 13. CONDITIONS TERNAIRES i vr i vr te cnoelg""es cnoelg"= f a1 s a2 hn osl.o = le osl.o !" vr =i vr i vr te 3es 4 a3 f a1 s a2 hn le vrvr; a a3 i (a1==vr){ f vr = a2 cnoelg""; osl.o(=) }es { le cnoelg"=) osl.o(!"; } vr =vr ==vr ?3:4 a3 a1 = a2 ;
  • 15. COLLECTION Le mot clé in pour itérer sur les éléments d'une collection froji cleto o b n olcin cnoelgoj osl.o b cnoelgojfroji cleto osl.o b o b n olcin vroj _,_e; a b, i ln fr(i=0 _e =cleto.egh _ <_e;_+){ o _ , ln olcinlnt; i ln i+ oj=cleto[i; b olcin_] cnoelgoj; osl.o(b) }
  • 16. FILTRES Le mot clé when pour mettre une condition à notre boucle froji cleto we ojin aohrb o b n olcin hn b st nteOj cnoelg"bet #oj" osl.o ojc: {b} vroj _,_e; a b, i ln fr(i=0 _e =cleto.egh _ <_e;_+){ o _ , ln olcinlnt; i ln i+ oj=cleto[i; b olcin_] i (b !=aohrb){ f oj = nteOj cnoelg"bet "+oj; osl.o(ojc: b) } }
  • 17. WHILE i=0 wiei<1 hl 0 i+ + i=0 utli> 1 ni = 0 i+ + vri a ; i=0; wie( <1){ hl i 0 i+ +; } i=0; wie(( > 1) { hl !i = 0) i+ +; }
  • 19. FONCTIONS ANONYMES ( - ) > cnoelg"ocinaoye osl.o fnto nnm" (ucin){ fnto( rtr cnoelg"ocinaoye) eun osl.o(fnto nnm"; }; ) $aa .jx ul "" r: / sces (aa txSau,jXR - ucs: dt, ettts qH) > cnoelgdt osl.o aa
  • 20. FONCTIONS sm=(olcin[)- u cleto=] > rs=0 e rs+ ee free i cleto e = lm o lm n olcin rs e vrsm a u; sm=fnto(olcin { u ucincleto) vree,rs _,_e; a lm e, i ln i (olcin= nl){ f cleto = ul cleto =[; olcin ] } rs=0 e ; fr(i=0 _e =cleto.egh _ <_e;_+){ o _ , ln olcinlnt; i ln i+ ee =cleto[i; lm olcin_] rs+ ee; e = lm } rtr rs eun e; };
  • 21. PORTÉ DES VARIABLES a=- > vr =1 a1 2 b=- > vr =2 a2 3 vr =1 a1 3 rtr eun vra a ; a=fnto( { ucin) vrb vr; a , a1 vr =1; a1 2 rtr b=fnto( { eun ucin) vrvr; a a2 vr =2; a2 3 vr =1; a1 3 }; };
  • 23. DÉFINIR UNE CLASSE casBl ls al cntutr (x0 @=)- osrco: @=, y0 > mv:(x @)- oe @, y > vrBl; a al Bl =(ucin){ al fnto( fnto Bl(,y { ucin alx ) ti. =x! nl ?x:0 hsx = ul ; ti. =y! nl ?y:0 hsy = ul ; } Bl.rttp.oe=fnto(,y { alpooyemv ucinx ) ti. =x hsx ; ti. =y hsy ; }; rtr Bl; eun al }(; ))
  • 24. HÉRITAGE casOjc ls bet cntutr (x0 @=)- osrco: @=, y0 > mv:(x @)- oe @, y > casBl etnsOjc ls al xed bet cntutr (x @,@ais - osrco: @, y rdu) > spr@,@ ue x y epoe - xld: > #d suf o tf bl =nwBl( al e al) bl.oe1,1 almv 0 0 bl.xld( alepoe)
  • 26. WRAP Tous les fichiers compilés sont englobés dans une fonction anonyme (par fichier) SOLUTION Compiler avec l'option -n-rp -owa Rendre accessible les variables dans window wno.al=casBl .. idwBl ls al . wno.al=Bl idwBl al Joindre les fichiers -ji -on
  • 27. CONTEXT Quand une fonction est appelée par un context différent $"bl".lc - (#al)cik > @xld( #eru cr@rmlc pr"hs (eDMciu) epoe) rer a epaé a ti" l O lqé $ti)rmv( #o (hs.eoe) k $"bl".lc = (#al)cik > @xld( epoe) #ok $ti)rmv( #eru crti etlojc Bl (hs.eoe) rer a hs s 'bet al SOLUTION A la mano :'( _hs=@ ti $"bl".lc - (#al)cik > _hsepoe) ti.xld( $ti)rmv( (hs.eoe)
  • 28. PAS DE MACROS :( # DBG=ys > EU e # SA =(a1 vr)- > WP vr, a2 > #> tp=vr m a1 #> vr =vr a1 a2 #> vr =tp a2 m a=2 b=3 SA a b WP , # i DBGi ys > f EU s e cnoelga b osl.o , # es > le $"upt)hm ":#a,b #b" (otu".tl a {} : {} #Ae DBGi ys vc EU s e #Ae DBGi n vc EU s o a=2 ; a=2 ; b=3 ; b=3 ; tp=a m ; tp=a m ; a=b ; a=b ; b=tpm; b=tpm; cnoelga b; osl.o(, ) $"upt)hm(a "+a+" b"+b; (otu".tl": , : )
  • 29. EQUIVALENT À COFFEESCRIPT TypeScript (Microsoft) Sweetjs (Mozilla) Dart (Google)   LIENS UTILES http://js2coffee.org/ http://coffeescript.org/ https://github.com/jashkenas/coffee­script
  • 30. ANTHONY ESTEBE “ DÉVELOPPEUR WEB FREELANCE twitter: @antho1404 skype: antho1404 github: antho1404 site:  http://anthonyestebe.com ”