Blog

New BoxLang Feature: Functional binding to member methods

Maria Jose Herrera September 09, 2024

Spread the word

Maria Jose Herrera

September 09, 2024

Spread the word


Share your thoughts

Streamline your code with smooth method referencing!

We’re excited to unveil a new feature that makes method referencing in BoxLang even smoother. Building on our recent update introducing functional static binding to built-in functions, we're now bringing the same ease to member methods.

BoxLang Ticket

What’s New?

With this update, you can now directly bind to member methods without the fuss of declaring closures. This means you can streamline your code and make it more readable.

For example, instead of using closures like this:

pendingOrders.each(order => order.submit())

You can now simply use:

pendingOrders.each(.submit)

How Does It Work?

By prefixing your method name with a period (.), you can reference member methods without needing to bind them to a specific instance. This makes your code more concise and eliminates extra boilerplate. Plus, if your methods require arguments, you can pass them like this:

[ "brad", "luis", "jon" ].map(.left(1)) // [ "b", "l", "j" ]

Here, .left(1) is used to call the left method on each string in the array, stripping one character from each name.

Try BoxLang

Why This Matters

This feature not only simplifies method binding but also keeps your code clean and expressive. It’s all about making your development experience smoother and more intuitive.

Want to dive deeper into this feature? Check out the details in our ticket: [BL-351]

BoxLang Ticket

Happy coding!

Add Your Comment

Recent Entries

Into the Box Round 1 of Sessions and Workshops are now out!

Into the Box Round 1 of Sessions and Workshops are now out!

Our first round of sessions and workshops for Into the Box 2025 is here! Get ready to dive into a world of modern web development with hands-on workshops and engaging sessions led by Ortus Solutions and Community CFML and BoxLang experts. Visit intothebox.org to explore what’s in store—this is just the beginning, with much more content coming soon!

Maria Jose Herrera
Maria Jose Herrera
January 20, 2025
BoxLang 1.0.0 Beta 26 Launched

BoxLang 1.0.0 Beta 26 Launched

We’re thrilled to announce the release of BoxLang 1.0.0 Beta 26, a monumental update that takes performance and functionality to the next level. This beta officially certifies the ColdBox HMVC Framework to run on BoxLang, marking a significant milestone in compatibility. Not only can you now run all ColdBox applications seamlessly on BoxLang, but with the latest ColdBox snapshot, you can also build your entire applications in BoxLang, unlocking the full potential of this dynamic and expressive language for modern application development.

Luis Majano
Luis Majano
January 20, 2025