[p-news] Higher order values

Paul Bone paul at plasmalang.org
Thu Nov 23 21:44:30 AEDT 2017


Higher order values
===================

Another item ticked off the roadmap! Higher order values and higher order
calls. That’s two items!

Now it is possible to capture higher order values. Let’s say we have a
function such as:

    func hello_msg(name : String) -> String {
        return "Hello " ++ name ++ "\n"
    }

Now in another function’s body we can create a value pointing to the
function.

    f = hello_msg

And even call it:

    s = f("World")

This is pretty simple stuff, but necessary for any expressive programming
language. Next we’ll be adding more tests to make sure these values work if
we put them inside other structures (like a list of functions). We also want
to make sure that statically created data can refer to functions (currently
it cannot). Statically constructed data also cannot refer to data
cyclically; this may be a good thing. After that we’ll add closures
(including lambdas), partial application, and allow data constructors to
also serve as functions.


-- 
Paul Bone
http://paul.bone.id.au


More information about the news mailing list