|
|
First-class functions in an imperative world
|
|
|
|
|
نویسنده
|
ierusalimschy r.
|
منبع
|
journal of universal computer science - 2017 - دوره : 23 - شماره : 1 - صفحه:112 -126
|
چکیده
|
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). © j.ucs.
|
کلیدواژه
|
Functional languages; Lua; Scripting languages
|
آدرس
|
puc-rio, Brazil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Authors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|