Content deleted Content added
Palpalpalpal (talk | contribs) m →History |
GoingBatty (talk | contribs) Undid revision 1260410768 by 2600:1008:B12B:47DE:0:68:BEC5:E801 (talk) - reverted change that broke reference |
||
(46 intermediate revisions by 42 users not shown) | |||
Line 1:
{{short description|Programming language}}
{{distinguish|Haxe
{{Infobox programming language
| name = Hack
| logo = Hack (programming language) logo.svg
| logo size =
|
| released = 2014▼
| designer = Julien Verlaguet, Alok Menghrajani, Drew Paroski,
| developer = [[Meta Platforms]]
| paradigms = [[Multi-paradigm programming language|Multi-paradigm]]: [[Imperative programming|imperative]], [[Functional programming|functional]], [[Object-oriented programming|object-oriented]], [[Procedural programming|procedural]], [[Reflective programming|reflective]]
| typing = [[Static typing|Static]], [[Dynamic typing|dynamic]], [[Weak typing|weak]], [[Gradual_typing|gradual]]▼
| family = [[PHP]]
▲| released = {{Start date and age|2014}}
| latest release version = {{wikidata|property|edit|P548=Q2804309|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|single|P548=Q2804309|P348|P577}}}}
▲| typing = [[Static typing|Static]], [[Dynamic typing|dynamic]], [[
| programming language =
| platform =
| license = [[MIT License|MIT]]<ref name="license">{{cite web
| url = https://github.com/facebook/hhvm/blob/master/hphp/hack/LICENSE
| title = facebook/hhvm: hhvm
| date = 2018-04-11
| website =
| publisher = [[Meta Platforms]]
| access-date = 2019-02-06
Line 22 ⟶ 27:
| url-status = live
}}</ref>
| operating system = [[Cross-platform software|Cross-platform]]
| website = {{URL|
|
▲| logo_alt = Hack logo, featuring white lowercase "hack" letters on a black background, with stylized triangular geometric shapes on the left
▲| influenced_by = [[PHP]], [[OCaml]], [[Java (programming language)|Java]], [[C Sharp (programming language)|C#]], [[Scala (programming language)|Scala]], [[Haskell (programming language)|Haskell]]
}}
'''Hack''' is a [[programming language]] for the [[HipHop Virtual Machine]] (HHVM), created by [[Meta Platforms|Meta]] (formerly Facebook) as a dialect of [[PHP]]. The language implementation is [[
| url = http://radar.oreilly.com/2014/04/facebooks-hack-hhvm-and-the-future-of-php.html
| title = Facebook's Hack, HHVM, and the future of PHP
| date = 2014-04-03
|
| publisher = [[O'Reilly Media]]
| access-date = 2019-02-06
Line 51 ⟶ 54:
}}</ref>
Hack allows
| url = https://www.cs.umd.edu/~avik/papers/iogti.pdf
| title = The Ins and Outs of Gradual Type Inference
Line 87 ⟶ 90:
| archive-url=https://web.archive.org/web/20190209124350/https://code.fb.com/developer-tools/hack-a-new-programming-language-for-hhvm/
| url-status=live
}}</ref> Before the announcement of the new
==Features==
Hack is designed to interoperate seamlessly with PHP, which is a widely used open-source [[scripting language]] that has a focus on [[web development]] and can be embedded into [[HTML]]. A majority of valid PHP scripts are also valid in Hack; however,
| url = https://docs.hhvm.com/hhvm/inconsistencies/introduction
| title = Inconsistencies: Introduction
Line 100 ⟶ 103:
}}</ref>
Hack extends the [[type hinting]] available in PHP 5 through the introduction of static typing, by adding new type hints (for example, for scalar types such as integer or string), as well as by extending the use of type hints (for example, for class properties or function return values).
| url = https://docs.hhvm.com/hack/typechecker/modes#partial-mode
| title = Hack Manual: Partial Mode
Line 116 ⟶ 119:
| archive-url = https://web.archive.org/web/20181119215731/https://docs.hhvm.com/hack/typechecker/modes#strict-mode
| url-status = live
}}</ref>
== Syntax and semantics ==
Line 130 ⟶ 133:
| archive-url=https://web.archive.org/web/20210514021100/https://hhvm.com/blog/2019/02/11/hhvm-4.0.0.html
| url-status=live
}}</ref> Code must be placed in an entrypoint function. These are automatically executed if they are in the top-level file, but not if the file is included via <code>include</code>, <code>require</code>, or the autoloader. Like other functions in Hack, the function names must be unique within a project
<syntaxhighlight lang="php">
Line 141 ⟶ 144:
The above script, similar to PHP, will be executed and the following output is sent to the browser:
<syntaxhighlight lang="
Hello, World!
</syntaxhighlight>
Line 160 ⟶ 163:
{{Portal|Computer programming}}
* [[Phalanger (compiler)|Phalanger]]
== References ==
{{Reflist
== External links ==
Line 172 ⟶ 174:
* [http://www.phpsemantics.org/ KPHP: An Executable Formal Semantics for PHP]
{{PHP}}▼
{{Meta Platforms}}
{{Programming languages}}
▲{{PHP}}
[[Category:2014 software]]
Line 180 ⟶ 182:
[[Category:Facebook]]
[[Category:PHP software]]
[[Category:Programming languages compiled to bytecode]]▼
[[Category:Programming languages created in 2014]]
[[Category:Scripting languages]]
[[Category:Statically typed programming languages]]
<!-- Hidden categories below -->
▲[[Category:Programming languages compiled to bytecode]]
[[Category:Articles with example PHP code]]
|