User:DavisVega90/BoxLang (programming language)

BoxLang (programming language)

edit
BoxLang
 
BoxLang Logo
ParadigmMulti-paradigm: object-oriented, imperative, functional, aspect-oriented, scripting
Designed bySolutions, Corp
DeveloperLuis Majano

Brad Wood
Jon Clausen
Jacob Beers
Gavin Pickin
Alan Quinlan
Dan Card
Daniel Garcia
Eric Peterson
Esmeralda Acevedo
Grant Copley
Javier Quintero
Michael Born

Jaime Ramirez
First appeared16 May 2024 (2024-05-16)
Preview release
Beta 1.0/16 May 2024 (2024-05-16)
Typing disciplineDynamic, static, strong, duck
PlatformAndroid,

JVM,
JavaScript,
macOS,
iOS,
Linux,
Windows,
WebAssembly,

LLVM
OSCross-platform
LicenseApache License 2.0
Filename extensions .bx, .bxm, .bxs
Websiteboxlang.io
Influenced by
Java, Python, Ruby, Smalltalk, Groovy, Php

BoxLang is a modern, dynamic, and loosely typed scripting language for multiple runtimes, Java Virtual Machine (JVM) provides Object-Oriented (OO) and Functional Programming (FP) constructs, as well as dynamic Metadata Programming (MP). It is a professional open-source project based on the Apache 2 license. There are two subscription options for a professional license for the language and its runtime (web, android, web assembly, etc.), each offering different support levels, customizable SLAs (Service Level Agreements), custom patches, security notifications, enhanced features, and modules.

Overview

edit

BoxLang was created by Ortus Solutions Corp. It is maintained by the company and a growing number of contributors.

It integrates key features from programming languages, including Java, ColdFusion, Python, Ruby, Go, and PHP, to equip developers with a modern, fluent, and expressive syntax.

Key features

edit
  • Dynamic Language

BoxLang is dynamically typed, which means there´s no need to declare types. It can perform type inference, auto-casting, and promotions between different types. The language adjusts to its deployed runtime and can add, remove, or modify methods and properties at runtime, making it highly flexible and adaptable.

  • Multi-Runtime Development

BoxLang can be used to write adaptive code for any operating system, JVM, servlet container web server, cloud lambda functions, iOS, Android, or even the browser using our web assembly package. BoxLang is built on a versatile language core, making it deployable on almost any current or future platform.

  • Established Ecosystem

BoxLang has a well-established ecosystem. Every Java and ColdFusion/CFML library is compatible with BoxLang. It comes with CommandBox, which serves as its package manager, server manager, task manager, and REPL tool.

  • Java Interoperability

BoxLang offers 100% interoperability with Java. It can extend and implement Java objects, use annotations, declare classes, imports, and more. Thanks to InvokeDynamic and the BoxLang Dynamic Object core, everything in BoxLang is fully interoperable with Java.

  • Low Verbosity Syntax

It is highly functional, fluent, and human-readable. It is highly expressive and has low ceremony.

  • Event Driven Language

BoxLang comes with an internal event bus that can be used to enhance the language's capabilities or those of any application. It´s able to listen to almost every aspect of the language, parser, and even the runtime, or collaborate using the user own events.

  • Enterprise Caching

The system has internal caching capabilities, which can be customized with providers, object stores, listeners, and statistics.

  • IDE + Tools

It comes with various tools to assist developers in their work. It includes a Visual Studio Code extension for the language, providing features such as syntax highlighting, code debugging, code insight, code documentation, formatting, LSP integration, and more. Subscribers to the premium version receive additional tools, including enhanced debuggers, ColdFusion/CFML transformers.

  • Scheduling & Task Framework

It provides a centralized and portable way to define and manage scheduled tasks for user servers and applications.

  • Functional Programming

It enables users to explore functional concepts such as immutability and higher-order functions to write robust code. BoxLang promotes code that is easier to maintain and less error-prone, thanks to its support for functional programming principles.

  • Modular Extensibilty

It's possible to add new built-in functions, template components, or modify existing functions on classes. This language also supports a Runtime Debugger, AOP aspects, and event listening within the language itself.

  • Multi Parsers: CFML & BoxLang

BoxLang supports a dual parser and transpiler for executing ColdFusion/CFML code natively. It is possible to run all ColdFusion applications within BoxLang natively. Additionally, it provides tooling that automatically transpiles ColdFusion code to BoxLang for Subscription users.

  • Professional Open Source

Professional open source project based on the Apache 2 license. Core features and Community Support.

  • Serverless Development

Allows developers to write code in functions that trigger based on events and leave server management to the cloud provider.

  • Meta-Programming

Allows developers to modify the behavior of BoxLang classes and objects at runtime. It involves manipulating the way classes and objects respond to method calls, property access.

Examples

edit

Tag Syntax

edit
//myprogram.bxm
<bx:set s = new Sample()>
<bx:output>#s.hello()#</bx:output>

Script Syntax

edit
//myprogram.bxm
<bx:script>
    s = new Sample();
    writeOutput( s.hello() );
</bx:script>

Tip: Please note that if you want to write in script in a tag-based file, you must use an opening and closing <bx:script> tag.

//Sample.bx
class{

    function hello(){
       return "Hello, World!";
    }

}

Please note that no types and not even any visibility scopes you might be used to are present. BoxLang can also infer variable types on more distinct variables like dates, booleans, or numbers. However, please note that you can fully leverage types if you like:

//Sample.bx
class{

    public string function hello(){
       return "Hello, World!";
    }

}

Note: By default, the return type of every function and/or argument is any. Thus, it can be determined at runtime as a dynamic variable.

Semi-Colons

edit

Please note that semi-colons are used to demarcate line endings in BoxLang ;. They can be optional, however. Also, note the CommandBox REPL does NOT require semi-colons.

Tags In Script

edit

BoxLang will allow you to write your tags in script syntax. You basically eliminate the starting < and ending > enclosures and create a block by using the { and } mustaches.

Note: BoxLang uses Lucee's generic tag-in-script syntax

http method="GET" charset="utf-8" url="https://www.google.com/" result="result" {
    httpparam name="q" type="formfield" value="test";
}

Playgroung

edit

Boxlang offers an interactive playground at https://try.boxlang.io/ where users can experiment with the language directly in their web browser.

References

edit
  1. https://www.ortussolutions.com/
  2. Java virtual machine
  3. https://try.boxlang.io/
  4. https://boxlang.io/
edit