Cours pdf What is next for Lua?

Cours pdf What is next for Lua?, tutoriel & guide de travaux pratiques en pdf.

LPeg: What it is
A library for pattern matching
Goes from simple patterns to full grammars
« [a-z]+ »
[[Sexp <- atom / ‘(‘ sp Sexp* ‘)’ sp
atom <- %w+ sp
sp <- %s*]]
LPeg: Pros
A good balance of expressiveness and complexity
It may become a real differential for Lua
More “Unicode-friendly”
e.g., « —* » (zero or more em dashes)
LPeg: Cons
Redundant with current pattern matching
●ideally we should deprecate current implementation, but transition is not always easy
Not so small
●half the size of all current libraries together
Not so mature
Struct: What it is
A library for packing/unpacking binary data in strings
s = struct.pack(« iic », -24, 13, « x »)
print(struct.unpack(« iic », s))
–> -24 13 x 10
Struct: Pros
Small and simple
Common in several scripting languages
Wide range of uses binary data in sockets packing of data inside Lua
Struct: Cons
Conflict with future features
e.g., packing/unpacking of C data outside Lua, in the host program
Unicode
What does it mean « support Unicode »?
What encoding should Lua use?
Do we need a new type for Unicode strings?
(NO!!!)
Unicode « Support »
Lua has no intention of « supporting » Unicode for any reasonable definition of « support »
Unicode is too complex for Lua too many tables, all huge
But Lua can offer some very basic primitives to ease the coding of other libraries or simple tasks Mostly, operations to deal with the encoding
Encoding
UTF-8 seems the clear winner
UTF-16 has the same problems of UTF-8 plus some others
● no easy access to i-th character
UTF-8 can be smaller even for Asian
languages
● e.g.: front page of Wikipedia Japan: 83 kB in
UTF-8, 144 kB in UTF-16

……….

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
What is next for Lua? (257 KO) (Cours PDF)
What is next for Lua

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *