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

Adobe CFSummit 2024 Recap | Ortus Solutions

Adobe CFSummit 2024 Recap | Ortus Solutions

A huge thank you to everyone who visited our booth! We had the pleasure of engaging in meaningful conversations about Modern CFML and ColdFusion development, sharing insights, and exploring exciting new ideas. Visitors also got a chance to participate in some fun activities and win fabulous prizes, including our customized t-shirts, which were a huge hit!

Maria Jose Herrera
Maria Jose Herrera
October 02, 2024
BoxLang September Newsletter

BoxLang September Newsletter

Welcome to the September edition of the BoxLang Newsletter! This month has been packed with exciting updates, new features, and enhancements that continue to shape BoxLang into a robust and versatile programming language. In this edition, we highlight the latest beta releases, new integrations, and key features that have been introduced.

Maria Jose Herrera
Maria Jose Herrera
October 01, 2024
Fall Savings: Unlock Exclusive Discounts Until October 31st!

Fall Savings: Unlock Exclusive Discounts Until October 31st!

Get ready for the Ortus October Fall Savings! This is your opportunity to elevate your development experience with fantastic offers designed for everyone—from seasoned developers to tech enthusiasts. Our special promotions are here to help you achieve your goals while saving money!

Don’t Miss Out on These Amazing Offers!

Use the code FALLSAVINGS24 at checkout to enjoy these incredible discounts before they expire on October 31st

Cristobal Escobar
Cristobal Escobar
October 01, 2024