How to evaluate a string of code in Erlang at runtime

Erlang has the ability to read in a string, representing a line of code to execute, at runtime. It can parse it out, evaluate it and return the value. Contents 1 Evaluating Simple Expressions 2 Security Considerations 2.1 What’s an SQL injection attack? (bear with me) 2.2 What’s that have to do with Erlang?! 3 Intercepting Local Function Calls 4 Intercepting Non-Local Function Calls 5 What else? Evaluating Simple Expressions At its most basic, we can just read any expression passed in and execute it. -module(parser). -export([ evaluate_expression/1 ]). -spec evaluate_expression(string) -& »

Reviewing the Basics Helps Us See the Light

I enjoy finding the occasional online mooc to participate in, as time permits, even if it’s something I’m already familiar with. Hearing or reading about an old concept in a slightly different way can bring new insights, make us rethink something we’ve been taking for granted, or just help us make a new connection. “Don’t assume that just because you can get something to work once, there’s nothing more to understand.” - Bob Frankston— Programming Wisdom (@CodeWisdom) September 1, 2016 For the last few weeks, it’s been an intro to computer science on »

A Tail of Recursion in Erlang (a C# developer's observations)

A group of us at VHT has been meeting weekly, reviewing some Erlang basics and running through examples. Even though it means giving up a lunch hour, over a dozen people have still been showing up to learn and help each other. Two of us were recently challenged to figure out a couple problems in Erlang without using obvious built-in functions: Determine the length of a list. (without using length([1,2,3]).) Reverse the list. (without using lists:reverse([1,2,3]).) We looked into it, and even shared what we found with the group a week later. This »