Modifying MoonSharp Syntax to be more c like?
Shadowblitz16 opened this issue · comments
is it possible to allows us to modify the syntax of moonsharp?
these are some things I kinda wanted..
more operators
+=
-=
*=
/=
%=
^=
force c style blocks
function isNil(obj)
{
if obj ~= nil return true
return false
}
force c style parens
for (i,v in ipairs(list)) do
end
if (test == 0) then
end
force c style end of statement
local vec2=
{
x = 0;
y = 0;
};
switch statements
switch (test)
{
case 0: return 1 break
case 1: return 0 break
}
all functions are coroutines
function test() then
yield(1);
end
test()
new operator
local obj =
{
x = 0,
y = 0
}
obj1 = new obj
obj2 = new obj
c style inheritance
local vec2 =
{
x = 0,
y = 0
}
local vec3 : vec2 =
{
z = 0
}
better operator overloading
local vec2 =
{
function __call(x,y) --doesn't requires metatables
{
return {self.x=x, self.y=y}
}
}
these could be implemented as some sort of macro or just have flags for them when you use moonsharp.
the reason I suggest these is because I find it very hard to read and use lua however it is one of my favorite scripting languages.
if needed these could be bunched together as a single flag and called lua++
I know this can confuse people used to lua but it also helps people more used to c while keeping most of what lua is about.
and if it is a single flag set my the developer it could be treated as a subset of lua or a different scripting language
You could certainly fork MoonSharp and use it as the basis for prototyping a new Lua-derived programming language. If you're familiar with C# then it's very achievable as all the ground-work is in place. However, the existing MoonSharp Github project probably isn't the best place to orchestrate the design of a new language.
ok thankyou sorry for the inconvenience