| Opa | |
|---|---|
![]() | |
| Paradigms | multi-paradigm:functional,imperative |
| Developer | MLstate |
| First appeared | 2011; 14 years ago (2011) |
| Stable release | |
| Typing discipline | static,strong,inferred |
| Scope | lexical |
| Implementation language | OCaml, Opa,JavaScript,Shell,C,Standard ML |
| OS | Linux,macOS,Windows |
| License | AGPLv3,MIT |
| Website | opalang |
| Influenced by | |
| OCaml,Erlang,JavaScript | |
Opa is aprogramming language for developingscalableweb applications. It isfree and open-source software released under aGNU Affero General Public License (AGPLv3), and anMIT License.
It can be used for bothclient-side andserver-side scripting, where complete programs are written in Opa and subsequently compiled toNode.js on aserver andJavaScript on aclient, with thecompiler automating all communication between the two.[3][4] Opa implementsstrong,static typing, which can be helpful in protecting against security issues such asSQL injections andcross-site scripting attacks.[5]
The language was first officially presented at the Open Worldwide Application Security Project (OWASP) conference in 2010,[6] and the source code was released onGitHub[7]in June 2011, under aGNU Affero General Public License (AGPL). Later, the license changed to theMIT License for thesoftware framework part (thelibrary) and AGPL for the compiler, so that applications written in Opa can be released under anysoftware license,proprietary oropen source.
Opa consists of aweb server, adatabase and distributed execution engine.[8] Code written in Opa is compiled toJavaScript usingNode.js on theserver side and to JavaScript usingjQuery for cross-browser compatibility on theclient side.[9]The advantage of the approach compared to certainRich Internet Application (RIA) platforms is that users are not required to install aplugin in their browser.[10] Opa shares motivations withweb frameworks, but takes a different approach.[11]Its designers assert that this helps Opa to avoid many security issues, likeSQL injections orcross-site scripting (XSS) attacks.[12]
The core language isfunctional and has a statictype system withtype inference. Opa also provides sessions which encapsulate animperative state and communicate usingmessage passing, similar toErlang processes. Opa provides many structures or functions that are common inweb development, asfirst-class citizen objects, for instanceHTML[13] andparsers, based onparsing expression grammars.[14] Because of this adhesion between the language and web-related concepts, Opa is not intended for non-web applications (for instancedesktop applications).[15]
The 0.9.0 release in February 2012 introduced database mapping technology for the non-relational, document-oriented databaseMongoDB, similar toobject-relational mapping.[16]The 1.1.0 release in February 2013 also added support forPostgreSQL, paving the way for the support of severalSQL databases.