Introducing BoxLang : A new JVM language for productivity and modularity!
ortussolutions
252 views
73 slides
Jun 22, 2024
Slide 1 of 73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
About This Presentation
Just like life, our code must adapt to the ever changing world we live in. From one day coding for the web, to the next for our tablets or APIs or for running serverless applications. Multi-runtime development is the future of coding, the future is to be dynamic. Let us introduce you to BoxLang.
Dy...
Just like life, our code must adapt to the ever changing world we live in. From one day coding for the web, to the next for our tablets or APIs or for running serverless applications. Multi-runtime development is the future of coding, the future is to be dynamic. Let us introduce you to BoxLang.
Dynamic. Modular. Productive.
BoxLang redefines development with its dynamic nature, empowering developers to craft expressive and functional code effortlessly. Its modular architecture prioritizes flexibility, allowing for seamless integration into existing ecosystems.
Interoperability at its Core
With 100% interoperability with Java, BoxLang seamlessly bridges the gap between traditional and modern development paradigms, unlocking new possibilities for innovation and collaboration.
Multi-Runtime
From the tiny 2m operating system binary to running on our pure Java web server, CommandBox, Jakarta EE, AWS Lambda, Microsoft Functions, Web Assembly, Android and more. BoxLang has been designed to enhance and adapt according to it's runnable runtime.
The Fusion of Modernity and Tradition
Experience the fusion of modern features inspired by CFML, Node, Ruby, Kotlin, Java, and Clojure, combined with the familiarity of Java bytecode compilation, making BoxLang a language of choice for forward-thinking developers.
Empowering Transition with Transpiler Support
Transitioning from CFML to BoxLang is seamless with our JIT transpiler, facilitating smooth migration and preserving existing code investments.
Unlocking Creativity with IDE Tools
Unleash your creativity with powerful IDE tools tailored for BoxLang, providing an intuitive development experience and streamlining your workflow. Join us as we embark on a journey to redefine JVM development. Welcome to the era of BoxLang.
Size: 16.21 MB
Language: en
Added: Jun 22, 2024
Slides: 73 pages
Slide Content
The Future is
Dynamic
LED BY
Luis F. Majano
LUIS F. MAJANO
•CEO Ortus Solutions
•Computer Engineer
•Born in El Salvador
•USA since 1995
•Boqueron in progress
•www.ortussolutions.com
@lmajano @ortussolutions
BoxLang is a modular dynamic language for the JVM, aiming
to make your development more productive, expressive,
functional, and available everywhere.
DYNAMIC : MODULAR : PRODUCTIVE
•New language and runtime for the JVM (Inspired by a polyglot team)
•We are in Open Beta, Stable release in Fall
•Scripting and templating language built-in
•Dynamic language with an optional type system
•Modern Java interop with none of the legacy, verbosity, and limitations
•Highly functional, context-aware closures, pure lambdas and more
•Application Framework with many concerns (events, caching, tasks, scheduling, async, etc)
•Small, lightweight, and modular
•Can reuse any Java or ColdFusion/CFML library
•Easy to learn
What is?
Who we are?
Who we are?
•Ortus is a professional open-source company
•Founded in 2006, USA
•Created all the major frameworks for the CFML eco-system
•Package manager, CLI, MVC, DI/AOP, Testing TDD/BDD, etc
•Manage over 300+ libraries
•18 years of servicing different software communities
•!USA, "El Salvador, and # Spain
•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 18 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?
Goals & Vision
Goals & Vision
•Be dynamic, modular, lightweight, and fast
•Be 100% interoperable with Java
•Be modern, functional, and fluent
(Think mixing CFML, Node, Kotlin, Java, and
Clojure)
•Modularity at its core
•Take advantage of the modern JVM
•TDD: Fully tested source code
•Be able to support multiple runtimes
•Have multiple transpilers
CFML -> BoxLang,
Groovy -> BoxLang
X -> BoxLang
•IDE and Tools
•Compete in today’s language environments
Wanna play?
•try.boxlang.io
•Internet playground for BoxLang
•First Production BoxLang application
•Powered by our AWS Lambda Runtime
•Skinnable
•Embeddable on any Site (Soon)
Wanna play?
64MB RAM
600 KB
6.5MB
<Your
Code>
AWS Lambda Runtime
•Every request can fire up its very own Lambda request
•That means:
•We never have to worry about how many instances we have
•We never have to worry about queueing
•We never have to worry about bad actors accessing other people’s files
•We can easily update our Lambda runtime and all instances will be
running new code
•Lambdas have tiers too (staging, production, development)
•Scale up as big or as small as we want
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
•Global Scopes
•Application, request, server, session, etc
Functions
// Java
public int sum( int a, int b){
return a + b;
}
// BoxLang no types
function sum( a, b ){
return a + b
}
// Optional types
Numeric function sum( numeric a, numeric b ){
return a + b
}
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 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
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 `final`
thewolle`tion r vKrC
ifp vKr instKn`eof twA)U`opet > {
thewolle`tion r vKrcget/umpHeysp>C
}
for p key in thewolle`tion > {
{{{
h}xnif []! iswustomTun`tionp vKr[ key ] > 0
htr0
hth
s`operbrowb
`lKssrb}xvOhUtb
vKlignrbtopb
0
xen`oOeTor(!qMp key >x
hth0
htO0
h}xnset Oumpp vKr[ key ] > 0
htO0
htr0
h}xnif0
{{{
}
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
Application Framework
•Inspired by Java contexts
•Create infinite segregated applications in a single deployment by using one file
•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 configurable and Highly portable
Scheduling & Task Framework
Scheduling & Task Framework
•Schedulers are portable, fluent, 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
•Importer from Adobe/Lucee (Soon)
•Task Visualizer (BoxLang Admin, BoxLang Debugger)
Modern Dynamic Language
Modern Dynamic Language
•Dynamically typed just like CFML, but we go further…
•JDK21+ Minimum
•Fully JSR-223 Compliant
•Clojure + BoxLang in development by Sean Corfield
•No reflection, we use InvokeDynamic for everything
•DynamicObject: Any Object can be Dynamic!
•All OO Constructs
•Interfaces, superinterfaces 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
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 files
•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
Tooling - BoxLang IDE
•Modern development flow
•Inline documentation
•Webservers panel
•Works for BL and CFML
•Run BL/CF code directly within VSCode
•Debugger & Language Server
•Committed to ongoing support and development -
new features are on the way!
Tooling - BoxLang Debugger
•Purpose built
•Integrates with VSCode via Microsoft’s DAP
•Can debug both the CLI runtime and web
server
•You’ll never use writeDump() again!
Tooling - BoxLang Language Server
•Built with BoxLang!
•The BoxLang runtime was built with the LSP in mind
•Full access to the BoxLang syntax parser/compiler
•Access to all BoxLang configuration, datasources,
mappings, etc…
•Extensible via BoxLang modules
•Foundational for modern language toolchains
•Intellisense
•Static analysis
•More coming soon…
Java Interop
Java Interop
•Interact with Java naturally
•It’s just part of the language; no more
separation
•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
Java Interop
•Concept of object resolvers: java, bx, custom
•New BoxLang Scripting: MyScript.bxs
•Components become Classes: MyClass.bx
•All bx/bxm/bxs are runnable via the OS
•Classes can have a main() runnable
convention
•BoxLang annotations
Runnable Classes
Multi-Parsers
Multi-Parsers : BoxLang + CFML + ???
•Our way to split with the old and bring in the new
•Transpile CFML into BoxLang
•BoxLang is a NEW clean slate
•Compat module for Adobe/Lucee
•Multi-Step Compiler
•Bx -> Java Source -> ByteCode (DebugMode)
•Bx -> Bytecode (Almost done)
•In Planning
•Groovy to BoxLang
•??? To BoxLang
Choose your path wisely!
.cfc, .cfm
.bx, bxs, bxm
Event-Driven Language
•Interceptors for the language, application, and request
•The best way to scale the language
•Listen to the entire or specific language life-cycles
•Modules can listen/collaborate events
•boxAnnounce(), boxAnnounceAsync() : CompletableFuture
Event Channels
Event Producers
Event
Event
Event
Event Consumers
Event
Event
Event
Tested & Documented
Tested & Documented
•TDD/BDD at the core of the language
•3500+ Tests Already
•Test not only Java but BoxLang
•Native BoxLang Assert constructs built-in
•Fully Documented
•Generated API Docs
•boxlang.ortusbooks.com
Modular Since Birth
Modular Needs
Modern Runtimes Have Various Needs!
( and CFML/PHP/Python/Ruby/Etc paradigms are outdated )
•Web Applications - HTTP Request/Response Data
•Tasks and Queues - Watchers, Event Handling, Async
•Lambda and CLI - fast start and blazing speeds!
•iOS/Android - Low resource footprint, event handling
•Web Assembly – Transpilation and Sandboxing
BoxLang Modules
•Inspired by our HMVC Framework: ColdBox
•Core Runtime with lightest possible footprint
•Taps into the language life-cycle
•Write them in Java or BoxLang or Both!
•Executable as CLI packages
•Integrates with Maven/Gradle
BoxLang Modular By Design!
•Modular ecosystem, delivered by FORGEBOX (www.forgebox.io)
•Core modules for DBMS’, Alternate Runtimes ( e.g. Lambda ), Mail,
Encryption, CFML compatibility and more!
•Write your own functions, components ( tags ), schedulers, JDBC
Drivers, interceptions and more!
•Module has an isolated class loading machinery
•Boundless potential for community contribution and engagement!
•Foment third-party vendors
•FORGEBOX eCommerce Marketplace later this year
BoxLang Extends BoxLang
Influence core runtime behavior with BIFs,
Member Functions, Tags, Interceptors, and More!
But there’s more!
•BoxLang is fully JSR-223 Compliant and Modular
•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 Modules
Take control of your own runtime,
in your own language!