A New Era in Move VM: Function Values

The Aptos community is gearing up to discuss one of the latest innovations introduced in Move 2: Function Values! This crucial update will be explored in depth during the Aptos AIP Community Review on Wednesday, March 12. But what exactly are Function Values, and why do they matter?

What Are Function Values?

With Move 2, the language now supports higher-order functions, allowing functions to be treated as values. This means they can be constructed using lambda expressions and partial function applications, stored in vectors and structs, and even persisted in storage under certain conditions.

This feature marks a significant enhancement to the Move Virtual Machine (Move VM) and is proposed under AIP-112.


Why Does It Matter?

Higher-order functions are a well-established feature in modern programming languages, enabling cleaner, more readable code. Web3 developers are already familiar with using lambda expressions on the client side—now they can leverage this power directly on-chain in Move.

This update is particularly game-changing for DeFi applications! Previously, inline functions in Move allowed for operations like filter/map/reduce , but they had severe limitations—mainly due to visibility restrictions that prevented them from accessing private features in their original module. With Function Values, these limitations are removed, making Move-based DeFi apps significantly more flexible and scalable.


Are There Any Alternatives?

Not really. While some workarounds exist, they are not fully functional:

  1. Using large switch expressions to manually dispatch over different assets is possible, but it requires redeploying the contract whenever a new asset is added.
  2. Dynamic script generation allows a DeFi app to create custom scripts on the fly for each transaction. However, this method introduces security risks and shifts logic off-chain, making it less transparent.

By introducing Function Values natively, Move eliminates the need for such workarounds and provides developers with a seamless and efficient solution.


Conclusion

This new feature is set to redefine Move’s capabilities, especially in the DeFi space. Don’t miss the discussion at the Aptos AIP Community Review on March 12! What do you think about Function Values? How do you see this impacting the Move ecosystem? Share your thoughts below!

6 Likes