Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Hack (PHP-like) #392

Closed
fredemmott opened this issue Feb 9, 2016 · 2 comments
Closed

Support Hack (PHP-like) #392

fredemmott opened this issue Feb 9, 2016 · 2 comments

Comments

@fredemmott
Copy link
Contributor

most files would work simply by pretending '<?hh' files are PHP - there is some extra syntax though, that would be good to also support:

XHP (XML-like literals)

$foo = <div class={$bar}>{$baz}</div>;

class :myclass extends :x:element {
  attribute string myattr @required;
/* ... */
}

$herp = <myclass myattr="myvalue" />;

More info: https://docs.hhvm.com/hack/XHP/introduction

Collection object literals

$foo = Vector { 'herp', 'derp' };
$bar = Map { 'herp' => 'derp' };

https://docs.hhvm.com/hack/collections/introduction

Short lambdas

$square_func = $x ==> $x * $x;
var_dump($square_func(2)); // outputs 4

$two_args = ($x, $y) ==> $x + $y;

nullable

function foo(?MyClass $my_class_or_null) {
}

callable types

function do_stuff((function(int $x): string) $callback) {
 // callback() takes an int and returns a string

Generics

https://docs.hhvm.com/hack/generics/introduction

class Foo<T> { ... }

async/await

There's a lot of these: pretty much needs the whole section going through: https://docs.hhvm.com/hack/async/introduction

fredemmott added a commit to fredemmott/rouge that referenced this issue Jul 10, 2017
See hacklang.org

Changes to PHP and C++ (and corresponding tests) to make sure that
ambiguities are covered.

Will add XHP support in a separate pull request.

refs rouge-ruby#392
fredemmott added a commit to fredemmott/rouge that referenced this issue Aug 10, 2017
See hacklang.org

Changes to PHP and C++ (and corresponding tests) to make sure that
ambiguities are covered.

Will add XHP support in a separate pull request.

refs rouge-ruby#392
fredemmott added a commit to fredemmott/rouge that referenced this issue Sep 22, 2017
See hacklang.org

Changes to PHP and C++ (and corresponding tests) to make sure that
ambiguities are covered.

Will add XHP support in a separate pull request.

refs rouge-ruby#392
@stale
Copy link

stale bot commented Jun 19, 2019

This issue has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.
If you would like this issue to remain open, please reply and let us know if the issue is still reproducible.

@stale stale bot added the stale-issue There has been no activity for a year. label Jun 19, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2019

Support for Hack has subsequently been added to Rouge. If there are any issues with the implementation, please let us know!

@pyrmont pyrmont closed this as completed Jun 19, 2019
@pyrmont pyrmont removed the stale-issue There has been no activity for a year. label Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants