Opa (programming language): Difference between revisions

Content deleted Content added
Opadikt (talk | contribs)
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(127 intermediate revisions by 76 users not shown)
Line 1:
{{short description|Programming language for developing scalable web applications}}
{{Infobox programming language |
name = Opa |
| logoname = |Opa
| logo = Opa logo cloud.png
| paradigmparadigms = [[multiMulti-paradigm programming language|multi-paradigm]]: [[imperativeFunctional programming|imperativefunctional]], [[functionalImperative programming|functionalimperative]] |
year = 2011 |
| typing = [[staticStatic typing|static]], [[strongStrong and weak typing|strong]], [[typeType inference|inferred]] |
| scope = [[Scope (computer science)|lexical]]
developer = MLstate |
| developer = [http://www.linkedin.com/company/mlstate MLstate]
latest_release_version = S3.5 |
| latest_release_dateyear = {{ReleaseStart date and age|2011|09|02}} |
| latest release version = 1.1.1 (stable)
operating_system = [[Linux]], [[Mac OS X]] |
| latest release date = {{Start date and age|2014|03|08}}<ref>{{Cite web |title=Release 1.1.1: MLstate/opalang |url=https://github.com/MLstate/opalang/releases/tag/v4308 |access-date=2021-01-29 |website=GitHub |language=en}}</ref><ref>{{Cite web |title=Some great news on Opa |url=http://blog.opalang.org/2013/02/some-great-news-on-opa.html |access-date=2021-01-29}}</ref>
genre = [[Programming language]] |
| operating influenced_bysystem = [[OCamlLinux]], [[ErlangmacOS]], |[[Windows]]
| programming language = [[OCaml]], Opa, [[JavaScript]], [[Shell (computing)|Shell]],[[C (programming language)|C]], [[Standard ML]]
license = [[AGPL]] |
in| Junelicense 2011, under a= [[GNU]] [[Affero General Public License|AGPLv3]]., [[MIT License|MIT]]
| website = [http://{{URL|opalang.org] |}}
| influenced by = [[OCaml]], [[Erlang (programming language)|Erlang]], [[JavaScript]]
}}
 
'''Opa''' is a [[programming language]] for developing [[Scalability|scalable]] [[web application]]s. It is [[free and open-source software]] released under a [[GNU Affero General Public License]] (AGPLv3), and an [[MIT License]].
'''Opa''' is an [[open source]] [[programming language]] for [[web applications]].
Opa comprises a web server, a database and distributed execution
engine. Code written in Opa is compiled to native code on the server side and
to JavaScript using [[jQuery]] for cross-browser compatibility on the client
side.<ref>{{cite web |url=http://www.infoq.com/articles/Opa
|title=Interview: François-Régis Sinot on Opa, a Web Development Platform
|date=7 September 2011}}</ref>
Opa shares motivations with [[Web Framework|web frameworks]],
but takes a more radical approach.<ref>{{cite web
|url=http://www.infoworld.com/d/developer-world/infoworld-review-tools-rapid-web-development-297
|title=InfoWorld article about emerging web technologies, including Opa
|date=12 May 2010}}</ref>
 
It can be used for both [[client-side scripting|client-side]] and [[server-side scripting]], where complete programs are written in Opa and subsequently compiled to [[Node.js]] on a [[Server (computing)|server]] and [[JavaScript]] on a [[Client (computing)|client]], with the [[compiler]] automating all communication between the two.<ref>{{cite web |last1=Koprowski |first1=Adam |url=http://www.developer.com/open/opa-vs.-node.js-javascript-framework-comparison.html |title=Node.js vs. Opa: Web Framework Showdown |publisher=developer.com |date=24 February 2012 |access-date=1 March 2012 |archive-date=4 November 2012 |archive-url=https://web.archive.org/web/20121104144936/http://www.developer.com/open/opa-vs.-node.js-javascript-framework-comparison.html |url-status=dead }}</ref><ref>Opa supports various server-side backends, Nodejs being the most popular one.</ref> Opa implements [[Strong and weak typing|strong]], [[static typing]], which can be helpful in protecting against security issues such as [[SQL injection]]s and [[cross-site scripting]] attacks.<ref>{{cite journal |last1=Robertson |first1=William |last2=Giovanni |first2=Vigna |year=2009 |url=http://www.mendeley.com/research/static-enforcement-of-web-application-integrity-through-strong-typing/ |title=Static Enforcement of Web Application Integrity Through Strong Typing |journal=SSYM'09 Proceedings of the 18th Conference on USENIX Security Symposium}}{{Dead link|date=April 2020 |bot=InternetArchiveBot |fix-attempted=yes}}</ref>
The core language is [[functional programming|functional]], and enjoys a static [[type system]] with [[type inference]].
Opa also provides sessions which encapsulate an [[imperative programming|imperative]] state and
communicate using [[message passing]], similarly to [[Erlang]] processes.
Opa provides first-class parsers based on [[Parsing Expression Grammar]]s.<ref>{{cite web
|author=Koprowski, Binsztok |year=2011
|url=http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract
|title=TRX: A Formally Verified Parser Interpreter
|publisher=Logical Methods in Computer Science |doi=10.2168}}</ref>
 
The language was first officially presented at the Open Worldwide Application Security Project ([[OWASP]]) conference in 2010,<ref>{{cite web |date=June 2010 |publisher=OWASP
|url=https://www.owasp.org/index.php/OWASP_AppSec_Research_2010_-_Stockholm,_Sweden#OPA:_Language_Support_for_a_Sane.2C_Safe_and_Secure_Web
|title=OPA: Language Support for a Sane, Safe and Secure Web, at OWASP 2010}}</ref>, and the source code was released on
[[GitHub]]<ref>{{cite web |url=https://github.com/MLstate/opalang |title=GitHub repository |website=[[GitHub]]}}</ref>
in June 2011, under a [[GNU Affero General Public License]] (AGPL). Later, the license changed to the [[MIT License]] for the [[software framework]] part (the [[Library (computing)|library]]) and AGPL for the compiler, so that applications written in Opa can be released under any [[software license]], [[Proprietary software|proprietary]] or [[open source]].
in June 2011, under a [[GNU]] [[Affero General Public License]].
 
== ExamplesDesign and features ==
Opa consists of a [[web server]], a [[database]] and distributed execution engine.<ref>{{cite web |url=http://www.webappers.com/2011/07/22/opa-the-scalable-open-source-cloud-language/ |title=Opa – The Scalable Open Source Cloud Language |publisher=WebAppers |date=22 July 2011}}</ref> Code written in Opa is compiled to [[JavaScript]] using [[Node.js]] on the [[Server-side scripting|server side]] and to JavaScript using [[jQuery]] for cross-browser compatibility on the [[Client-side scripting|client side]].<ref>{{cite web |url=http://www.infoq.com/articles/Opa|publisher=InfoQ|title=Interview: François-Régis Sinot on Opa, a Web Development Platform|date=7 September 2011}}</ref>
The advantage of the approach compared to certain [[Rich Internet Application]] (RIA) platforms is that users are not required to install a [[Browser plugin|plugin]] in their browser.<ref>{{cite web |author=Neil McAllister|url=https://www.infoworld.com/article/2620269/introducing-opa--a-web-dev-language-to-rule-them-all.html|publisher=InfoWorld |title=Introducing Opa, a Web dev language to rule them all |date=8 September 2011}}</ref> Opa shares motivations with [[web framework]]s, but takes a different approach.<ref>{{cite web|url=https://www.infoworld.com/article/2626870/infoworld-review-tools-for-rapid-web-development.html|title=InfoWorld review: Tools for rapid Web development|publisher=[[InfoWorld]]|date=12 May 2010}}</ref>
Its designers assert that this helps Opa to avoid many security issues, like [[SQL injection]]s or [[cross-site scripting]] (XSS) attacks.<ref>{{cite web|url=http://www.heise.de/developer/meldung/Auch-Opa-ist-fuer-Cloud-Anwendungen-1288588.html|title=Auch Opa ist für Cloud-Anwendungen |publisher=[[Heise Online]]|date=29 July 2011}}</ref>
 
The core language is [[Functional programming|functional]] and has a static [[type system]] with [[type inference]]. Opa also provides sessions which encapsulate an [[Imperative programming|imperative]] state and communicate using [[message passing]], similar to [[Erlang (programming language)|Erlang]] processes. Opa provides many structures or functions that are common in [[web development]], as [[first-class citizen]] objects, for instance [[HTML]]<ref>{{cite web|url=http://www.i-programmer.info/news/98-languages/2961-opa-a-unified-approach-to-web-programming.html |title=Opa – a unified approach to web programming |publisher=i-Programmer |date=28 August 2011}}</ref> and [[parser]]s, based on [[parsing expression grammar]]s.<ref>{{cite journal |last1=Koprowski |first1=Binsztok |year=2011 |url=http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract |title=TRX: A Formally Verified Parser Interpreter |journal=Logical Methods in Computer Science}}</ref> Because of this adhesion between the language and web-related concepts, Opa is not intended for non-web applications (for instance [[desktop application]]s).<ref>{{cite web |url=http://linuxfr.org/news/opa-un-nouveau-langage-pour-le-d%C3%A9veloppement-d%E2%80%99applications-web |title=Opa, un nouveau langage pour le développement d'applications Web|publisher=LinuxFr |language=Fr |date=22 June 2011}}</ref>
=== Hello world ===
 
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]].<ref>{{cite news|url=http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|title=Programming Opa: Web development, reimagined|publisher=[[Computerworld]]|date=1 February 2012|archive-date=2 October 2016|access-date=22 February 2012|archive-url=https://web.archive.org/web/20161002184533/http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|url-status=dead}}</ref>
The traditional [[Hello world program]] can be written in Opa in the following way<ref>{{cite web |url=http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/|title=Opa, the cloud language – a test drive |date=26 July 2011}}</ref>:
The 1.1.0 release in February 2013 also added support for [[PostgreSQL]], paving the way for the support of several [[SQL]] databases.
 
== See also ==
<source lang="c">
{{Portal|Free and open-source software}}
server = one_page_server("Hello", -> <>Hello, web!</>)
* [[Ur (programming language)|Ur]] – a functional language for web development
</source>
* [[Dart (programming language)|Dart]] – a JavaScript alternative for web apps
 
* [[Haxe]] – a similar language for web apps
It can be compiled to a stand-alone executable binary with:
* [[CoffeeScript]] – a language [[Source-to-source compiler|transcompiled]] to JavaScript for web apps
 
* Dark – a language integrating development and deployment of [[serverless]] services
opa hello_web.opa
 
Running the resulting binary launches the web application:
 
./hello_web.exe
 
Opa is packaged with the opa-cloud tool to help deployment on several instances.
The following command launches the application, configures load balancing and makes servers share information automatically:
 
opa-cloud hello_web.exe --host localhost --host my@my_server1 --host my@my_server2
 
== References ==
{{Reflist}}
 
== Bibliography ==
* ''Opa: Up and Running'', 2013, [[O'Reilly Media]] {{ISBN|978-1449328856}}
 
== External links ==
* [http://{{Official website|opalang.org Homepage of Opa]}}
* {{GitHub|MLstate/opalang|Opa}}
* [http://www.heise.de/developer/meldung/Auch-Opa-ist-fuer-Cloud-Anwendungen-1288588.html Auch Opa ist für Cloud-Anwendungen] article on Heise.
 
* [http://linuxfr.org/news/opa-un-nouveau-langage-pour-le-d%C3%A9veloppement-d%E2%80%99applications-web Opa, un nouveau langage pour le développement d’applications Web] article on linuxfr.
{{JavaScript}}
* [http://www.i-programmer.info/news/98-languages/2961-opa-a-unified-approach-to-web-programming.html Opa - a unified approach to web programming] article on i-Programmer.
* [http://www.webappers.com/2011/07/22/opa-the-scalable-open-source-cloud-language/ Opa – The Scalable Open Source Cloud Language] article on WebAppers.
 
[[:Category:ProgrammingFunctional languages]]
[[Category:Web programming]]
[[fr:Opa]]
[[Category:Cross-platform free software]]
[[Category:Programming languages created in 2011]]
[[Category:Software using the GNU Affero General Public License]]
[[Category:Software using the MIT license]]
[[Category:2011 software]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]
[[Category:Statically typed programming languages]]