The Future is Dynamic
Luis F. Majano
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
@lmajano.bsky.social
@in/lmajano
@luismajano
@lmajano
こんにづは
àč What?
àč Goals
àč Semantics
àč Features
àč How to start
Agenda
The Rise of the Modular Rebellion
Episode II
1.0.0
1.4.0
BoxLang is a modular dynamic language for the JVM, aiming
to make your development more productive, expressive,
functional, and available everywhere.
DYNAMIC : MODULAR : PRODUCTIVE
‱ Small, lightweight, and modular (<8 MB)
‱ Multi-Runtime & Multi-Parser
‱ 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
‱ Open Source + FREE 🎉
What is it?
Why?
Who we are?
Who we are?
‱ Ortus is a professional open-source and services company since 2006
‱ Polyglot developers
(Java, Groovy, Rust, Python, Scala, CFML, NodeJS, PHP)
‱ Creators of all major frameworks for the ColdFusion/CFML eco-system
‱ CLI, MVC, DI/AOP, CMS, Testing TDD/BDD, Package Manager, etc
‱ Manage over 350+ libraries
‱ 19+ years of servicing di
ff
erent software communities globally
‱ We create tools and custom solutions!
‱ Specialize on custom software and design!
www.ortussolutions.com
‱ 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
BoxLang Has Landed!
‱ 21 Months of Development
‱ 27 Betas, 3 Release Candidates
‱ 4 Minor Updates
‱ 13,355+ Automated Tests
(Core + Modules + Libraries)
‱ 66+ Related Repositories
‱ 36+ Modules
‱ 20+ Contributors
‱ We have only just started!
Key Features
Multi-Runtime Architecture
BoxLang is a modular dynamic language for the JVM that
aims to make development more productive, expressive,
functional, and available everywhere.
Docker Containers
BoxLang Docker Runtimes
‱ CommandBox Container
‱ All of the conventions and goodness you have come to love - now with the
BoxLang Engine!
‱ Java 21 - based
‱ Module installation via server.json conventions
( e.g. onServerInitialInstall, etc )
‱ MiniServer Container
‱ Lightweight and fast BoxLang engine with super-fast starts and compilation
‱ Excellent for debugging or even running one-o
ff
commands
‱ CLI
‱ Run CLI Apps, expressions or a REPL
‱ Use it for scheduling and replace CRON
https://hub.docker.com/r/ortussolutions/boxlang
BoxLang Code Playground : try.boxlang.io
Wanna play?
128MB RAM
600 KB
8 MB
<Your
Code>
try.boxlang.io
‱ First production BoxLang application
‱ Power of Multi-Runtime:
MiniServer + Docker + Lambda
‱ Code Sharing, Linking & Embedding
‱ Error viewer
‱ UI Updates
‱ Keyboard shortcuts
‱ Best way to start with BoxLang!
Cool Stats
‱ Average executions per day: 32,000+
‱ Average execution time: 32ms
‱ Lambdas scale and contract as we need them
Coming Next in Multi-Runtime
Google
Cloud Functions
Azure
Functions
Apache
OpenWhisk
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
100% Java Interop
‱ Interact with Java naturally: NO SEPARATION
‱ You can import, extend, implement, annotate, etc
‱ Execute BoxLang within Java & Java within BoxLang
‱ Concept of customizable object resolvers:
java, bx, custom
‱ Directly import and create any of these classes
‱ Calling 3rd party Java libraries is natural & easy
‱ Import aliases or from @modules
Functional Wrappers
‱ BoxLang BIFs
‱ Java static method references
‱ Java instance method references
‱ Object method invokers
‱ Context-Aware Closures
() => {}
‱ Pure Lambdas
() -> {}
Multi-Parser Architecture
BLAST
Multi-Parsers
‱ BL-AST
‱ A way to split with the old and bring in the new
‱ JIT or CLI Transpiler
‱ Supported Languages
‱ ColdFusion/CFML ( √ )
‱ COBOL (In Planning)
‱ Groovy (In Planning)
‱ Custom
‱ Powers all our tooling
‱ Incorporate legacy apps/languages and modernize them
BoxLang Semantics
File Types
Classes
Scripting
Templating
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 di
ff
erent
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:
‱ Functional 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
Built-in-functions (BIFS)
‱ Headless functions available everywhere
‱ Use core functions
‱ Create or override your own via modules
Built-in-components
‱ Semantic code blocks with or without bodies of execution
‱ More framework capabilities
‱ Build extensive templating language extensions
‱ Just block code executions
Templating Components
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 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
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
No need of “”” like Java.
‘
Closures & Lambdas & UDFs
function toString(){
return “Song{id=“#id#”, title=“#title#”, author=“#author#”}
}
variables.toString = variables.getString
function delayFunction(){
return () => dowork()
}
[1,2,3].map( item -> item + 2 )
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 ) // invokes implicit person.getFirstName()
person.toJSON()
‱ Automatic constructor based on the properties
‱ Automatic toString(), equals() and hashCode()
‱ Automatic getters and setters
‱ Automatic implicit invokers
‱ JSON / YAML / Custom First-Class
‱ toJson() , toYaml()
$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
‱ Write schedulers in BoxLang, Java, or both!
‱ Use in CLI, Web, Lambda, Etc
‱ Global Schedulers
‱ boxlang.json
‱ Application Schedulers
‱ Application.bx
‱ this.schedulers = [ “path.to.Scheduler” ]
Dynamic Interaction
‱ BIFS:
‱ SchedulerStart( path, [force=false] )
‱ SchedulerShutdown( name, [force=false], [timeout=0] )
‱ SchedulerRestart( name, [force=false], [timeout=0] )
‱ SchedulerStats( [name] )
‱ SchedulerList()
‱ SchedulerGet( name )
‱ SchedulerGetAll()
‱ getBoxRuntime().
‱ getAsyncService()
‱ getSchedulerService()
Async Framework
What are virtual threads?
‱ Runtime asynchrony instead of operating system async
‱ No competition
‱ No limitations
‱ We can easily have thousands or even millions of active
virtual threads in the same Java process
‱ They provide greater throughput
‱ They may ( or may not )
fi
nish faster than platform threads,
depending on how they are used
‱ Excellent for I/O operations, avoid for CPU intensive tasks.
BoxLang Virtual Threads!
thread action="run" name=“myThread" virtual=“true"
{
// do single thread stuff
}
thread action="run" name=“myThread" virtual=“true"
{
// do single thread stuff
}
thread action="join" name="myThread,myOtherThread";
BoxLang Virtual Threads!
Or or threadNew() BIF
myThread = threadNew( runnable: ()=>runStuff(), virtual: true )
BoxFuture
‱ Extends on Java’s CompletableFuture
‱ Async
fl
uent pipelines
‱ Threading on steroids
‱ Runs by default on a fork-join-pool or attach to
any executor of your choice.
‱ Great BIFs for async pipelines
‱ futureNew(), futureAll(),
runAsync(), attempt()
Event-Driven Language
Event-Driven Language
‱ Interceptors for the language, application, and 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() : BoxFutures
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
Modules = Runtime Innovation
Not only have we matched CFML Engines
We have gone above and beyond!
www.forgebox.io
JDBC
Derby MySQL MariaDB
SQL
Server
Oracle
Postgre
SQL
Hypersonic Neo4J
+/++
Redis Couchbase
Mongo
AI+
Elastic
PDF+
SFTP
Open-Source
CFML AI CSRF ORM ESAPI FTP
Image Jython Mail OSHI PDF Forms
Markdown Evaluate WDDX YAML
Password
Encryption
Ini
Web
Support
ColdBox TestBox
Command
Box
Module Template
https://github.com/ortus-boxlang/boxlang-module-template-bx
‱ Ready to go template
‱ BoxLang source + Java dependencies
‱ Automatic testing, packaging, and publishing to FORGEBOX
‱ Extend the language, YOUR WAY!
BX-DEMOS && BX-WAFFLE
https://forgebox.io/view/bx-wa
ffl
e
https://github.com/ortus-boxlang/bx-demos
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.
‱ In the works
‱ Graal: Python, Ruby, WASM, and more.
BoxLang Tooling
/bin/bash -c "$(curl -fsSL https:
/
/
install.boxlang.io)"
curl -fsSL https:
/
/
install-bvm.boxlang.io/ | bash
àčManage multiple versions
àč.bvmrc for local versions
àčEasily switch between versions
àčCentralized installations
BoxLang IDE
‱ LSP Runtime
‱ Code Insight + highlighting
‱ Inline docs
‱ MiniServer
‱ Run Code
‱ Built-in debugger!
Tooling Overview
‱ More polished experience
‱ Dedicated toolbar and
panels
‱ Quick access to the
BoxLang community
‱ BoxLang REPL
Tooling - Home Manager
‱ Manage your runtime homes
‱ Clear class
fi
les
‱ Open home folder
‱ Easily manage con
fi
guration
‱ View log
fi
les
‱ Manage and install modules
Tooling - Version Manager
‱ Install and manage di
ff
erent versions
‱ Easily run CLI scripts and MiniServers with
speci
fi
c BoxLang versions
‱ A game changer for testing for regressions
Boxlang Debugger
‱ Breakpoints
‱ OS, MiniServer or CommandBox
‱ Pause Threads
‱ Change variables at runtime
‱ Watch variable expressions
‱ Conditional Breakpoints
‱ Live debug any BoxLang Enabled Server
Where are we going?
5 Year Roadmap https://boxlang.ortusbooks.com/readme/release-history
‱ 1 Major per year
‱ Train leaves the station every year
‱ 1 Minor last week of the month
‱ Patches a-la-carte
‱ Security ASAP
Release Cycles
‱ BoxLang Community (Free & Open Source) Apache 2
‱ Two Commercial Subscriptions
‱ BoxLang +
‱ BoxLang + +
‱ No restrictions on:
‱ Cores
‱ SaaS
‱ Multi-Domain
‱ How much money you make
Professional Open Source
boxlang.io/plans
learn.boxlang.io
Cloud Servers
https://boxlang.io/hosting
Clever Cloud
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
Questions?
THANK YOU

BoxLang in Japan - The Future is Dynamic.pdf

  • 1.
    The Future isDynamic Luis F. Majano
  • 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 @lmajano.bsky.social @in/lmajano @luismajano @lmajano こんにづは
  • 3.
    àč What? àč Goals àčSemantics àč Features àč How to start Agenda
  • 4.
    The Rise ofthe Modular Rebellion Episode II
  • 5.
  • 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.
    ‱ Small, lightweight,and modular (<8 MB) ‱ Multi-Runtime & Multi-Parser ‱ 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 ‱ Open Source + FREE 🎉 What is it?
  • 8.
  • 9.
  • 10.
    Who we are? ‱Ortus is a professional open-source and services company since 2006 ‱ Polyglot developers (Java, Groovy, Rust, Python, Scala, CFML, NodeJS, PHP) ‱ Creators of all major frameworks for the ColdFusion/CFML eco-system ‱ CLI, MVC, DI/AOP, CMS, Testing TDD/BDD, Package Manager, etc ‱ Manage over 350+ libraries ‱ 19+ years of servicing di ff erent software communities globally ‱ We create tools and custom solutions! ‱ Specialize on custom software and design! www.ortussolutions.com
  • 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.
    BoxLang Has Landed! ‱21 Months of Development ‱ 27 Betas, 3 Release Candidates ‱ 4 Minor Updates ‱ 13,355+ Automated Tests (Core + Modules + Libraries) ‱ 66+ Related Repositories ‱ 36+ Modules ‱ 20+ Contributors ‱ We have only just started!
  • 13.
  • 14.
  • 15.
    BoxLang is amodular dynamic language for the JVM that aims to make development more productive, expressive, functional, and available everywhere.
  • 16.
  • 17.
    BoxLang Docker Runtimes ‱CommandBox Container ‱ All of the conventions and goodness you have come to love - now with the BoxLang Engine! ‱ Java 21 - based ‱ Module installation via server.json conventions ( e.g. onServerInitialInstall, etc ) ‱ MiniServer Container ‱ Lightweight and fast BoxLang engine with super-fast starts and compilation ‱ Excellent for debugging or even running one-o ff commands ‱ CLI ‱ Run CLI Apps, expressions or a REPL ‱ Use it for scheduling and replace CRON https://hub.docker.com/r/ortussolutions/boxlang
  • 18.
    BoxLang Code Playground: try.boxlang.io
  • 19.
    Wanna play? 128MB RAM 600KB 8 MB <Your Code>
  • 20.
    try.boxlang.io ‱ First productionBoxLang application ‱ Power of Multi-Runtime: MiniServer + Docker + Lambda ‱ Code Sharing, Linking & Embedding ‱ Error viewer ‱ UI Updates ‱ Keyboard shortcuts ‱ Best way to start with BoxLang!
  • 21.
    Cool Stats ‱ Averageexecutions per day: 32,000+ ‱ Average execution time: 32ms ‱ Lambdas scale and contract as we need them
  • 22.
    Coming Next inMulti-Runtime Google Cloud Functions Azure Functions Apache OpenWhisk
  • 23.
  • 24.
    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
  • 25.
    100% Java Interop ‱Interact with Java naturally: NO SEPARATION ‱ You can import, extend, implement, annotate, etc ‱ Execute BoxLang within Java & Java within BoxLang ‱ Concept of customizable object resolvers: java, bx, custom ‱ Directly import and create any of these classes ‱ Calling 3rd party Java libraries is natural & easy ‱ Import aliases or from @modules
  • 26.
    Functional Wrappers ‱ BoxLangBIFs ‱ Java static method references ‱ Java instance method references ‱ Object method invokers ‱ Context-Aware Closures () => {} ‱ Pure Lambdas () -> {}
  • 27.
  • 28.
  • 29.
    Multi-Parsers ‱ BL-AST ‱ Away to split with the old and bring in the new ‱ JIT or CLI Transpiler ‱ Supported Languages ‱ ColdFusion/CFML ( √ ) ‱ COBOL (In Planning) ‱ Groovy (In Planning) ‱ Custom ‱ Powers all our tooling ‱ Incorporate legacy apps/languages and modernize them
  • 30.
  • 31.
  • 32.
    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 di ff erent 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
  • 33.
    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: ‱ Functional 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
  • 34.
    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
  • 35.
    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
  • 36.
    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
  • 37.
    Built-in-functions (BIFS) ‱ Headlessfunctions available everywhere ‱ Use core functions ‱ Create or override your own via modules
  • 38.
    Built-in-components ‱ Semantic codeblocks with or without bodies of execution ‱ More framework capabilities ‱ Build extensive templating language extensions ‱ Just block code executions
  • 39.
  • 40.
    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.
  • 41.
    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
  • 42.
    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
  • 43.
    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 No need of “”” like Java. ‘
  • 44.
    Closures & Lambdas& UDFs function toString(){ return “Song{id=“#id#”, title=“#title#”, author=“#author#”} } variables.toString = variables.getString function delayFunction(){ return () => dowork() } [1,2,3].map( item -> item + 2 ) 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
  • 45.
    Classes class { property firstName; propertylastName; property numeric age setter=false; } Person = new Person( “Luis”, “Majano”, “45” ) println( person.firstName ) // invokes implicit person.getFirstName() person.toJSON() ‱ Automatic constructor based on the properties ‱ Automatic toString(), equals() and hashCode() ‱ Automatic getters and setters ‱ Automatic implicit invokers ‱ JSON / YAML / Custom First-Class ‱ toJson() , toYaml()
  • 46.
    $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
  • 47.
    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 >
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
    Enterprise Caching Engine& Aggregator ‱ Enterprise Caching Engine ‱ Extensible ‱ Custom providers ‱ Custom object stores ‱ Listeners ‱ Stats ‱ Powers all internal caching
  • 54.
  • 55.
    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
  • 56.
  • 57.
    Scheduling & TaskFramework ‱ Write schedulers in BoxLang, Java, or both! ‱ Use in CLI, Web, Lambda, Etc ‱ Global Schedulers ‱ boxlang.json ‱ Application Schedulers ‱ Application.bx ‱ this.schedulers = [ “path.to.Scheduler” ]
  • 58.
    Dynamic Interaction ‱ BIFS: ‱SchedulerStart( path, [force=false] ) ‱ SchedulerShutdown( name, [force=false], [timeout=0] ) ‱ SchedulerRestart( name, [force=false], [timeout=0] ) ‱ SchedulerStats( [name] ) ‱ SchedulerList() ‱ SchedulerGet( name ) ‱ SchedulerGetAll() ‱ getBoxRuntime(). ‱ getAsyncService() ‱ getSchedulerService()
  • 59.
  • 61.
    What are virtualthreads? ‱ Runtime asynchrony instead of operating system async ‱ No competition ‱ No limitations ‱ We can easily have thousands or even millions of active virtual threads in the same Java process ‱ They provide greater throughput ‱ They may ( or may not ) fi nish faster than platform threads, depending on how they are used ‱ Excellent for I/O operations, avoid for CPU intensive tasks.
  • 62.
    BoxLang Virtual Threads! threadaction="run" name=“myThread" virtual=“true" { // do single thread stuff } thread action="run" name=“myThread" virtual=“true" { // do single thread stuff } thread action="join" name="myThread,myOtherThread";
  • 63.
    BoxLang Virtual Threads! Oror threadNew() BIF myThread = threadNew( runnable: ()=>runStuff(), virtual: true )
  • 64.
    BoxFuture ‱ Extends onJava’s CompletableFuture ‱ Async fl uent pipelines ‱ Threading on steroids ‱ Runs by default on a fork-join-pool or attach to any executor of your choice. ‱ Great BIFs for async pipelines ‱ futureNew(), futureAll(), runAsync(), attempt()
  • 65.
  • 66.
    Event-Driven Language ‱ Interceptorsfor the language, application, and 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() : BoxFutures Event Channels Event Producers Event Event Event Event Consumers Event Event Event
  • 67.
  • 68.
    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
  • 69.
    Modules = RuntimeInnovation Not only have we matched CFML Engines We have gone above and beyond! www.forgebox.io JDBC Derby MySQL MariaDB SQL Server Oracle Postgre SQL Hypersonic Neo4J +/++ Redis Couchbase Mongo AI+ Elastic PDF+ SFTP Open-Source CFML AI CSRF ORM ESAPI FTP Image Jython Mail OSHI PDF Forms Markdown Evaluate WDDX YAML Password Encryption Ini Web Support ColdBox TestBox Command Box
  • 70.
    Module Template https://github.com/ortus-boxlang/boxlang-module-template-bx ‱ Readyto go template ‱ BoxLang source + Java dependencies ‱ Automatic testing, packaging, and publishing to FORGEBOX ‱ Extend the language, YOUR WAY!
  • 71.
  • 72.
    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. ‱ In the works ‱ Graal: Python, Ruby, WASM, and more.
  • 73.
  • 74.
    /bin/bash -c "$(curl-fsSL https: / / install.boxlang.io)"
  • 75.
    curl -fsSL https: / / install-bvm.boxlang.io/| bash àčManage multiple versions àč.bvmrc for local versions àčEasily switch between versions àčCentralized installations
  • 76.
    BoxLang IDE ‱ LSPRuntime ‱ Code Insight + highlighting ‱ Inline docs ‱ MiniServer ‱ Run Code ‱ Built-in debugger!
  • 77.
    Tooling Overview ‱ Morepolished experience ‱ Dedicated toolbar and panels ‱ Quick access to the BoxLang community ‱ BoxLang REPL
  • 78.
    Tooling - HomeManager ‱ Manage your runtime homes ‱ Clear class fi les ‱ Open home folder ‱ Easily manage con fi guration ‱ View log fi les ‱ Manage and install modules
  • 79.
    Tooling - VersionManager ‱ Install and manage di ff erent versions ‱ Easily run CLI scripts and MiniServers with speci fi c BoxLang versions ‱ A game changer for testing for regressions
  • 80.
    Boxlang Debugger ‱ Breakpoints ‱OS, MiniServer or CommandBox ‱ Pause Threads ‱ Change variables at runtime ‱ Watch variable expressions ‱ Conditional Breakpoints ‱ Live debug any BoxLang Enabled Server
  • 81.
  • 82.
    5 Year Roadmaphttps://boxlang.ortusbooks.com/readme/release-history
  • 83.
    ‱ 1 Majorper year ‱ Train leaves the station every year ‱ 1 Minor last week of the month ‱ Patches a-la-carte ‱ Security ASAP Release Cycles
  • 84.
    ‱ BoxLang Community(Free & Open Source) Apache 2 ‱ Two Commercial Subscriptions ‱ BoxLang + ‱ BoxLang + + ‱ No restrictions on: ‱ Cores ‱ SaaS ‱ Multi-Domain ‱ How much money you make Professional Open Source boxlang.io/plans
  • 85.
  • 86.
  • 87.
    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
  • 88.