What is Sparkle?
Sparkle is a dynamically typed, interpreted programming language that borrows many syntax features and semantics from other programming languages, but is also very unique in the way it is written and how it behaves.
print "hello world"Sparkle is easy to read
First and foremost, Sparkle is meant to be written in a way that closely resembles how you would read code aloud, with almost no punctuation, making it very accessible to beginners.
let add be function with a, and b as a plus b
print call add with 1, and 2Since Sparkle uses many of the modern programming paradigms, Sparkle can be a very useful tool to teach new learners about programming concepts.
The code may seem very verbose, however that ties into another key philosophical principle of Sparkle: be explicit.
Sparkle's references are clear
By default, Sparkle deep copies values when they are assigned to a variable or passed to a
function. This prevents accidentally modifying the value of another variable. In the case that
you want to get a reference to a value, you can use the by reference keyword, which
in the case of functions, is required on both sides (function definitions and calls).
let fido be object with
name as "Fido", and
age as 5
let best_dog be fido by reference
update best_dog's age to 10Read more about Sparkle's reference values in the References section.
Sparkle's plain English syntax
Since Sparkle removes almost all punctuation from its syntax, plain english words and semantics are being used instead.
Two of the more prominent examples are the Oxford comma , and, and the property
access operator 's, as well as the construction of objects and lists with object with ... and list with ....
let alice be object with name as "Alice", and favorite_fruit as "mango"
print alice's favorite_fruitRead more about the comma in the Oxford Comma section.
Sparkle is strict
Sparkle does not hide magical behaviour under the hood, instead it is always clear what the code is doing behind the scenes.
let lucky_number be "42"
# throws a runtime error
if lucky_number is greater than 20 do
print "it's a big number!"This comparison operator will throw a runtime error because lucky_number is a
string while 20 is a number, and it does not allow operands of different types as Sparkle
has no form of implicit type coercion.
The only exception is the equality operator (is equal to), which will return false if the operands are of different types instead of throwing a runtime error.
Read more about Sparkle's operators in the Operators section.