Tso tawm cov lus programming Haxe 4.1

Muaj toolkit tso tawm Xaus 4.1, uas suav nrog ntau lub ntsiab lus siab-theem programming lus ntawm tib lub npe nrog kev ntaus ntawv muaj zog, cross-compiler thiab lub tsev qiv ntawv qauv ntawm kev ua haujlwm. Lub phiaj xwm txhawb kev txhais lus rau C ++, HashLink / C, JavaScript, C #, Java, PHP, Python thiab Lua, nrog rau kev muab tso ua ke rau JVM, HashLink / JIT, Flash thiab Neko bytecode, nrog rau kev nkag mus rau cov peev txheej ntawm txhua lub hom phiaj. Compiler code faib los ntawm raws li daim ntawv tso cai GPLv2, thiab cov tsev qiv ntawv txheem thiab cov tshuab virtual tsim rau Haxe HashLink ΠΈ neko ib nyob rau hauv MIT daim ntawv tso cai.

Lus yog qhia-oriented nrog kev ntaus ntawv muaj zog. Object-oriented, generic thiab functional programming cov txheej txheem yog txaus siab. Haxe syntax yog ze rau ECMAScript thiab nthuav nws cov yam ntxwv xws li static typing, autotype inference, pattern matching, generics, iterator-based for loops, AST macros, GADT (Generalized Algebraic Data Types), hom abstract, anonymous structures, simplified array definitions, conditional compilation expressions, attaching metadata to fields. , cov chav kawm thiab cov kab lus, txoj hlua interpolation ("'Kuv lub npe yog $ lub npe'"), hom tsis ('tshiab Main ("foo")') thiab ntau ntxiv.

Xeem chav kawm {
static muaj nuj nqi main() {
cov neeg kawg = [
"Elizabeth" => "Programming",
"Joel" => "Tsim"
];

rau (npe => hauj lwm hauv tib neeg) {
trace('$name does $job for a living!');
}
}
}

Cov yam ntxwv tshiab hauv version 4.1:

  • Ntxiv tail recursion optimization.
  • Ntxiv ib qho API tshiab rau kev sib koom ua ke.
  • Lub construct "sim {} catch(e) {}" yog tso cai raws li ib tug shorthand rau "sim {} catch(e: haxe.Exception) {}".
  • Ntxiv kev txhawb nqa SSL rau tus neeg txhais lus evas.
  • Lub hom phiaj JVM tsis suav tias yog kev sim ntxiv lawm.
  • Rau Language Server Protocol, kev txhawb nqa rau "Goto Implementation" thiab "Nrhiav references" functions tau ntxiv.
  • Txhim kho lub npe ntawm cov hloov pauv hauv zos ib ntus hauv cov lej tsim tawm. Tshem tawm redundant "rov qab;" hauv xub ua haujlwm yam tsis muaj nqi rov qab.
  • Kev nkag mus ua ke (tau, default) raug tso cai rau ntawm thaj chaw (getter nkaus xwb, tus cwj pwm ua haujlwm ua ntej).
  • Tso cai increment and decrement operators for fields hom abstract.
  • Txhim kho inlining ntawm rau loops siv anonymous iterators.
  • js: Txhim kho StringMap kev siv rau ES5.
  • js: Generation of let variables has been added to the compiler option β€œ-D js-es=6”, tiam ntawm ES6 chav kawm tau raug txhim kho.
  • lua: "StringIterator" optimized, ua yuam kev tuav txhim kho.
  • php: Optimized "Std.isOfType" rau hom pib.
  • php: Generated arrays tam sim no siv cov haiv neeg interfaces "Iterator", "IteratorAggregate", "Countable".
  • cs: Ntxiv metadata "@:assemblyMeta" thiab "@:assemblyStrict".
  • python: ntxiv kev siv "__contains__" rau cov khoom tsis qhia npe
    thiab "__getitem__", uas tso cai rau lawv siv raws li phau ntawv txhais lus hauv cov cai tsim tawm.

  • jvm: Txhim kho kev ua tau zoo ua tsaug rau txoj hauv kev tshiab ntawm kev nkag mus rau cov haujlwm ntaus ntawv thiab tsim cov kev cuam tshuam ntxiv rau hauv cov xwm txheej uas cov khoom siv los ua cov qauv tsis qhia npe (kev saib xyuas cov cuab yeej muaj zog tiv thaiv):
    Tso tawm cov lus programming Haxe 4.1

Kev txhim kho hauv cov tsev qiv ntawv txheem:

  • Ntxiv "Array.contains" muaj nuj nqi.
  • Ntxiv "Array.keyValueIterator", uas siv cov ntsiab lus tseem ceeb rau arrays ("rau (tus yuam sij => tus nqi hauv array)").
  • Ntxiv txwv hom "haxe.Constraints.NotVoid".
  • Cov haujlwm "findIndex" thiab "foldi" tau ntxiv rau "Lambda" chav kawm.
  • Siv "array access" (access ntawm "arr[i]") thiab key-value iteration rau "haxe.ds.HashMap".
  • jvm: Implemented JVM-specific versions of "StringMap", "sys.thread.Lock", "sys.thread.Thread".
  • java/jvm: Siv ib txwm siv ntawm "MD5", "SHA-1" thiab "SHA-256" rau "haxe.crypto" modules.
  • macro: Ntxiv "haxe.macro.Context.containsDisplayPosition(pos)".
  • nullsafety: "Strict" hom yog tam sim no kho raws li ib leeg threaded; ntxiv "StrictThreaded" hom.
  • "Std.is" tau deprecated nyob rau hauv txaus siab ntawm "Std.isOfType".
  • Ntxiv cov lus ceeb toom thaum siv cov hloov pauv hauv zos yam tsis muaj txiaj ntsig hauv kev kaw.
  • js: "untyped __js__(code, args)" yog deprecated, hloov los ntawm "js.Syntax.code(code, args)".
  • php/neko: "neko.Web" thiab "php.Web" tau deprecated thiab yuav raug tsiv mus rau lub tsev qiv ntawv "hx4compat" tom qab.

Hauv kev tso tawm tom ntej tau npaj:

  • Kev txhim kho pob neeg saib xyuas haxelib.
  • Asynchronous system API raws li libuv.
  • Coroutines.
  • Tshaj tawm modular static functions thiab variables tsis tsim cov chav kawm (twb muaj nyob rau hauv nightly builds).

Tau qhov twg los: opennet.ru

Ntxiv ib saib