The Sharp programming language
Sharp is an open source a modern object-oriented programming language that aims to bridge the gap between modern expressive programming paradigms and strictly typed rigid languages like Java and C#. My goal is to provide the usefulness of an object oriented programming language, while holding the simplicity of an expressive programming language without having to sacrifice performance.
mod app;
def main() {
print("hello, world!");
}
Considering that sharp is an Object oriented programming language it is immediately familiar to Java and C++ developers.
mod app;
def foo(object[] args) : var {
print("I ran a thread!");
}
def main() {
new Thread("foo", foo).start();
}
Sharp makes for loops easy by allowing the programmer to not have to care about creating iteration tracking variables unless absolutely necessary.
mod app;
def main() {
for < 10:
println("im looping!");
}
the above illustration creates an anonymous for loop that does the tracking or loop iteration for you
Sharp has a multi-language inspired syntax taking the beauty of languages such as JavaScript, python, Java, and C#. While expressing it in a more concise way. sharp supports anonymous functions that make it easy to abstract away blocks of code without the need to have thousands of external functions in your code.
mod app;
def main() {
var num, x;
for(var i = 0; i < 100; i++) {
num = num*Math.sqrt(num)/2;
x++;
}
fn someComputation = use -> num: {
// we are in a completly seperate code space
// this code space knows nothing of the x variable
// unless explicitly passed in
print("num = " + num);
};
}
Sharp does not force you to be object oriented if you don’‘t want to like other languages force you to be. Of course some things done such as creating threads require some state to be stored and persist through the lifetime of your application; However Sharp allows you to be either more expressive or object-oriented or both.
Check out the snake game I made In Sharp under the link: https://github.com/AndroDevcd/Sharp/blob/remastered/projects/snake/main.sharp
%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% %
% %
% %
% %
% %
% %
% <ooo %
% o ooo %
%x o o %
% oooooo %
% %
% %
% %
% %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%
score: 140
commands: up, down, left, right, Q: quit, p: pause
p