Slide 1

Slide 1 text

The Future is Dynamic LED BY Luis F. Majano

Slide 2

Slide 2 text

LUIS F. MAJANO • CEO Ortus Solutions • Computer Engineer • Born in El Salvador • USA since 1995 • Boqueron in progress • www.ortussolutions.com @lmajano @ortussolutions

Slide 3

Slide 3 text

BoxLang is a modular dynamic language for the JVM, aiming to make your development more productive, expressive, functional, and available everywhere. DYNAMIC : MODULAR : PRODUCTIVE

Slide 4

Slide 4 text

• 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?

Slide 5

Slide 5 text

Who we are?

Slide 6

Slide 6 text

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 di ff erent software communities • 🇺🇸USA, 🇸🇻El Salvador, and 🇪🇸 Spain

Slide 7

Slide 7 text

• 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?

Slide 8

Slide 8 text

Goals & Vision

Slide 9

Slide 9 text

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, 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

Slide 10

Slide 10 text

Key Features

Slide 11

Slide 11 text

Multi-Runtime Architecture

Slide 12

Slide 12 text

Multi-Runtime Architecture Any OS Docker MiniServer CommandBox Servlet Lambda Azure Android WebAssembly Coming Soon Coming Soon Coming Soon 6 MB 9 MB 6 MB 15 MB 15 MB 160 MB

Slide 13

Slide 13 text

AWS Lambda Runtime

Slide 14

Slide 14 text

try.boxlang.io

Slide 15

Slide 15 text

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)

Slide 16

Slide 16 text

Wanna play? 64MB RAM 600 KB 6.5MB

Slide 17

Slide 17 text

AWS Lambda Runtime • Every request can fi re 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 fi les • 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

Slide 18

Slide 18 text

BoxLang Semantics

Slide 19

Slide 19 text

File Types

Slide 20

Slide 20 text

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 • Global Scopes • Application, request, server, session, etc

Slide 21

Slide 21 text

Enhanced Types with Member functions 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 (1 based index - Human Based) • 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 • Fluent and Functional via member functions

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Functions Variables // Java int a = 1; String b = “xyz”; Map test = new HashMap(); List 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

Slide 25

Slide 25 text

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`

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

Variable Immutability/Mutability myArray = [1,2,3,4] myArray.append( more data ) myAsyncFunction( myArray.toImmutable() ) println( myArray ) myArray.toMutable().append( “hello” ) • `toImmutable()` memember method • `toMutable()` as well • Arrays • Queries • Structs

Slide 28

Slide 28 text

Null Coalescene Operator ?: // Java Int getLength( String myString ){ if( myString != null ){ return myString.length() } return 0; } function getLength( myString ){ return myString.length() ?: 0 } • Any falsey expression can be used • Entire left hand expression detection

Slide 29

Slide 29 text

String Interpolation function toString(){ return “Song{id=“#id#”, title=“#title#”, author=“#author#”} } function buildTemplate(){ return “””{ Id : “#id#”, Title : “#title#”, Author : “#getAuthor(id)#” }“”” } myMap = { id: createUUID(), title: “title”, author: “Luis” } buildTemplate( argumentCollection : myMap ) • Tired of string concatenation • Not anymore! • Anything between #expression# • “”” For big strings! • Combine with scopes to do bindings!

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

Classes in Java are verbose

Slide 32

Slide 32 text

Ok, really verbose

Slide 33

Slide 33 text

Classes Ok, mega verbose!

Slide 34

Slide 34 text

Classes Class{ Property firstName; Property lastName; Property numeric age setter=false; } Person = new Person( “Luis”, “Majano”, “45” ) println( person.getFirstName() ) person.toJSON() • Automatic constructor • Automatic toString(), equals() and hashCode() • Automatic getters and setters • Automatic toJson()

Slide 35

Slide 35 text

$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

Slide 36

Slide 36 text

Templating Language • Made CFML famous • Best of JSP, Blade and ColdFusion/CFML • Create your own `` 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 >

Slide 37

Slide 37 text

< b x : i m p o r t p r e f i x = "j a v a " n a m e = "o r t u s . b o x l a n g . r u n t i m e . t y p e s . e x c e p t i o n s . E x c e p t i o n U t i l "> < ! - - - T h r o w a b l e t e m p l a t e - - - > < b x : o u t p u t > < b x : s e t i s B X E r r o r = v a r i n s t a n c e o f "o r t u s . b o x l a n g . r u n t i m e . t y p e s . e x c e p t i o n s . B o x L a n g E x c e p t i o n "> < t a b l e b o r d e r = ' 1 ' c e l l p a d d i n g = ' 3 ' c e l l s p a c i n g = ' 0 ' t i t l e = "# p o s I n C o d e # "> < b x : i f i s B X E r r o r > < t r > < t h c o l s p a n = "2 "> E r r o r : # e n c o d e F o r H T M L ( v a r . g e t T y p e ( ) ) # < / t h > < / t r > < b x : e l s e > < t r > < t h c o l s p a n = "2 "> E r r o r : # v a r . g e t C l a s s ( ) . g e t N a m e ( ) # < / t h > < / t r > < / b x : i f > < t r > < t d > M e s s a g e < / t d > < t d > # e n c o d e F o r H T M L ( v a r . g e t M e s s a g e ( ) ) # < / t d > < / t r > < b x : i f i s B X E r r o r > < t r > < t d > D e t a i l < / t d > < t d > # e n c o d e F o r H T M L ( v a r . g e t D e t a i l ( ) ) # < / t d > < / t r > < t r > < t d > T a g C o n g t e x t < / t d > < t d > < b x : d u m p v a r = "# v a r . g e t T a g C o n t e x t ( ) # "> < / t d > < / t r > < / b x : i f > < b x : i f v a r . g e t C a u s e ( ) ! = n u l l > < t r > < t d > C a u s e < / t d > < t d > < b x : d u m p v a r = "# v a r . g e t C a u s e ( ) # "> < / t d > < / t r > < / b x : i f > < t r > < t d > S t a c k T r a c e < / t d > < t d > < p r e > # e n c o d e F o r H T M L ( E x c e p t i o n U t i l . g e t S t a c k T r a c e A s S t r i n g ( v a r ) ) # < / p r e > < / t d > < / t r > < / t a b l e > < / b x : o u t p u t >

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

BoxLang Framework

Slide 40

Slide 40 text

BoxLang Framework RUNTIME Application Service Async Service Cache Service Component Service Datasource Service Function Service Interceptor Service Module Service Scheduler Service

Slide 41

Slide 41 text

Enterprise Caching Engine & Aggregator

Slide 42

Slide 42 text

Enterprise Caching Engine & Aggregator • Inspired by CacheBox • Enterprise Caching Engine • Extensible • Custom providers • Custom object stores • Listeners • Stats • Powers all internal caching

Slide 43

Slide 43 text

Application Framework

Slide 44

Slide 44 text

Application Framework • Inspired by Java contexts • Create in fi nite segregated applications in a single deployment by using one fi le • 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

Slide 45

Slide 45 text

Scheduling & Task Framework

Slide 46

Slide 46 text

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 • Importer from Adobe/Lucee (Soon) • Task Visualizer (BoxLang Admin, BoxLang Debugger)

Slide 47

Slide 47 text

Modern Dynamic Language

Slide 48

Slide 48 text

Modern Dynamic Language • Dynamically typed just like CFML, but we go further… • JDK21+ Minimum • Fully JSR-223 Compliant • Clojure + BoxLang in development by Sean Cor fi eld • No re fl ection, 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

Slide 49

Slide 49 text

BoxLang Tooling

Slide 50

Slide 50 text

Tooling Overview

Slide 51

Slide 51 text

Tooling Overview • BoxLang IDE • Language Debugger & LSP • Run classes with a main() • Run Scripts • Run / Manage Servers • Code Converters, Code Formatters • Code Quality • Visualizers

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

Tooling - BoxLang IDE • Modern development fl ow • 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!

Slide 54

Slide 54 text

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!

Slide 55

Slide 55 text

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 con fi guration, datasources, mappings, etc… • Extensible via BoxLang modules • Foundational for modern language toolchains • Intellisense • Static analysis • More coming soon…

Slide 56

Slide 56 text

Java Interop

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Multi-Parsers

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

BL-AST • AST Visitors for custom tooling • Feature Audits • Transpiler • Pretty Printer • Code Quality • getClassMetadata()

Slide 62

Slide 62 text

Event-Driven Language

Slide 63

Slide 63 text

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() : CompletableFuture Event Channels Event Producers Event Event Event Event Consumers Event Event Event

Slide 64

Slide 64 text

Tested & Documented

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

Modular Since Birth

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

BoxLang Extends BoxLang In fl uence core runtime behavior with BIFs, 
 Member Functions, Tags, Interceptors, and More!

Slide 71

Slide 71 text

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.

Slide 72

Slide 72 text

BoxLang Modules Take control of your own runtime, in your own language!

Slide 73

Slide 73 text

THANK YOU