Opa
Paradigm| multi-paradigm: functional, imperative
Developer| MLstate
First appeared| 2011
Stable release|
1.1.1 (stable) / March 8, 2014; 8 years ago (2014-03-08)[1][2]
Typing discipline| static, strong, inferred
OS| Linux, OS X, Windows
License| MIT License, AGPLv3
Website| opalang.org
Influenced by
OCaml, Erlang, JavaScript
Opa is an open-source programming language for developing scalable web applications.
It can be used for both client-side and server-side scripting, where complete programs are written in Opa and subsequently compiled to Node.js on the server and JavaScript on the client, with the compiler automating all communication between the two.[3][4] Opa implements strong, static typing, which can be helpful in protecting against security issues such as SQL injections and cross-site scripting attacks.[5]
The language was first officially presented at the OWASP conference in 2010,[6] and the source code was released on GitHub[7] in June 2011, under a GNU Affero General Public License. Later, the license changed to the MIT license for the framework part (library) and AGPL for the compiler so that applications written in Opa can be released under any license, proprietary or open source.
## Contents
* 1 Design and features
* 2 Examples
* 2.1 Hello world
* 3 See also
* 4 References
* 5 Bibliography
* 6 External links
## Design and features
Opa consists of a web server, a database and distributed execution engine.[8] Code written in Opa is compiled to JavaScript using Node.js on the server side and to JavaScript using jQuery for cross-browser compatibility on the client side.[9] The advantage of the approach compared to certain Rich Internet Application (RIA) platforms is that users are not required to install a plugin in their browser.[10] Opa shares motivations with web frameworks, but takes a different approach.[11] Its designers assert that this helps Opa to avoid many security issues, like SQL injections or cross-site scripting (XSS) attacks.[12]
The core language is functional and has a static type system with type inference. Opa also provides sessions which encapsulate an imperative state and communicate using message passing, similar to Erlang processes. Opa provides many structures or functions that are common in web development, as first-class objects, for instance HTML[13] and parsers, based on Parsing Expression Grammars.[14] Because of this adhesion between the language and web-related concepts, Opa is not intended for non-web applications (for instance desktop applications).[15]
The 0.9.0 release in February 2012 introduced database mapping technology for the non-relational, document-oriented database MongoDB, similar to object-relational mapping.[16][17][18] The 1.1.0 release in February 2013 also added support for PostgreSQL, paving the way for the support of several SQL databases.
## Examples
### Hello world
The traditional Hello world program, producing a web server that serves a static page with "Hello, web!" as its content, can be written in Opa as:[19]
Server.start(Server.http,
{ title: "Hello"
, page: function() {
Hello, web!
}
It can be compiled to a stand-alone executable JS file with:
$ opa hello_web.opa
Running the resulting executable JS file launches the web application:
$ ./hello_web.js
## See also
* Ur \- a functional programming language for web development
* Dart \- a Javascript alternative for web apps
* Haxe \- similar programming language for web apps
* CoffeeScript \- a programming language transcompiled to Javascript for web apps
* Dark, a programming language that integrates development and deployment of serverless services
## References
1. ↑ "Release 1.1.1 · MLstate/opalang" (in en). https://github.com/MLstate/opalang/releases/tag/v4308.
2. ↑ "Some great news on Opa". http://blog.opalang.org/2013/02/some-great-news-on-opa.html.
3. ↑ Adam Koprowski (24 February 2012). "Node.js vs. Opa: Web Framework Showdown". developer.com. http://www.developer.com/open/opa-vs.-node.js-javascript-framework-comparison.html.
4. ↑ Opa actually supports various server-side backends, Nodejs being the most popular one
5. ↑ Robertson, William; Giovanni, Vigna (2009). "Static Enforcement of Web Application Integrity Through Strong Typing". SSYM'09 Proceedings of the 18th Conference on USENIX Security Symposium. http://www.mendeley.com/research/static-enforcement-of-web-application-integrity-through-strong-typing/.
6. ↑ "OPA: Language Support for a Sane, Safe and Secure Web, at OWASP 2010". OWASP. June 2010. https://www.owasp.org/index.php/OWASP_AppSec_Research_2010_-_Stockholm,_Sweden#OPA:_Language_Support_for_a_Sane.2C_Safe_and_Secure_Web.
7. ↑ "GitHub repository". https://github.com/MLstate/opalang.
8. ↑ "Opa – The Scalable Open Source Cloud Language". WebAppers. 22 July 2011. http://www.webappers.com/2011/07/22/opa-the-scalable-open-source-cloud-language/.
9. ↑ "Interview: François-Régis Sinot on Opa, a Web Development Platform". InfoQ. 7 September 2011. http://www.infoq.com/articles/Opa.
10. ↑ Neil McAllister (8 September 2011). "Introducing Opa, a Web dev language to rule them all". InfoWorld. https://www.infoworld.com/article/2620269/introducing-opa--a-web-dev-language-to-rule-them-all.html.
11. ↑ "InfoWorld review: Tools for rapid Web development". InfoWorld. 12 May 2010. https://www.infoworld.com/article/2626870/infoworld-review-tools-for-rapid-web-development.html.
12. ↑ "Auch Opa ist für Cloud-Anwendungen". Heise Online. 29 July 2011. http://www.heise.de/developer/meldung/Auch-Opa-ist-fuer-Cloud-Anwendungen-1288588.html.
13. ↑ "Opa - a unified approach to web programming". i-Programmer. 28 August 2011. http://www.i-programmer.info/news/98-languages/2961-opa-a-unified-approach-to-web-programming.html.
14. ↑ Koprowski, Binsztok (2011). "TRX: A Formally Verified Parser Interpreter". Logical Methods in Computer Science. http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract.
15. ↑ "Opa, un nouveau langage pour le développement d'applications Web" (in French). LinuxFr. 22 June 2011. http://linuxfr.org/news/opa-un-nouveau-langage-pour-le-développement-d’applications-web.
16. ↑ "Hello, database". Opa Documentation. http://doc.opalang.org/#!/manual/Hello--database.
17. ↑ "Low-level MongoDB support". Opa Documentation. http://doc.opalang.org/#!/manual/Low-level-MongoDB-support.
18. ↑ "Programming Opa: Web development, reimagined". Computerworld. 1 February 2012. http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F.
19. ↑ Alastair Aitken (26 July 2011). "Opa, the cloud language – a test drive". Morgan Hill. http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/.
## Bibliography
* Opa: Up and Running, 2013, O'Reilly Media ISBN:978-1449328856
## External links
* v
* t
* e
JavaScript
Code analysis|
* ESLint
* JSHint
* JSLint
Transcompilers|
* Babel.js
* CoffeeScript
* LiveScript
* Dart
* Emscripten
* Google Closure Compiler
* Google Web Toolkit
* Morfik
* TypeScript
* AtScript
* Opa
* Nim
* Haxe
* ClojureScript
* WebSharper
* PureScript
* Reason
* Elm
Concepts|
* Client-side
* JavaScript library
* JavaScript syntax
* Unobtrusive JavaScript
Debuggers|
* Firebug
* Komodo IDE
* Microsoft Script Debugger
* Microsoft Script Editor
* Opera Dragonfly
* Web Inspector
Doc generators|
* JSDoc
Editors (comparison)|
* Ace
* Cloud9 IDE
* Atom
* CodeMirror
* Light Table
* Brackets
* Koding
* PhpStorm
* Orion
* Visual Studio
* Visual Studio Express
* Visual Studio Code
* Visual Studio Team Services
Engines|
* Comparison of engines
* DOM support
* List of ECMAScript engines
Frameworks|
* Comparison of JavaScript frameworks
* List of JavaScript libraries
Related technologies|
* Cascading Style Sheets
* Document Object Model
* HTML
* Dynamic HTML
* Ajax
* JSON
* WebAssembly
* asm.js
Package managers|
* npm
Application Bundlers|
* Webpack
Server-side|
* Active Server Pages
* CommonJS
* JSGI
* Node.js
* Wakanda
Unit testing|
* Jasmine
* Mocha
* QUnit
* List of JavaScript unit testing frameworks
* Jest
People|
* Douglas Crockford
* Brendan Eich
* John Resig
0.00
(0 votes)
Original source: https://en.wikipedia.org/wiki/Opa (programming language). Read more
|
Retrieved from "https://handwiki.org/wiki/index.php?title=Opa_(programming_language)&oldid=33589"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template