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

On the relationship with Hacklang #180

Closed
marinasundstrom opened this issue Mar 3, 2018 · 10 comments
Closed

On the relationship with Hacklang #180

marinasundstrom opened this issue Mar 3, 2018 · 10 comments

Comments

@marinasundstrom
Copy link

Will there be some syntactic convergence with Hack (Facebooks PHP extension)?

Because it has generics and async and that syntax could be used for interop with .NET generics and Task.

The real question is:

Unless PHP itself plans implement similar features, will you adopt at least these syntactic extensions for .NET features?

And: Would you implement Hacklang too? Gradual typing and other things that could make PHP a more or less complete CLI/.NET language.

@jakubmisek
Copy link
Member

jakubmisek commented Mar 3, 2018

It is a very good point, makes much sense and we were thinking about it already. Also hacklang provides type hinting for class properties (which we solved through PHPDoc @var tags while waiting for this rfc to be accepted). Anyway;

It is a future plan, with no ETA.

@marinasundstrom
Copy link
Author

marinasundstrom commented Mar 3, 2018

👍 Alright. Naturally, you'd want to make PHP work before moving on to extending with interop stuff.

However, generics and then async await seems crucial to me when interop-ing with .NET from PHP. Right now you cannot instantiate a generic class, such List.

In the meantime, I'll wait with excitement for what you and the community deliver next :)

@jakubmisek
Copy link
Member

@RobertSundstrom basically I can integrate Hack into the compiler if anyone would extend the parser with syntax for that (at https://github.com/devsense/parsers).

@marinasundstrom
Copy link
Author

marinasundstrom commented Jun 12, 2018

@jakubmisek I'm not a PHP or Hack programmer :) But sure, I could maybe help with that. But I think that we should have a strategy for implementing these features. First, we need to know how they map to the .NET world.

I think that priority #1 is understanding how Hack handles type through gradual typing. Type annotations and their effect on regular PHP code.

@jakubmisek
Copy link
Member

@RobertSundstrom Actually the first step is to extend the parser - without any knowledge of .NET runtime or mapping Hack constructs to anything.

After that, after we have the syntax tree, we can subsequently learn compiler to handle frequently used constructs (type annotations are the easiest one, we already compile type hints). The rest of constructs remain unimplemented.

@marinasundstrom
Copy link
Author

@jakubmisek OK! Then I'll just start by learning how the parser works and then add the syntax support there.

@jakubmisek
Copy link
Member

awesome! the parser has extensive tests that should help to maintain the code working.

Note there are LanguageFeatures enum which enables/disables parser features (like PHP7.1, 7.2), so I would expect to add Hack flag in there so all the additional Hack constructs within <?php script tags will be parsed only if the flag is enabled.

The other way would be to enable Hack constructs only within the <?hh script tag so the flag is not even needed.

@jakubmisek
Copy link
Member

Closed for inactivity. Hack language is currently not planned to be supported, however some of its features will be implemented in a future versions (not on roadmap yet, but e.g. generics )will be needed at some point.

@zacharylayne
Copy link

"Hack language is currently not planned to be supported,"

That makes me sad. :( At FB, there has been some interest in making Hack interop with other languages, and C# has been brought up before.

@bfistein
Copy link
Member

bfistein commented Feb 7, 2019

We're just saying it's not on the immediate roadmap. If enough interest arises, we'll revisit the idea, but so far there are too many other priorities.

Theoretically nothing is stopping this from happening and if see that enough devs want this, we'll definitely consider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants