Recent advances in programmable metasurfaces, also dubbed as reconfigurable intelligent surfaces (RISs), are envisioned to offer a paradigm shift from uncontrollable to fully tunable and customizable wireless propagation environments, enabling a plethora of new applications and technological trends. Therefore, in view of this cutting edge technological concept, we first review the architecture and electromagnetic waves manipulation functionalities of RISs. We then detail some of the recent advancements that have been made towards realizing these programmable functionalities in wireless communication applications. Furthermore, we elaborate on how machine learning (ML) can address various constraints introduced by real-time deployment of RISs, particularly in terms of latency, storage, energy efficiency, and computation. A review of the state-of-the-art research on the integration of ML with RISs is presented, highlighting their potentials as well as challenges. Finally, the paper concludes by offering a look ahead towards unexplored possibilities of ML mechanisms in the context of RISs.