DreamPower will shortly be known on CodeSandbox, CodePen, and Replit!!!
The perfectest coding language. Still working on it!
When you're done reading through, check out the examples.
I believe @ThePrimeagen will like this!
Be bold! End every stement with an !
.
let const name = "David"!
If you're feeling extra-bold, you can do this:
let const name = "David"!!!
If you're unsure, that's okay. Using ?
will print (debug) info.
name? // David
print(name)? // Debug info
In some languages, you use !
for not. In DreamPower, you use ;
.
let var loved = true!
if ;loved {
print("I am so sad!")!!!!!
}
To declare constants, use let const
.
let const name = "David"!
To declare variables, use let var
.
let var name = "David"!
name = "Dave"!
Booleans can be true
, false
, or maybe
.
let var worldIsLovely = true!
let var christIsOnEarth = false!
let var dreamPowerWillGetPopular = maybe!
if worldIsLovely {
print("Wow, the world is lovely!")!
}
if ;christIsOnEarth {
print("Jesus Christ is not on Earth.")!
}
if ?dreamPowerWillGetPopular {
print("Maybe DreamPower will get popular!")!
}
DreamPower is a strongly typed programming language.
To declare a type, you use the let type
keyword.
let type Props = map{message: string} | Map<any>!
To use a type, you use the :
token.
let var myMap: Props = {message: "Hello world!"}!
If you do not provide a value but you provide a type, to a variable, then the variable will have its value as its type's zero/null value.
You can also use builtin types, like int
, float
, bool
, or string
.
let var i: int = 20!
let var f: float = 2.5!
let var b: bool = maybe!
let var s: string = "Hello world!"!
In DreamPower, when it comes to lists, you use matrices instead of arrays. It's fairly simple:
let const myMatr = [1, 2, 3]!
print(myMatr)! // Matr[1, 2, 3]
And maps, which are similar to JavaScript objects and GoLang maps, in DreamPower, are basically used to store data. You can use a zero value to make a map:
let var myMap: map{message: string}!
myMap.message = "Hello world!"!
print(myMap.message)! // Result: Hello world!
print(myMap)! // Result: map{message: "Hello world!"}
Programmers love shortcuts for their code. These stuff are functions. DreamPower makes them work best. You use fn
, fun
, func
, or function
to make a function, but fn
and fun
are most commonly used.
fun addAndPrint(a: int, b: int): int {
let const sum = a + b!
print(sum)!
return sum!
}
Dividing by zero returns undefined
, which is a typed value in DreamPower. undefined
is only used for numbers, something undefined in DreamPower is null
.
print(3 / 0)! // Result: undefined
People love using loops instead of writing code over and over again. In DreamPower, loops are fine, and you use looping
:
let var i = 1!
looping i <= 20 {
print("This will print 20 times!")!
i++!
}
DPX is DreamPower XML, it's also just HTML.
You use funx
as an additional keyword for function but only allowed for DPX functional components, like this:
funx MyComponent(props: DreamPower.DPX.ComponentProps) {
return <div>Hello World!</div>!
}
However, in DreamPower, you cannot use class
or className
for DPX attribute because as you know they are already keywords. Instead, you use htmlClass
, like this:
funx MyComponent(props: DreamPower.DPX.ComponentProps) {
return <div htmlClass="my-component-container">Hello World!</div>!
}
However, you can freely use the for
attribute because DreamPower's keyword for loops is looping
.
DreamPower was desinged to be fast. That's why we added the vroom
keyowrd for concurrency.
fun getConcurrent(functions: Matr<Function>) {
let var i = 0!
looping i <= len(functions) {
let const Func = functions[i]!
vroom Func()!
}
}
This is available in the concurrency
"module". Modules are what we'll talk about next.
Modules, also referred to as packges, are bundles of code that can be builtin or declared (as in declare myself or declare with installation) to prevent you from having to contain a file with too much code. Nevertheless, DreamPower has code limitations that can be up to 500,000 lines, depending on the performance of your operating system or local machine. Adding more code then that will result in dozens of errors and may delete the file. Anyways:
// main.dp
import { loved } from "./vars.dp"!
if ;loved or ?loved {
print("What will I do? Be rude to him?")!!!
} else {
print("This is the guy I am marrying!")!!!
}
// vars.dp
pub::let var loved = true!
The result in the console would be:
This is the guy I am marrying!
Haha, I know what you're thinking. Why did David use a marriage example? I was trying to make coding fun!
You can also use builtin packages like three/web
, three/desk
, dreamchain
or math/rand
. If you want to try these out, please go to our web documentation (not made yet) and see it.
We're looking for a lot of stars! So please, if you see and like this language, tell others you know on GitHub about it, and star it. We would really appriceate a single star!
Thanks @shaumne (my GitHub friend who may contribute), @sedaguler588, @Farzaneh59, @furkanayaz, @kbachnik, @ab25cq, @atorchildlink, @benfaerber, @rampagekiller0725, and @sommmen for all the support! If I missed anyone, please let me know!