The Future is
Dynamic
LED BY
Luis F. Majano
try.boxlang.io
www.boxlang.io
LUIS F. MAJANO
• CEO Ortus Solutions
• Computer Engineer
• Born in El Salvador => Raised in the USA
• 2023 Leading EU Expansion team (Spain 🇪🇸)
• Creator & Maintainer:
ColdBox MVC, TestBox BDD/TDD, CommandBox CLI, ContentBox CMS,
etc.
• Creator / Chief Language Engineer BoxLang Programming Language
@lmajano @ortussolutions
WHAT DO YOU CALL AN ANXIOUS DINOSAUR?
• What?
• Why?
• Goals
• Semantics
• Features
• How to start
Agenda
www.intothebox.org
APRIL 30 - MAY 2 WASHINGTON, DC
DYNAMIC : MODULAR : PRODUCTIVE
BoxLang is a modular dynamic language for the JVM, aiming to
make your development more productive, expressive, functional,
and available everywhere.
DYNAMIC : MODULAR : PRODUCTIVE
• Dynamically Typed with an optional/inferred/coercion type system
• Language supports Classes, Scripting, and Templating
• Modern Java interop (invokeDynamic)
• Highly functional: context-aware closures, pure lambdas, and more
• Built-in Framework concerns
• Small, lightweight, and modular (8mb)
• Open Beta Summer 2024 (30 releases)
• Release Candidate 2
• Final 1.x May 2025 at www.intothebox.org
What is it?
RUNTIME
Application
Service
Async
Service
Cache
Service
Component
Service
Datasource
Service
Function
Service
Interceptor
Service
Module
Service
Scheduler
Service
Why?
Who we are?
Who we are?
• Ortus is a professional open-source company
• Operating since 2006
• Polyglot developers (Java, Groovy, Rust, Python, Scala, CFML, NodeJS, PHP)
• Created all the major frameworks for the CFML eco-system
• Package manager, CLI, MVC, DI/AOP, Testing TDD/BDD, etc
• Manage over 350+ libraries
• 19+ years of servicing different software communities globally
• We create tools and custom solutions!
• We did not wake up one day and said “Let’s make a language.”
• We are not that crazy! Well…. Maybe a little 🤪
• The culmination of 19+ years of open-source development
• We could not continue to innovate and create under current language vendors
• We need a way forward for us at Ortus, our clients, and community
• Dynamic languages on the JVM had not evolved recently
• A language of the times
Why?
https://www.ortussolutions.com/blog/why-boxlang-when-you-have-kotlin-groovy-scala-and-more
Goals & Vision
Goals & Vision
• Be dynamic, modular, lightweight, and fast
• Be 100% interoperable with Java
• Be modern, functional, and
fl
uent
(Think mixing CFML, Node, Kotlin, Java, Rust, and
Clojure)
• Modularity at its core
• Take advantage of the modern JVM
• TDD: Fully tested source code
• Be able to support multiple runtimes
• AST Focused
• Have multiple transpilers
CFML -> BoxLang,
Groovy -> BoxLang
Cobol -> BoxLang
• IDE and Tooling
• Integrate other languages easily
Key Features
Multi-Runtime Architecture
Multi-Runtime Architecture
Any OS
Docker MiniServer CommandBox Servlet Lambda Azure Android WebAssembly
In Dev Soon Soon
8 MB
9 MB 8 MB
15 MB
15 MB
160 MB
BoxLang Code Playground : try.boxlang.io
Wanna play?
128MB RAM
600 KB
8 MB
<Your
Code>
Wanna play?
• try.boxlang.io
• First production BoxLang applications
• Powered by our MiniServer Container
• Templating Language + Alpine.JS
• AWS Lambda Runtimes
Modern Dynamic Language
Modern Dynamic Language
• Dynamically typed + Optional Typing
• JSR-223 Compliant
• No re
fl
ection; we use InvokeDynamic for everything
• DynamicObject Framework
• Any Object can be Dynamic!
• Type promotions, auto-boxing, auto-casting, coercions
• All OO Constructs
• Interfaces, super interfaces, and default method implementations
• Abstract classes and methods
• Static scope and methods on classes and interfaces
• Use all-new JDK features and types
• Collection of Dynamic Casters and Helpers
Multi-Parser Architecture
Multi-Parsers
• BL-AST
• A way to split with the old and bring in the new
• JIT or CLI Transpiler
• Supported Languages
• ColdFusion/CFML (Completed)
• COBOL (In Planning)
• Groovy (In Planning)
• Custom
• Incorporate legacy apps/languages and modernize them
Java Interop
Java Interop
• Interact with Java naturally
• Type inference, auto-casting, type promotions,
and coercion
• Long -> Doubles, Doubles ->Longs, etc
• BoxLang Function -> Java Lambdas
• You can import, extend, implement, annotate
from Java
Java Interop
BoxLang Semantics
File Types
Scopes
// scripting + templates
name = “boxlang”
// Functions have a local + arguments + surrounding scopes
function save( name ){
var transactional = true
// pass scopes around
saveData( arguments )
}
// Treat scopes like maps
function getMemento(){
return variables
.filter( key, value -> !isCustomFunction( value ) )
}
// Classes have three encapsulation scopes
Class{
this.publicVar = “public”
variables.privateVar = “private”
static.field = 123
}
• All variables are inside of scopes
• Scopes backed by concurrent maps
• Each execution context can have different
scopes
• Scripts
• Variables
• Functions
• Arguments, local, + surrounding scopes
• Classes
• This (public), variables (private), static
• Threads
• Local, attributes, thread
• Global Scopes + Life-Span
• Application, request, server, session, etc
• Custom Scopes
Enhanced Types with Member Methods
fruits = [ "apple", "bananas", "pears" ]
println( fruits.len() )
data = fruits
.append( "orange" )
.filter( item -> item.findNoCase( "an" ) )
.each( item -> println( item ) )
.toJSON()
"apple,bananas,pears"
.listToArray()
.filter( item -> item.findNoCase( "an" ) )
.each( item -> println( item ) )
person = { fname: "box", lname: "lang", age: 1 }
person.fullName = () => person.fname & person.lname
println( person.fullName() )
• All Java types plus:
• Arrays
• Structs (ordered, unordered, weak, soft, etc)
• Queries (Typed Columns)
• DateTime (java.time)
• Numeric (
fl
oat, short, int, double, bigdecimal)
• XML (Enhanced Maps)
• All auto-castable, dynamic and functional
Functions
// Java
public int sum( int a, int b){
return a + b;
}
// BoxLang no types
function sum( a, b ){
return a + b
}
// Optional Generic types
Numeric function sum( numeric a, numeric b ){
return a + b
}
// Optional Specific types
int function sum( int a, int b ){
return a + b
}
• All functions `public` by default
• All return types `any` by default
• All argument types `any` by default
• What is any????
• 2 types of type inference
• Compile-Time
• Runtime
• Auto-casting
• Type Promotions
• Type Coercion
Functions Arguments
// Java
Public void repeat( String str, int count, String separator ){}
repeat( “hello”, 2, “;” )
// BoxLang
repeat( required str, count:5, separator:“;” ){}
// Call with defaults
repeat( “hello” )
// Call with argument binding
myMap = { str : “test”, separator : “,” }
repeat( argumentCollection:myMap )
• Required arguments
• Default values
• Argument binding
• Structs (Maps)
• Arrays
Functions Variables
// Java
int a = 1;
String b = “xyz”;
Map test = new HashMap();
List<String> myList = new ArrayList();
// BoxLang
var a = 1
b = “xyz”
map = { age : 0, today : now() }
myList = [ “1”, 2, “3”, 4 ]
orderedMap = [ age : 0, today : now() ]
anotherFunction( local )
• No need to `var` in functions (automatic)
• All go into a `local` scope
• Inferred variables
• Mix types if you want
• Struct and array literals
• Ordered Struct literals
Null Coalescence Operator + Safe Navigation
// Java
Int getLength( String myString ){
if( myString != null ){
return myString.length()
}
return 0;
}
function getLength( myString ){
return myString.length() ?: 0
}
Name = event.headers?.name // null
Email = user.?getEmail() ?: “nada”
• Elvis Operator
• Any null expression can be used
• Entire left hand expression detection
• Safe Navigation .?
• Any dereferenceable object
• Arrays, structs, objects, etc.
Variable re-assignments
// Java
int age = 30;
age = “MyAge”; // ERORR
// BoxLang
age = 30
age = “Thirty Years Old!”
final age = 800
• Variable re-assignments
• Changing values and types are ok!
• Unless you mark them as `
fi
nal`
Variable casting
// Java
String name = (String) myMap.get( key );
Double seconds = 4;
Instant.now().toSeconds( seconds.toLongValue() );
// BoxLang
name = myMap.get( key )
println( name )
seconds = 4
Instant.now().toSeconds( 4 castAs long )
• Auto-casting detection
• Explicit casting if needed
• castAs operator
Unmodifiable Variables
myArray = [1,2,3,4]
myArray.append( more data )
myAsyncFunction( myArray.toUnmodifiable() )
println( myArray )
myArray.toModifiable().append( “hello” )
• `toUnmodifable()` memember method
• `toModifable()` as well
• Arrays
• Queries
• Structs
• Even native Java types
String Interpolation
function toString(){
return “Song{id=“#id#”, title=“#title#”, author=“#author#”}
}
function buildTemplate(){
return ‘{
Id : “#id#”,
Title : “#title#”,
Author : “#getAuthor(id)#”
}’
}
• Tired of string concatenation
• Not anymore!
• Anything between #expression#
• “ Or ‘ For big strings with/without line breaks
‘
Closures & Lambdas & UDFs
function toString(){
return “Song{id=“#id#”, title=“#title#”, author=“#author#”}
}
variables.toString = variables.getString
function delayFunction(){
return () => dowork()
}
runAsync( startWork )
.then( result => computeMoreWork( result ) )
.then( result => sendOrder( result ) )
• Context-aware closures =>
• Pure functions: lambdas ->
• UDFs
• Automatic coercion to Java Lambdas
• Any signature
• Functions are 1st class citizens
• Pass them around
Classes
class {
Property firstName;
Property lastName;
Property numeric age setter=false;
}
Person = new Person( “Luis”, “Majano”, “45” )
println( person.firstName ) // person.getFirstName()
person.toJSON()
• Automatic constructor
• Automatic toString(), equals() and hashCode()
• Automatic getters and setters
• Automatic invoke implicit
• JSON / YAML / Custom First-Class
• toJson()
$bx - MetaProgramming
Person = new Person()
writedump( person.$bx.meta )
callJavaClass( person.$bx.$class )
Class{
Property importantData;
Variables
.$bx
.registerChangeListener(
“importantData”,
(Key, newValue, oldValue) => clearCache()
)
}
myMap = { name : “Luis”, born : now() }
myMap
.$bx
.registerChangeListener( (key, newValue, oldValue) => doSomething() )
• Available on ANY object
• Includes
• Metadata
• Class Representation
• Meta Methods
• Change listeners
• Inject properties
• Remove properties
• Inject methods
• Remove Method
Templating Language
• Best of JSP, Blade, GSP, and CFML
• Create your own `<bx:MyTag>` easily
• Import collections of tags
• Use BIFs
• Nesting
• Data Encapsulation
• Much More
<
b
x
:
o
u
t
p
u
t
>
<
d
i
v
c
l
a
s
s
=
"
b
x
-
d
u
m
p
"
>
<
t
a
b
l
e
c
l
a
s
s
=
"
b
x
-
t
a
b
l
e
S
t
"
t
i
t
l
e
=
"
#
p
o
s
I
n
C
o
d
e
#
"
>
<
c
a
p
t
i
o
n
c
l
a
s
s
=
"
b
x
-
d
h
S
t
"
r
o
l
e
=
"
b
u
t
t
o
n
"
t
a
b
i
n
d
e
x
=
"
0
"
o
p
e
n
>
<
s
t
r
o
n
g
>
Q
u
e
r
y
:
#
v
a
r
.
r
e
c
o
r
d
c
o
u
n
t
#
r
o
w
s
<
/
s
t
r
o
n
g
>
<
/
c
a
p
t
i
o
n
>
<
t
h
e
a
d
>
<
t
r
>
<
b
x
:
l
o
o
p
a
r
r
a
y
=
"
#
v
a
r
.
c
o
l
u
m
n
L
i
s
t
.
l
i
s
t
T
o
A
r
r
a
y
(
)
#
"
i
t
e
m
=
"
c
o
l
u
m
n
"
>
<
t
h
>
#
e
n
c
o
d
e
F
o
r
H
T
M
L
(
c
o
l
u
m
n
)
#
<
/
t
h
>
<
/
b
x
:
l
o
o
p
>
<
/
t
r
>
<
/
t
h
e
a
d
>
<
t
b
o
d
y
>
<
b
x
:
l
o
o
p
q
u
e
r
y
=
"
#
v
a
r
#
"
i
t
e
m
=
"
r
o
w
"
>
<
t
r
>
<
b
x
:
l
o
o
p
a
r
r
a
y
=
"
#
v
a
r
.
c
o
l
u
m
n
L
i
s
t
.
l
i
s
t
T
o
A
r
r
a
y
(
)
#
"
i
n
d
e
x
=
"
c
o
l
u
m
n
"
>
<
t
d
>
#
e
n
c
o
d
e
F
o
r
H
T
M
L
(
v
a
r
[
c
o
l
u
m
n
]
)
#
<
/
t
d
>
<
/
b
x
:
l
o
o
p
>
<
/
t
r
>
<
/
b
x
:
l
o
o
p
>
<
/
t
b
o
d
y
>
<
/
t
a
b
l
e
>
<
/
d
i
v
>
<
/
b
x
:
o
u
t
p
u
t
>
t
h
e
C
o
l
l
e
c
t
i
o
n
=
v
a
r
;
i
f
(
v
a
r
i
n
s
t
a
n
c
e
o
f
'
C
G
I
S
c
o
p
e
'
)
{
t
h
e
C
o
l
l
e
c
t
i
o
n
=
v
a
r
.
g
e
t
D
u
m
p
K
e
y
s
(
)
;
}
f
o
r
(
k
e
y
i
n
t
h
e
C
o
l
l
e
c
t
i
o
n
)
{
`
`
`
<
b
x
:
i
f
N
O
T
i
s
C
u
s
t
o
m
F
u
n
c
t
i
o
n
(
v
a
r
[
k
e
y
]
)
>
<
t
r
>
<
t
h
s
c
o
p
e
=
"
r
o
w
"
c
l
a
s
s
=
"
b
x
-
d
h
S
t
"
v
a
l
i
g
n
=
"
t
o
p
"
>
#
e
n
c
o
d
e
F
o
r
H
T
M
L
(
k
e
y
)
#
<
/
t
h
>
<
t
d
>
<
b
x
:
s
e
t
d
u
m
p
(
v
a
r
[
k
e
y
]
)
>
<
/
t
d
>
<
/
t
r
>
<
/
b
x
:
i
f
>
`
`
`
}
Tag Islands
• Template anywhere in script
• Leverage the ```
• Great for emails, templating, you name it
BoxLang Framework
BoxLang Framework
RUNTIME
Application
Service
Async
Service
Cache
Service
Component
Service
Datasource
Service
Function
Service
Interceptor
Service
Module
Service
Scheduler
Service
Enterprise Caching Engine & Aggregator
Enterprise Caching Engine & Aggregator
Enterprise Caching Engine & Aggregator
• Enterprise Caching Engine
• Extensible
• Custom providers
• Custom object stores
• Listeners
• Stats
• Powers all internal caching
Application Framework
Application Framework
• Inspired by Java contexts
• Create in
fi
nite segregated applications in a single deployment by using one class
• Application.bx
• Life Cycle methods:
• applicationStart(), applicationEnd(), sessionStart(), sessionEnd(), requestStart(),
request(), requestEnd(), onError(), etc.
• Data Sources, class loading, application scopes, security, settings, etc.
• Sub applications
• Highly con
fi
gurable and Highly portable
Scheduling & Task Framework
Scheduling & Task Framework
• Schedulers are portable,
fl
uent, and human
• Write them in BoxLang or Java
• Task & Completable Futures framework from the JDK
• Access to any executor in Java
• Run schedules at the OS
• Task Visualizer - Coming Soon
(BoxLang Admin, BoxLang Debugger)
Event-Driven Language
Event-Driven Language
• Interceptors for the language, and a request
• The best way to scale the language
• Listen to the entire or speci
fi
c language life-cycles
• Modules can listen/collaborate events
• boxAnnounce(), boxAnnounceAsync() : CompletableFuture
Event Channels
Event Producers
Event
Event
Event
Event Consumers
Event
Event
Event
Modular Since Birth
BoxLang Modules
• Inspired by our HMVC Framework: ColdBox
• Not OSGI
• Core Runtime with lightest possible footprint
• Hierarchical Class Loaders
• Taps into the language life-cycle via events
• Write them in Java or BoxLang or Both!
• Executable as CLI packages
• Integrates with Maven/Gradle
BoxLang Modules
FTP/SFTP
Email
Sending
ESAPI UI Forms
Password
Encryption
JDBC
Image
Manipulation
PDF Tooling CSV /
Spreadsheet
AI OSHI YAML
BoxLang Extends BoxLang
In
fl
uence core runtime behavior with BIFs,
Member Functions, Tags, Interceptors, and More!
BX-WAFFLE
https://forgebox.io/view/bx-wa
ffl
e
BoxLang Modular By Design!
• Modular ecosystem, delivered by FORGEBOX
(www.forgebox.io)
• Write your own functions, components, schedulers, JDBC
Drivers, interceptions, and more!
• Boundless potential for community contribution and
engagement!
• Encourage third-party vendors
• FORGEBOX eCommerce Marketplace later this year
But there’s more!
• Allows ANY Java language to embed and use BoxLang
• Allows ANY JSR-223 compliant language to run in BoxLang
• Power of Modules: bx-jython
• Full Python runtime embedded into BoxLang
• Script, load python classes, modules, etc.
BoxLang Tooling
Tooling Overview
Tooling Overview
• BoxLang IDE
• Language Debugger & LSP
• Run classes with a main()
• Run Scripts
• Run / Manage Servers
• Code Converters, Code Formatters
• Code Quality
• Visualizers
Tooling Overview
• CLI Tools
• REPL: CLI code execution
• Shebang Scripts: #!/usr/bin/env boxlang
• File Runner: Run
fi
les
• Schedule Runner: Run schedulers
• Transpiler: Convert CFML to BoxLang
• Compiler: BoxLang to Bytecode
• Feature Audit: BIF and Tag report usage
• Packager: Compile and package your modules or BoxLang apps
Tested & Documented
Tested & Documented
• TDD/BDD at the core of the language
• 6300+ Tests Already
• Test not only Java but BoxLang
• Native BoxLang Assert constructs built-in
• Fully Documented
• Generated API Docs
• boxlang.ortusbooks.com
Live long and prosper
Dynamic | Modular | Productive
Getting Started
https://boxlang.ortusbooks.com/
Getting Started
Try Boxlang
An online code playground built on
the MiniServer + AWS Lambda
Runtimes.
Docs
Learn about BoxLang, and contribute
to our extensive documentation.
Community
Join our community and get help,
tips and more.
x.com/tryboxlang
www.boxlang.io
linkedin.com/company/tryboxlang
facebook.com/tryboxlang
youtube.com/ortussolutions
THANK YOU

BoxLang JVM Language : The Future is Dynamic

  • 1.
    The Future is Dynamic LEDBY Luis F. Majano try.boxlang.io www.boxlang.io
  • 2.
    LUIS F. MAJANO •CEO Ortus Solutions • Computer Engineer • Born in El Salvador => Raised in the USA • 2023 Leading EU Expansion team (Spain 🇪🇸) • Creator & Maintainer: ColdBox MVC, TestBox BDD/TDD, CommandBox CLI, ContentBox CMS, etc. • Creator / Chief Language Engineer BoxLang Programming Language @lmajano @ortussolutions WHAT DO YOU CALL AN ANXIOUS DINOSAUR?
  • 3.
    • What? • Why? •Goals • Semantics • Features • How to start Agenda
  • 4.
    www.intothebox.org APRIL 30 -MAY 2 WASHINGTON, DC
  • 5.
    DYNAMIC : MODULAR: PRODUCTIVE
  • 6.
    BoxLang is amodular dynamic language for the JVM, aiming to make your development more productive, expressive, functional, and available everywhere. DYNAMIC : MODULAR : PRODUCTIVE
  • 7.
    • Dynamically Typedwith an optional/inferred/coercion type system • Language supports Classes, Scripting, and Templating • Modern Java interop (invokeDynamic) • Highly functional: context-aware closures, pure lambdas, and more • Built-in Framework concerns • Small, lightweight, and modular (8mb) • Open Beta Summer 2024 (30 releases) • Release Candidate 2 • Final 1.x May 2025 at www.intothebox.org What is it? RUNTIME Application Service Async Service Cache Service Component Service Datasource Service Function Service Interceptor Service Module Service Scheduler Service
  • 8.
  • 9.
  • 10.
    Who we are? •Ortus is a professional open-source company • Operating since 2006 • Polyglot developers (Java, Groovy, Rust, Python, Scala, CFML, NodeJS, PHP) • Created all the major frameworks for the CFML eco-system • Package manager, CLI, MVC, DI/AOP, Testing TDD/BDD, etc • Manage over 350+ libraries • 19+ years of servicing different software communities globally • We create tools and custom solutions!
  • 11.
    • We didnot wake up one day and said “Let’s make a language.” • We are not that crazy! Well…. Maybe a little 🤪 • The culmination of 19+ years of open-source development • We could not continue to innovate and create under current language vendors • We need a way forward for us at Ortus, our clients, and community • Dynamic languages on the JVM had not evolved recently • A language of the times Why? https://www.ortussolutions.com/blog/why-boxlang-when-you-have-kotlin-groovy-scala-and-more
  • 12.
  • 13.
    Goals & Vision •Be dynamic, modular, lightweight, and fast • Be 100% interoperable with Java • Be modern, functional, and fl uent (Think mixing CFML, Node, Kotlin, Java, Rust, and Clojure) • Modularity at its core • Take advantage of the modern JVM • TDD: Fully tested source code • Be able to support multiple runtimes • AST Focused • Have multiple transpilers CFML -> BoxLang, Groovy -> BoxLang Cobol -> BoxLang • IDE and Tooling • Integrate other languages easily
  • 14.
  • 15.
  • 16.
    Multi-Runtime Architecture Any OS DockerMiniServer CommandBox Servlet Lambda Azure Android WebAssembly In Dev Soon Soon 8 MB 9 MB 8 MB 15 MB 15 MB 160 MB
  • 17.
    BoxLang Code Playground: try.boxlang.io
  • 18.
    Wanna play? 128MB RAM 600KB 8 MB <Your Code>
  • 19.
    Wanna play? • try.boxlang.io •First production BoxLang applications • Powered by our MiniServer Container • Templating Language + Alpine.JS • AWS Lambda Runtimes
  • 20.
  • 21.
    Modern Dynamic Language •Dynamically typed + Optional Typing • JSR-223 Compliant • No re fl ection; we use InvokeDynamic for everything • DynamicObject Framework • Any Object can be Dynamic! • Type promotions, auto-boxing, auto-casting, coercions • All OO Constructs • Interfaces, super interfaces, and default method implementations • Abstract classes and methods • Static scope and methods on classes and interfaces • Use all-new JDK features and types • Collection of Dynamic Casters and Helpers
  • 22.
  • 23.
    Multi-Parsers • BL-AST • Away to split with the old and bring in the new • JIT or CLI Transpiler • Supported Languages • ColdFusion/CFML (Completed) • COBOL (In Planning) • Groovy (In Planning) • Custom • Incorporate legacy apps/languages and modernize them
  • 24.
  • 25.
    Java Interop • Interactwith Java naturally • Type inference, auto-casting, type promotions, and coercion • Long -> Doubles, Doubles ->Longs, etc • BoxLang Function -> Java Lambdas • You can import, extend, implement, annotate from Java Java Interop
  • 26.
  • 27.
  • 28.
    Scopes // scripting +templates name = “boxlang” // Functions have a local + arguments + surrounding scopes function save( name ){ var transactional = true // pass scopes around saveData( arguments ) } // Treat scopes like maps function getMemento(){ return variables .filter( key, value -> !isCustomFunction( value ) ) } // Classes have three encapsulation scopes Class{ this.publicVar = “public” variables.privateVar = “private” static.field = 123 } • All variables are inside of scopes • Scopes backed by concurrent maps • Each execution context can have different scopes • Scripts • Variables • Functions • Arguments, local, + surrounding scopes • Classes • This (public), variables (private), static • Threads • Local, attributes, thread • Global Scopes + Life-Span • Application, request, server, session, etc • Custom Scopes
  • 29.
    Enhanced Types withMember Methods fruits = [ "apple", "bananas", "pears" ] println( fruits.len() ) data = fruits .append( "orange" ) .filter( item -> item.findNoCase( "an" ) ) .each( item -> println( item ) ) .toJSON() "apple,bananas,pears" .listToArray() .filter( item -> item.findNoCase( "an" ) ) .each( item -> println( item ) ) person = { fname: "box", lname: "lang", age: 1 } person.fullName = () => person.fname & person.lname println( person.fullName() ) • All Java types plus: • Arrays • Structs (ordered, unordered, weak, soft, etc) • Queries (Typed Columns) • DateTime (java.time) • Numeric ( fl oat, short, int, double, bigdecimal) • XML (Enhanced Maps) • All auto-castable, dynamic and functional
  • 30.
    Functions // Java public intsum( int a, int b){ return a + b; } // BoxLang no types function sum( a, b ){ return a + b } // Optional Generic types Numeric function sum( numeric a, numeric b ){ return a + b } // Optional Specific types int function sum( int a, int b ){ return a + b } • All functions `public` by default • All return types `any` by default • All argument types `any` by default • What is any???? • 2 types of type inference • Compile-Time • Runtime • Auto-casting • Type Promotions • Type Coercion
  • 31.
    Functions Arguments // Java Publicvoid repeat( String str, int count, String separator ){} repeat( “hello”, 2, “;” ) // BoxLang repeat( required str, count:5, separator:“;” ){} // Call with defaults repeat( “hello” ) // Call with argument binding myMap = { str : “test”, separator : “,” } repeat( argumentCollection:myMap ) • Required arguments • Default values • Argument binding • Structs (Maps) • Arrays
  • 32.
    Functions Variables // Java inta = 1; String b = “xyz”; Map test = new HashMap(); List<String> myList = new ArrayList(); // BoxLang var a = 1 b = “xyz” map = { age : 0, today : now() } myList = [ “1”, 2, “3”, 4 ] orderedMap = [ age : 0, today : now() ] anotherFunction( local ) • No need to `var` in functions (automatic) • All go into a `local` scope • Inferred variables • Mix types if you want • Struct and array literals • Ordered Struct literals
  • 33.
    Null Coalescence Operator+ Safe Navigation // Java Int getLength( String myString ){ if( myString != null ){ return myString.length() } return 0; } function getLength( myString ){ return myString.length() ?: 0 } Name = event.headers?.name // null Email = user.?getEmail() ?: “nada” • Elvis Operator • Any null expression can be used • Entire left hand expression detection • Safe Navigation .? • Any dereferenceable object • Arrays, structs, objects, etc.
  • 34.
    Variable re-assignments // Java intage = 30; age = “MyAge”; // ERORR // BoxLang age = 30 age = “Thirty Years Old!” final age = 800 • Variable re-assignments • Changing values and types are ok! • Unless you mark them as ` fi nal`
  • 35.
    Variable casting // Java Stringname = (String) myMap.get( key ); Double seconds = 4; Instant.now().toSeconds( seconds.toLongValue() ); // BoxLang name = myMap.get( key ) println( name ) seconds = 4 Instant.now().toSeconds( 4 castAs long ) • Auto-casting detection • Explicit casting if needed • castAs operator
  • 36.
    Unmodifiable Variables myArray =[1,2,3,4] myArray.append( more data ) myAsyncFunction( myArray.toUnmodifiable() ) println( myArray ) myArray.toModifiable().append( “hello” ) • `toUnmodifable()` memember method • `toModifable()` as well • Arrays • Queries • Structs • Even native Java types
  • 37.
    String Interpolation function toString(){ return“Song{id=“#id#”, title=“#title#”, author=“#author#”} } function buildTemplate(){ return ‘{ Id : “#id#”, Title : “#title#”, Author : “#getAuthor(id)#” }’ } • Tired of string concatenation • Not anymore! • Anything between #expression# • “ Or ‘ For big strings with/without line breaks ‘
  • 38.
    Closures & Lambdas& UDFs function toString(){ return “Song{id=“#id#”, title=“#title#”, author=“#author#”} } variables.toString = variables.getString function delayFunction(){ return () => dowork() } runAsync( startWork ) .then( result => computeMoreWork( result ) ) .then( result => sendOrder( result ) ) • Context-aware closures => • Pure functions: lambdas -> • UDFs • Automatic coercion to Java Lambdas • Any signature • Functions are 1st class citizens • Pass them around
  • 39.
    Classes class { Property firstName; PropertylastName; Property numeric age setter=false; } Person = new Person( “Luis”, “Majano”, “45” ) println( person.firstName ) // person.getFirstName() person.toJSON() • Automatic constructor • Automatic toString(), equals() and hashCode() • Automatic getters and setters • Automatic invoke implicit • JSON / YAML / Custom First-Class • toJson()
  • 40.
    $bx - MetaProgramming Person= new Person() writedump( person.$bx.meta ) callJavaClass( person.$bx.$class ) Class{ Property importantData; Variables .$bx .registerChangeListener( “importantData”, (Key, newValue, oldValue) => clearCache() ) } myMap = { name : “Luis”, born : now() } myMap .$bx .registerChangeListener( (key, newValue, oldValue) => doSomething() ) • Available on ANY object • Includes • Metadata • Class Representation • Meta Methods • Change listeners • Inject properties • Remove properties • Inject methods • Remove Method
  • 41.
    Templating Language • Bestof JSP, Blade, GSP, and CFML • Create your own `<bx:MyTag>` easily • Import collections of tags • Use BIFs • Nesting • Data Encapsulation • Much More < b x : o u t p u t > < d i v c l a s s = " b x - d u m p " > < t a b l e c l a s s = " b x - t a b l e S t " t i t l e = " # p o s I n C o d e # " > < c a p t i o n c l a s s = " b x - d h S t " r o l e = " b u t t o n " t a b i n d e x = " 0 " o p e n > < s t r o n g > Q u e r y : # v a r . r e c o r d c o u n t # r o w s < / s t r o n g > < / c a p t i o n > < t h e a d > < t r > < b x : l o o p a r r a y = " # v a r . c o l u m n L i s t . l i s t T o A r r a y ( ) # " i t e m = " c o l u m n " > < t h > # e n c o d e F o r H T M L ( c o l u m n ) # < / t h > < / b x : l o o p > < / t r > < / t h e a d > < t b o d y > < b x : l o o p q u e r y = " # v a r # " i t e m = " r o w " > < t r > < b x : l o o p a r r a y = " # v a r . c o l u m n L i s t . l i s t T o A r r a y ( ) # " i n d e x = " c o l u m n " > < t d > # e n c o d e F o r H T M L ( v a r [ c o l u m n ] ) # < / t d > < / b x : l o o p > < / t r > < / b x : l o o p > < / t b o d y > < / t a b l e > < / d i v > < / b x : o u t p u t >
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
    Enterprise Caching Engine& Aggregator • Enterprise Caching Engine • Extensible • Custom providers • Custom object stores • Listeners • Stats • Powers all internal caching
  • 48.
  • 49.
    Application Framework • Inspiredby Java contexts • Create in fi nite segregated applications in a single deployment by using one class • Application.bx • Life Cycle methods: • applicationStart(), applicationEnd(), sessionStart(), sessionEnd(), requestStart(), request(), requestEnd(), onError(), etc. • Data Sources, class loading, application scopes, security, settings, etc. • Sub applications • Highly con fi gurable and Highly portable
  • 50.
  • 51.
    Scheduling & TaskFramework • Schedulers are portable, fl uent, and human • Write them in BoxLang or Java • Task & Completable Futures framework from the JDK • Access to any executor in Java • Run schedules at the OS • Task Visualizer - Coming Soon (BoxLang Admin, BoxLang Debugger)
  • 52.
  • 53.
    Event-Driven Language • Interceptorsfor the language, and a request • The best way to scale the language • Listen to the entire or speci fi c language life-cycles • Modules can listen/collaborate events • boxAnnounce(), boxAnnounceAsync() : CompletableFuture Event Channels Event Producers Event Event Event Event Consumers Event Event Event
  • 54.
  • 55.
    BoxLang Modules • Inspiredby our HMVC Framework: ColdBox • Not OSGI • Core Runtime with lightest possible footprint • Hierarchical Class Loaders • Taps into the language life-cycle via events • Write them in Java or BoxLang or Both! • Executable as CLI packages • Integrates with Maven/Gradle
  • 56.
    BoxLang Modules FTP/SFTP Email Sending ESAPI UIForms Password Encryption JDBC Image Manipulation PDF Tooling CSV / Spreadsheet AI OSHI YAML
  • 57.
    BoxLang Extends BoxLang In fl uencecore runtime behavior with BIFs, Member Functions, Tags, Interceptors, and More!
  • 58.
  • 59.
    BoxLang Modular ByDesign! • Modular ecosystem, delivered by FORGEBOX (www.forgebox.io) • Write your own functions, components, schedulers, JDBC Drivers, interceptions, and more! • Boundless potential for community contribution and engagement! • Encourage third-party vendors • FORGEBOX eCommerce Marketplace later this year
  • 60.
    But there’s more! •Allows ANY Java language to embed and use BoxLang • Allows ANY JSR-223 compliant language to run in BoxLang • Power of Modules: bx-jython • Full Python runtime embedded into BoxLang • Script, load python classes, modules, etc.
  • 61.
  • 62.
  • 63.
    Tooling Overview • BoxLangIDE • Language Debugger & LSP • Run classes with a main() • Run Scripts • Run / Manage Servers • Code Converters, Code Formatters • Code Quality • Visualizers
  • 64.
    Tooling Overview • CLITools • REPL: CLI code execution • Shebang Scripts: #!/usr/bin/env boxlang • File Runner: Run fi les • Schedule Runner: Run schedulers • Transpiler: Convert CFML to BoxLang • Compiler: BoxLang to Bytecode • Feature Audit: BIF and Tag report usage • Packager: Compile and package your modules or BoxLang apps
  • 65.
  • 66.
    Tested & Documented •TDD/BDD at the core of the language • 6300+ Tests Already • Test not only Java but BoxLang • Native BoxLang Assert constructs built-in • Fully Documented • Generated API Docs • boxlang.ortusbooks.com
  • 67.
    Live long andprosper Dynamic | Modular | Productive Getting Started https://boxlang.ortusbooks.com/
  • 68.
    Getting Started Try Boxlang Anonline code playground built on the MiniServer + AWS Lambda Runtimes. Docs Learn about BoxLang, and contribute to our extensive documentation. Community Join our community and get help, tips and more. x.com/tryboxlang www.boxlang.io linkedin.com/company/tryboxlang facebook.com/tryboxlang youtube.com/ortussolutions
  • 69.