The official Hack Language specification.

Related tags

HTTP hack-langspec
Overview

Deprecated, Unmaintained

This repo contains the Hack Language Specification, a modified version of the PHP specification. It is no longer maintained and does not reflect the current version of Hack.

Hack Language Specification

The easiest way to navigate the specification is via the table of contents.

The latest official release of the specification is 1.1.

You can run the specification tests with HHVM via its test runner and the Hack typechecker via hh_client.

Pull requests, issue filings and comments are extremely welcome.

Make sure you understand the contribution process.

Comments
  • Fix markdown headers.

    Fix markdown headers.

    Github's markdown renderer requires a space between the #s and the header.

    This also fixes internal section links, since the renderer wasn't creating anchors for the unrendered headers.

    compare (e.g.) https://github.com/hhvm/hack-langspec/blob/master/spec/05-types.md https://github.com/nelhage/hack-langspec/blob/fix-markdown/spec/05-types.md

    CLA Signed 
    opened by nelhage 5
  • Open/closed generic types

    Open/closed generic types

    https://github.com/hhvm/hack-langspec/blob/master/spec/14-generic-types-methods-and-functions.md#open-and-closed-generic-types

    I'm not sure why this distinction is being made at all, actually.

    Each closed generic type, method, or function has its own set of static variables, which are not shared with any other closed generic types, methods, or functions.

    I read this to mean that Blah<int> and Blah<string> don't share statics, which I'm fairly certain is incorrect (given our runtime type erasure semantics).

    opened by jwatzman 3
  • Problems with async

    Problems with async

    https://github.com/hhvm/hack-langspec/blob/master/spec/10-expressions.md#expressions should probably mention await. Might be missing in other syntax specifiers too.

    When an async function is compiled, a special transformation is performed, so that an object that implements Awaitable (§§) is returned to the caller (where T is the function's return-type).

    Need to check the definition of return-type, but this transform happens at runtime, the static return type is still always Awaitable<T>, that's what you write down in the source file.

    When yielding control, the implementation of await may choose to yield control back to the current async function's caller.

    Not sure what this is getting at here since the caller is still blocked.

    opened by jwatzman 3
  • Handle types?

    Handle types?

    https://github.com/hhvm/hack-langspec/blob/master/spec/05-types.md#general makes a distinction between value types and handle types, and I have no idea what it's getting at. I thought we decided to drop any distinction between types like this, in favor of just the subtype relation?

    opened by jwatzman 3
  • Make sure we have something in the spec about starting a script

    Make sure we have something in the spec about starting a script

    We talk about strict in the spec, but you cannot have a call to a top-level function in strict. You currently have to have some sort of non-strict initializer file that gets included in the strict file that calls something like main() for example.

    opened by JoelMarcey 3
  • Update Shapes

    Update Shapes

    • Make shapes first-class types
    • Remove erroneous integer-literal as field key
    • Mention nullable fields
    • Mention shape subtyping
    • Support assignment of shapes
    • Add predefined class Shapes
    • Support all the Shape grammar changes
    • Make Shapes a final class in the declaration and remove the equivalent narrative
    CLA Signed 
    opened by RexJaeschke 2
  • Arr-D observable in any way?

    Arr-D observable in any way?

    From the handful of occurrences of "Arr-D" in the spec, I don't see any way "Arr-D" should be distinguishable from "Arr" (IIRC the wording rather suggests it shouldn't be). In that case, it would be a mere implementation detail, so why mention it at all? One could even discuss whether the entire copy-on-write has a purpose when describing the semantics of Hack. I was surprised since at the same time the spec seems fairly liberal about related concepts like memory management or object lifetime; reads like some bits of a runtime spec/doc have found their way into a language spec. 🙂

    opened by olydis 0
  • Spec compliance of HHVM?

    Spec compliance of HHVM?

    Maybe I missed some details but running the tests (in tests folder) with fresh HHVM does not yield the expected results in all cases (e.g. errors out on negative shift, different output in several cases). Was the idea to have the spec model HHVM or have HHVM follow the spec? I think for some of the discrepancies I saw, HHVM is actually behaving the same as PHP, so I get it if that is behavior that HHVM users rely on.

    opened by olydis 0
  • some fixes

    some fixes

    Looking at the expected output, I assume the tests were meant to test for over-/underflow behavior, so I switched the order of inc/dec accordingly. Note that the expected output was then also perfectly swapped ("pre" behavior in "post" output and vice versa).

    CLA Signed 
    opened by olydis 2
  • More clearly illustrate *type-specification*s

    More clearly illustrate *type-specification*s

    No example is provided for type-specification usage, so I add one. Overuse of base-type exposure through type-specifications has led to significant lost time and typing errors, so it makes sense to be clear about how it works. The best use case for base-type exposure is when a "raw" int or string is being migrated to be an Enum. The best practice, after a migration, is to explicitly cast the enum value to the base type whenever this is necessary.

    CLA Signed 
    opened by admdikramr 2
  • disambiguate wording for __FILE__

    disambiguate wording for __FILE__

    With the original wording, it's hard to tell whether __FILE__ refers to just the last component of the path (sometimes called the name of a file) or the complete path.

    CLA Signed 
    opened by gregory-nisbet 0
Releases(v1.1)
  • v1.1(Apr 15, 2016)

    This is a major point release of the Hack specification. Included in this update are new Hack features since 1.0, Hack support based on PHP 7 features, bug fixes and cleanup from 1.0. New tests have been written and current tests have been updated as needed. Here is a partial list of additions to the specification:

    • Type Constants
    • Nullsafe Property Access
    • noreturn
    • classname
    • Shapes structural subtyping
    • Coalesce Operator

    ... and more.

    Source code(tar.gz)
    Source code(zip)
  • v1.0(Jan 7, 2016)

Owner
Meta Archive
These projects have been archived and are generally unsupported, but are still available to view and use
Meta Archive
Easily hack bitcoin accounts

Warning !! - ?? Be careful this app is just for your privacy alert - ?? Use correctly Program Features - ?? Style coding. - ?? Everything is real. - ?

hack4lx 30 Dec 22, 2022
A virtual machine for executing programs written in Hack.

HHVM HHVM page | HHVM documentation | Hacklang page | General group | Dev group | Twitter HHVM is an open-source virtual machine designed for executin

Meta 17.5k Dec 30, 2022
Hack cPanel & WebMail accounts in a simple way!

cPanelPhishingScript We are not responsible for any actions you take with the program. Use with this risk in mind. General Features ❔ Data Logger ❌ Da

Azad Dogu 3 Feb 25, 2022
The very FIRST ever server sided hack client for the PocketMine-MP API (4.x.x)

PHqx or Phqzing Hacks is a Server Sided Hack "Client" you can use for trolling friends (if you have one) or destroying other people at pvp.

Phqzing 5 Jul 25, 2022
Official PHP library for the DeepL language translation API.

deepl-php Official PHP client library for the DeepL API. The DeepL API is a language translation API that allows other computer programs to send texts

DeepL 78 Dec 23, 2022
PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

php-text-analysis PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP l

null 464 Dec 28, 2022
Switch the DokuWiki interface language according to the accept-language request header

Switch the DokuWiki interface language according to the accept-language request header

CosmoCode GmbH 1 Jan 4, 2022
A repository for showcasing my knowledge of the PHP programming language, and continuing to learn the language.

Learning PHP (programming language) I know very little about PHP. This document will list all my knowledge of the PHP programming language. Basic synt

Sean P. Myrick V19.1.7.2 2 Oct 29, 2022
A language detection library for PHP. Detects the language from a given text string.

language-detection Build Status Code Coverage Version Total Downloads Minimum PHP Version License This library can detect the language of a given text

Patrick Schur 738 Dec 28, 2022
Powerful implementation of the Specification pattern in PHP

RulerZ The central idea of Specification is to separate the statement of how to match a candidate, from the candidate object that it is matched agains

Kévin Gomez 865 Dec 22, 2022
The HttpFoundation component defines an object-oriented layer for the HTTP specification.

HttpFoundation Component The HttpFoundation component defines an object-oriented layer for the HTTP specification. Resources Documentation Contributin

Symfony 8.3k Dec 29, 2022
This library can parse a TypeSchema specification either from a JSON file, or from PHP classes using reflection and annotations.

This library can parse a TypeSchema specification either from a JSON file, or from PHP classes using reflection and annotations. Based on this schema it can generate source code and transform raw JSON data into DTO objects. Through this you can work with fully typed objects in your API for incoming and outgoing data.

Apioo 54 Jul 14, 2022
Generates OpenApi specification for Laravel, Lumen or Dingo using a configuration array and cebe/php-openapi

OpenApi Generator for Laravel, Lumen and Dingo. About The openapi-gen package provides a convenient way to create OpenApi specifications for Laravel,

Jean Dormehl 5 Jan 25, 2022
A simple implementation of the api-problem specification. Includes PSR-15 support.

ApiProblem This library provides a simple and straightforward implementation of the IETF Problem Details for HTTP APIs, RFC 7807. RFC 7807 is a simple

Larry Garfield 236 Dec 21, 2022
This is an implementation of PSR specification. It allows you to send and consume message with Redis store as a broker.

This is an implementation of PSR specification. It allows you to send and consume message with Redis store as a broker.

Enqueue 35 Nov 4, 2022
The Kafka Enqueue transport - This is an implementation of Queue Interop specification

Supporting Enqueue Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and

Enqueue 40 Oct 6, 2022