Roo is a cross platform interpreted, object-oriented, dynamically typed scripting language. It runs on macOS, Windows and Linux (including the Raspberry Pi). It’s written in Xojo and it's designed to be used both from the command line as a productivity tool and also as a replacement for Xojo’s built-in scripting language (XojoScript) in your own Xojo projects. Why replace XojoScript? Well, Roo has a far richer standard library and provides access to very useful built-in classes like hases (a.k.a. dictionaries) and regular expressions.
Roo's syntax is inspired by Python's and does away with excessive curly braces. Block scoping is determined by its indentation level. Indentation is determined by tabs only (no confusion with spaces). Semicolons are optional.
# A comment. 12 # Inline comment. 100.54 3e10 4.5e-10 0xffaa00 0b1001 0o2345 var a = 100 var b = "Double quoted string" var c = 'Single quoted string' var d = "Single 'quotes' inside" var e = 'Double "quotes" inside' # Operators. # +, -, /, *, %, &, =>, !, ^, : , # ., =, ==, >, <>, <, >=, <=, -= # +=, /=, *=, %=, |, &, >>, >> # Keywords. # and, break, class, def, else, exit, for, if # module, not, or, pass, quit, require, return # self, static, super, var, while def test(a, b): pass class Doctor < Person: def init(name): pass module Sonos: class Player: pass print("Test") if a.length > 100: pass if name.starts_with?("Dr")
Start learning Roo by reading the documentation.
Inspired by Ruby, absolutely everything in Roo is an object. Even text and number literals:
9.sqrt # 3 "hello world".capitalise # "HELLO WORLD" 35.5.integer? # False
Learn more about Roo's object system.
As an object-oriented language, Roo supports classes with single inheritance. It also supports modules and static methods. Classes can have fields added to them dynamically at any time.
class Person: def init(name): self.name = name def greet(who): print("Hello " + who) class Doctor < Person: def init(name): super.init(name) def diagnose(who): print("OK " + who + ", let's see what's wrong with you") var dave = Person("Dave") dave.greet("Tony") # "Hello Tony" var garry = Doctor("Garry") garry.diagnose("Steven") # "OK Steven, let's see what's wrong with you"
Learn more about Roo's classes.
I love Xojo and create all the time with it. I found that I often wanted to offer the ability to my users to extend the functionality of my apps. Xojo provides XojoScript for this purpose but it’s underpowered, particularly its inability to pass objects between a script and its context. Roo is easy to integrate into Xojo apps to provide your end users with more power to write plugins and other extensions. All you need to do is drop in Roo's classes and you’re good to go.