Title
First-Class Functions in an Imperative World.
Abstract
First-class functions are a hallmark of functional languages, but they are a useful concept in imperative languages, too. Even ANSI C offers a restricted form of first-class functions (in the form of pointers to functions), and several more recent imperative languages, such as Python 3, Go, Lua, and Swift, offer first-class, anonymous functions with lexical scoping. In most imperative languages, however, first-class functions are an advanced feature used by seasoned programmers. Lua, by contrast, uses first-class functions as a building block of the language. Lua programmers regularly benefit from diverse properties of its functions for routine constructions such as exception handling, module definitions, object-oriented programming, and iterators. Moreover, first-class functions play a central role in the API between Lua and C. In this paper, we present some aspects of Lua that were designed with first-class functions in mind, in particular its module system, exception handling, iterators, facilities for object-oriented programming, and the API between C and Lua. We also discuss how those different aspects of Lua use different properties of first-class functions to achieve two important goals in the design of Lua, namely small size and embeddability (its easiness of interfacing with other languages).
Year
Venue
Keywords
2017
JOURNAL OF UNIVERSAL COMPUTER SCIENCE
Lua,scripting languages,functional languages
Field
DocType
Volume
Data science,First-class function,Computer science,Knowledge management
Journal
23
Issue
ISSN
Citations 
1
0948-695X
0
PageRank 
References 
Authors
0.34
3
1
Name
Order
Citations
PageRank
Roberto Ierusalimschy146354.25