These are chat archives for evhub/coconut

Jul 2017
Cristi Constantin
Jul 14 2017 20:08
hi guys! just discovered coconut a week ago and i have a question:
how can i execute coco code (as string or file) from within Python, by passing some variables and functions that are already available?
you know, like a normal exec funtion
what i'm trying to accomplish: make a pretty easy to learn scripting language, that runs from Python and calls some methods that are already available, in a more restricted environment and without the user worrying about importing the relevant functions, they will be imported already
actually i tried this for a long time and i implemented my own simple language, first i used some regexes, then it become more and more complex and i discovered DG, HY and Coconut, but i like Coconut the most :)
Cristi Constantin
Jul 14 2017 20:13
@evhub : could you point me to the right file to find the exec function ? assuming there is one
and the second question, if i may: can i restrict some of the features of the language, before or after the compilation (throwing an error like: You are not allowed to import that library is fine)
something like danthedeckie/simpleeval or newville/asteval are doing