Facebook open sources “Hack Codegen” a code that writes code

- Advertisement -
Good news for Open Source Lovers!
Facebook has open-sourced Hack Codegen – its library for automatically generating Hack code, allowing outside developers to automate some of their routine work while developing large programs.
HACK is the Facebook’s own programming language designed to build complex web sites and other software quickly and without many flaws.
HACK programming language is developed for HipHop Virtual Machine (HHVM) – an open-source virtual machine designed to execute programs written in Hack and PHP. The top 20 open source frameworks on Github run on HHVM.

HACK CodeGen is Now Open Source

While making the announcement of open-sourcing Hack Codegen, which automatically generates hack code, Facebook’s software engineer Alejandro Marcu said in a blog post:

“Being able to generate code through automated code generation allows [developers] to increase the level of abstraction by making frameworks that are declarative and that are translated into high-quality Hack code.”
“We’ve been using Hack Codegen at Facebook for a while. After seeing so much internal success, we open-sourced this library so that more people could take advantage of it.”

Before Hack Codegen, Facebook engineers used concatenating strings to generate code that perform simple yet frequently executed tasks, like fetching birthday of a user.
However, the social media giant later discovered that the technique was not good enough to scale up and realized that it need a good library to generate code. This results in the birth of Hack Codegen.

Code That Writes Code

Hack Codegen simplifies code generation by helping developers create a schema, which holds code for multiple times usage, and a way to generate all the related functionality required to support that code.
The library only needs a developer to provide the required details about the particular implementation, although rest of the task is done by the software, such as generation of classes, variables, methods, functions, interfaces, files, and other standard blocks of code.
The Hack Codegen library includes:
  • Hack_builder to deal with the concatenation
  • New lines
  • Indentation
  • Braces
  • Hack keywords
  • Collections
  • Signed files to re-generate code automatically when a schema is changed
The open-source version of Hack Codegen is available on GitHub.
- Advertisement -
Adeel Younashttps://techwafer.com
Editor-in-Chief at TechWafer (previously The Tech) an Entrepreneur, Blogger, Developer, and Freelancer.

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related

vivo Announces the Launch of X70 Pro in Pakistan

vivo officially debuted the X70 Pro in Pakistan, marking the next chapter in vivo's global imaging partnership with ZEISS and their joint pursuit of...

OPPO Launches ColorOS 12 – Here’s What You Should Know

Based on Android 12, Oppo's ColorOS 12 introduces valuable features and customization options. ColorOS 12 provides a seamless experience closer to stock Android 12...

Infinix announces HOT 11S with MediaTek G88 Chipset

Infinix, the no.1 selling smartphone brand, has announced its new gaming smartphone – HOT 11S in Pakistan. Boasting a Dual Chip MediaTek Helio G88...
Advertisment

Trending

OPPO Launches ColorOS 12 – Here’s What You Should Know

Based on Android 12, Oppo's ColorOS 12 introduces valuable features and customization options. ColorOS 12 provides a seamless experience closer to stock Android 12...

vivo’s Latest Flagship Smartphone, X70 Pro Is Set to Launch in Pakistan

vivo has officially confirmed the launch of its high-end flagship smartphone, the X70 Pro, on 18th October 2021. The phone is a culmination of...

Infinix announces HOT 11S with MediaTek G88 Chipset

Infinix, the no.1 selling smartphone brand, has announced its new gaming smartphone – HOT 11S in Pakistan. Boasting a Dual Chip MediaTek Helio G88...
get latest updates from us
subscribe and get important updates in the notification
Allow
Later