Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This rubs me the wrong way.

> Thus, Hack was born. We believe that it offers the best of both dynamically typed and statically typed languages, and that it will be valuable to projects of all sizes.

In which way does it offer the benefits of dynamic typing? The entire point seems to be to abandon dynamic typing, which is fine, but not what that sentence says.

I'm guessing, for example, you can't really do meta-programming with Hack in the way you can with dynamic languages, is that correct?



AFAIK large PHP libraries(Doctrine/Symfony) generate PHP code (from config files for instance) that is then required and executed.

You cant be more meta than that.

I dont know if you can do that with Hack, but that's definetly a big PHP pattern.


It depends on what you mean by "with Hack". You cannot do this in Hack code -- we disallow the dynamic features of the language you need to do this; they are impossible to statically typecheck and verify. However, Hack code iteroperates seamlessly with PHP code, so there's nothing stopping you from having some PHP files in your codebase that do anything that standard PHP can do.


So.. my question remains unanswered... if you cannot do meta-programming in hack, how can you say it "offers the best of both dynamically typed and statically typed languages"?


It's more accurate to say that the point is to let you use dynamic typing where that makes sense, and static typing in the many cases where it helps. Hence "best of both".


This comment seems to indicate that you can't use dynamic typing: https://news.ycombinator.com/item?id=7437907


My understanding is that you can use dynamic typing, but not dynamic code generation. Not the same thing.


The benefits of dynamic typing come because you are not forced to convert all your code to the statically typed version. You can still keep some parts synamically typed if you want




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: