Skip to content

Commit

Permalink
move to built-in: remove all sources, keep tests
Browse files Browse the repository at this point in the history
We need a new release that does not define the HSL, to allow easy
compatibility with 4.108+, where it is built-in.

Keep the tests for now to ensure/test compatibility.
  • Loading branch information
fredemmott committed May 4, 2021
1 parent 24837f9 commit 63a2495
Show file tree
Hide file tree
Showing 58 changed files with 17 additions and 6,039 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
os: [ ubuntu ]
hhvm:
- '4.94'
- '4.108'
- latest
- nightly
runs-on: ${{matrix.os}}-latest
Expand Down
62 changes: 4 additions & 58 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,5 @@
# Contributing to the Hack Standard Library
We want to make contributing to this project as easy and transparent as
possible.
# Contributing

## Feature Requests

New features should be contributed to
[the experimental repository](https://github.com/hhvm/hsl-experimental/)
instead; if you believe an experimental feature is mature, please file an
issue to request the relevant files be moved to this repository.

## Our Development Process

The source of truth for this library is an internal repository; we continuously
sync changes out to GitHub using
[FBShipIt](https://github.com/facebook/fbshipit), and test/apply pull requests
against the repository after review.

If a pull request passes the public tests but has internal issues, we will not
be able to merge the pull request until the internal issues are fixed; depending
on the scale of the problem, this can take a few weeks.

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.

## Coding Style

* 2 spaces for indentation rather than tabs
* 80 character line length
* Be consistent with existing code
* Be consistent with hackfmt

We do not follow the PSR guidelines.

## License
By contributing to the Hack Standard Library, you agree that your contributions
will be licensed under the LICENSE file in the root directory of this source
tree.
As of 2021-05-04, the HSL is in the process of becoming built-in to the HSL;
for now, contributions should be made to the `hphp/hsl` subdirectory of
[the HHVM repository](https://github.com/facebook/hhvm/).
93 changes: 9 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,96 +12,21 @@ This library is especially useful for working with the Hack arrays (`vec`,
For future APIs, see
[the experimental repository](https://github.com/hhvm/hsl-experimental).

## Examples
## Status of this repository

```Hack
<?hh // strict
As of 2021-05-04, the HSL is moving to be built into HHVM and the typechecker;
as such, this repository currently only contains tests.

use namespace HH\Lib\{Vec,Dict,Keyset,Str,Math};
In the near future, we expect this repository to either be archived, or to
become a partial mirror of the HHVM repository.

function main(vec<?int> $foo): vec<string> {
return $foo
|> Vec\filter_nulls($$)
|> Vec\map($$, $it ==> (string) $it);
}
```

## Finding Functions

Functions in the HSL are organized into namespaces according to the following
rule:

If a function returns a particular type or only operates on that type, it
belongs in that namespace.

Here are some examples:

### "I want a vec containing the keys of a particular container."

Based on the `vec` return type, you'd look in the Vec namespace and come across
`Vec\keys`. Instead, if you wanted a keyset, you'd look in the Keyset namespace
and find `Keyset\keys`.

### "I want the largest value in a particular container."

Because the function is a math operation, you'd look in
the Math namespace and find `Math\max` and `Math\max_by`.

## Full Documentation

Automatically-generated documentation is available on
[docs.hhvm.com](https://docs.hhvm.com/hsl/reference/).

## Installation

This project uses function autoloading, so requires that your projects use
[hhvm-autoload](https://github.com/hhvm/hhvm-autoload) instead of Composer's
built-in autoloading; if you are not already using hhvm-autoload, you will need
to add an
[hh_autoload.json](https://github.com/hhvm/hhvm-autoload#configuration-hh_autoloadjson)
to your project first.

```
$ composer require hhvm/hsl
```

## Principles

- All functions should be typed as strictly as possible in Hack
- The library should be internally consistent
- Arguments should be as general as possible. For example, for Hack array
functions, prefer `Traversable`/`KeyedTraversable` inputs where practical,
falling back to `Container`/`KeyedContainer` when needed
- Return types should be as specific as possible
- All files should be `<?hh // strict`

### Consistency Rules

This is not an exhaustive list.

- Functions argument order should be consistent within the library
- All container-related functions take the container as the first argument
(e.g. `Vec\map()` and `Vec\filter()`)
- `$haystack`, `$needle`, and `$pattern` are in the same order for all
functions that take them
- Functions should be consistently named
- If an operation can conceivably operate on either keys or values, the default
is to operate on the values - the version that operates on keys should have
a `_key` suffix (e.g. `C\find()`, `C\find_key()`,
`C\contains()`, `C\contains_key()`)
- Find-like operations that can fail should return `?T`; a second function
should be added with an `x` suffix that uses an invariant to return `T`
(e.g. `C\first()`, `C\firstx()`)
- Container functions that do an operation based on a user-supplied keying
function for each element should be suffixed with `_by` (e.g.
`Vec\sort_by()`, `Dict\group_by()`, `Math\max_by()`)
The HSL itself remains supported - this is just moving where the code lives.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md); in particular, new features should be
contributed to
[the experimental repository](https://github.com/hhvm/hsl-experimental/)
instead.
Contributions should be made to the `hphp/hsl` subdirectory of
[the HHVM repository](https://github.com/facebook/hhvm/).


## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"hhvm/hsl-experimental": "^4.37|dev-master"
},
"require": {
"hhvm": "^4.94"
"hhvm": "^4.108"
}
}
2 changes: 1 addition & 1 deletion hh_autoload.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"roots": [
"src/"
"tests/"
],
"devRoots": [
"tests/"
Expand Down
Empty file added src/.gitkeep
Empty file.
27 changes: 0 additions & 27 deletions src/Ref.php

This file was deleted.

168 changes: 0 additions & 168 deletions src/async/BasePoll.php

This file was deleted.

Loading

0 comments on commit 63a2495

Please sign in to comment.