There is a (in my opinion) big bug that forces you to use "bad" indenting. Somehow this throws a "no colon found." error
class Main {
public function Main(args) {
print(args[1]);
}
}
but this doesn't
class Main {
public function Main(args) {
print(args[1]);
}
}
//Edit:
Also it looks like it doesn't like lines without any whitespaces at the beginning too.
class Game {
var t = false;
public function Game(test) {
t = test;
}
public function print() {
print(t);
}
}
class Main {
public function Main(args) {
var game = new Game(args[1]);
game.print();
}
}
This throws an ArrayIndexOutOfBoundsException. Is it possible that my build script is the reason?
if not fs.exists"src" then fs.makeDir"src" end
if not fs.exists"out" then fs.makeDir"out" end
local m = fs.open("out/raw.jac","w")
local function recursive(loc)
local list = fs.list(loc)
for k,v in pairs(list) do
if(v ~= "main.jac") then
if(not fs.isDir(fs.combine(loc,v))) then
print("adding "..fs.combine(loc,v))
local h = fs.open(fs.combine(loc,v),"r")
for line in h.readLine do
if(line:sub(1,1) == " ") then
m.write(line:sub((line:find("%S"))))
else
m.write(line)
end
m.write("\n")
end
m.write("\n")
h.close()
else
recursive(fs.combine(loc,v))
end
end
end
end
recursive("src")
print("adding src/main.jac")
local h = fs.open("src/main.jac","r")
for line in h.readLine do
if(line:sub(1,1) == " ") then
m.write(line:sub((line:find("%S"))))
else
m.write(line)
end
m.write("\n")
end
m.close()
shell.run("jac -f out/raw.jac -o out/main.lua")
--fs.delete"out/raw.jac"
It basically takes every file inside "src" and puts them into one file which then is compiled with JaC.
Also, it seems like you messed some terms and that stuff up. Extending, for example, doesn't mean adding the class to the environment. When Class2 extends Class1, Class2 will inherit everything (methods and fields) from Class1. Also, a method isn't a namespace/package/whatever. A method "is" a function.
Now, after complaining (sorry for that); here are some ideas:
- Add interfaces
- Don't make "var <something>;" evaluate to "<something> = nil" because that's basically like not setting it at all.
- Maybe static typing?
- (not sure if that's already possible) function overloading
- The ability to load not-compiled files at runtime (that would allow you to load plug-ins, or stuff like that, without restarting)
- Maybe annotations (like in java)?
- Something like Reflection maybe?
Edited by H4X0RZ, 27 November 2015 - 11:02 PM.