Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Speedie

< >

Speedie is a programming language created in 2022 by Theodore H Smith.

#1306on PLDB 2Years Old
Homepage ยท REPL ยท Twitter ยท Docs ยท Mailing List

"General-purpose modern and clean object-oriented programming language."


main "Hello World!"
Speedie Keywords
#require #expect #error and asm break class continue else elseif false for if is in import module or return require expect error virtual behaviour function syntax syx self true with yield while xor

Language features

Feature Supported Example Token
hasSelfOrThisWord โœ“ self.Remove .remove
Classes โœ“
Zero-based numbering โœ“ printline ["a", "b", "c"][0] // prints "a"
Print() Debugging โœ“ "error 1 here" print
Dispose Blocks Pattern โœ“ using SomeObject for 10 Someobject.dosomework if (random[]>0.5) return // someobject.SyntaxUsingComplete called here // someobject.SyntaxUsingComplete called here too
Strings โœ“ "hello world"
Access Modifiers โœ“ class Person |int| age setter age expect (value >= 0) ("bad age $value set!") .age = value main || p = person() p.age = -1 // calls a function rather than the property || n = p.age // reads the property directly!
Inheritance โœ“ class Person (Animal)
Semantic Indentation โœ“ class Person |string| name
Null โœ“ || msg = message() while if msg != nil "msg exists" else "empty" return msg = nil
Unary Operators โœ“ || x = !0
hasUserDefinedOperators โœ“ class myclass |int| Num operator add (|int| x, |myclass|) return myclass(.num + x) render fs <~ .num main || x = myclass(1) || y = myclass(2) || z = y + x printline z
Operator Overloading โœ“ str = "a" + "b" array <~ str
Function Overloading โœ“ function volume (|float| a, |float|) return a*a*a function volume (|float| r, |float| h, |float|) // volume of a cylinder return math.pi*r*r*h
Single-Type Arrays โœ“ |array of string| s s <~ "abc" // ok s <~ 1 // fail
hasForEachLoops โœ“ || items = [5,6,7,8] for i in items printline i
Iterators โœ“ || items = [5,6,7,8] for i in items printline i
Constructors โœ“ class Foobar |float| x |float| y constructor (|float| r=1, |float| alpha=0) .x = r * alpha.cos .y = r * alpha.sin || a = foobar() || b = foobar(3) || c = foobar(5, M_PI/4)
Binary Literals โœ“ || num = 0b010101
Floats โœ“ || num = 0.0
Hexadecimals โœ“ || num = 0xBEEF
Functions โœ“ function Example (|string| data) file <~ data
Lists โœ“ myList = [1, 2, 3, 4, 5]
Units of Measure โœ“ || time = 1day - 10s || size = 10.2MB
Integers โœ“ pldb = 80766866
Pointers โœ“ || i = 0 || p = &i *p = 1 if (i == 1) "success"
Homoiconicity โœ“ The~entire~Language is (%written in:@Jeebox)
Multiline Strings โœ“ "hello you beauty"
Infix Notation โœ“ seven = 3 + 4
Breakpoints โœ“ debugger
Source Maps โœ“ linkage bannedclasses (file, process, shellstream, archive) // using these classes... even indirectly, will create an error // the error message will show the entire call-chain that reached these classes
Virtual function โœ“ class abc virtual DoSomething (|string| name) behaviour DoSomething printline "hello: $name"
Static Methods โœ“ class abc module function Print "abc" main abc.print
Type Parameters โœ“ function ABC (|string| name)
hasTimestamps โœ“ printline __time_id__
hasMethodOverloading โœ“
hasVoidFunctions โœ“ || x = 123 function abc x = 10
hasGlobalScope โœ“ || x = 123 function abc x = 10
hasFnArguments โœ“ function ABC (|string| name)
canReadCommandLineArgs โœ“ printline app[0]
hasDynamicSizedArrays โœ“ || arr = [] arr <~ "abc"
hasRequiredMainFunction โœ“ main "hello world"
hasStatementTerminatorCharacter โœ“ if x: x++, x*=2, return
hasMemberVariables โœ“ class abc |int| def
hasStringConcatOperator โœ“ || ab = "a" + "b"
Characters โœ“ || char = 'b' if b > 32 "good"
hasEscapeCharacters โœ“ || str = "\01\02\03"
hasForLoops โœ“ while i in 10 "hello: $i"
While Loops โœ“ while true "hello"
Assignment โœ“ name = "John" =
File Imports โœ“ import Proj
MultiLine Comments โœ“ /* multiline comments */ /* */
Comments โœ“ // comment
Garbage Collection โœ“ || msg = message() DoSomethingWith(msg) // msg now gets disposed
Constants โœ“ constants Opened = 1 Closed = 2
hasBreak โœ“ for i in 10 if i > 3: exit printline i // 1,2,3
hasContinue โœ“ for i in 10 if i < 5: continue printline i // 6,7,8,9
Conditionals โœ“
Booleans โœ“ true false
Symbol Tables โœ“
Shebang โœ“ #!/usr/local/bin/spd
Bitwise Operators โœ“ x << y
Message Passing โœ“ || chld = app.fork("ipc_identifier_123", app.rawargs) chld <~ "send message" printline chld.get // receive message
Ternary operators โœ“ while printline (1,0)(random[]>0.5)
Case Insensitive Identifiers โœ“ if "abc".LeNgTh == 3 "cool length"
Case Sensitivity โœ“ || Same = "x" == "X" // same = false
Disk Output โœ“ "helloworld.txt" <~ "Hello, world!\n"
Enums โœ“ flags A B C D // A=1, B=2, C=4, D=8 constants X Y Z W // X=0, Y=1, Z=3, W=4
Structs โœ“ struct Fuel |int| A |byte| B
Type Casting โœ“ || x = message() || y = x|object| // lose type info || z = y|message| // regain it
Module Pattern โœ“ module App function Path (|string|) // return the app's path here
Single Dispatch โœ“ || x = "str" || i = x.find("t")
Increment and decrement operators โœ“ || x = 1 x++ x--
Static Typing โœ“ || x = "Hello" x = 1 // fails to compile... because x is a string
Type Inference โœ“ || x = "Hello" || y = FunctionThatReturnsAString() // is now a string x = 1 // fails to compile y = 2 // fails to compile
Macros โœ“
Magic Getters and Setters โœ“
Default Parameters Pattern โœ“ function Find (|string| pattern, |int| pos=0, |int|)
Unicode Identifers โœ“ class รฉยฉยฉ constructor printline .class.name // "รฉยฉยฉ"
Doc comments โœ“ function Find (|string| pattern, |int| pos=0, |int|) description "Returns the position of pattern in self, starting from 'pos'. If not found, we return -1."
Assert Statements โœ“ class Person |int| age setter age // "expect" will actually add an Error to a list of errors expect (value >= 0) ("bad age $value set!") .age = value main || p = person() p.age = -10 if !stderr.ok "Oof we got some errors"
Polymorphism โœ“ |object| x = somefunction() || y = x.render // returns a string by calling the virtual func "render"
Pipes โœ“
Maps โœ“ || x = ["a":"Apple", "b":"Bird", "c":"Cat"] printline x["b"] // Bird
Partial Application โœ“ main "hello world ${app.args[0]}"
hasReservedWords X || return = 123 || if = 456 if if == 456 return return
Exceptions X
Threads X
Templates X
Multiple Inheritance X
Namespaces X
Octals X
hasTryCatch X || data = "somefile".file.readall if !data stderr.printerrors // prints any file-system error that occurred during .readall
Dynamic Properties X
Regular Expression Syntax Sugar X
Duck Typing X
Manual Memory Management X
Multiple Dispatch X
- Build the next great programming language ยท Add ยท About ยท Search ยท Keywords ยท Livestreams ยท Labs ยท Resources ยท Acknowledgements ยท Part of the World Wide Scroll