This code source don’t compile, Is there a way to make that in OPA ?
type User = { nom : string ; prenom : string }
un_user = { nom = "My_name" ; prenom = "My_last_name" } : User
champ = "nom"
do jlog(un_user.`champ`)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Runtime magic is possible in Opa, using the OpaValue module which contains feature for runtime introspection of values (not type safe)
http://opalang.org/resources/doc/index.html#opavalue.opa.html/!/value_stdlib.core.OpaValue.Record
But this is not for casual user, and a very dangerous coding style.
It is often a need coming from code written in a coding style corresponding to scripts and runtime evaluated language.