XlegoXJoin Date: 2008-06-16 Post Count: 14955 |
"What would be the use of making it strictly typed?
It would be a lot more similar to .. strictly typed languages, yes. But it wouldn't be faster, if anything it'd be a lot slower."
No, if anything it would be a lot faster, In fact, you wouldn't even need to compile it to Lua-assembly code to get a lot of those benefits. Stuff you could do while still having it completely translated to normal text Lua code:
1- Dead-Code elimination
It's possible to tell in a lot more cases where there's dead-code (code that will never execute) if you have a statically typed language, especially if it has const-correctness.
EG:
local activate_spawns = false
--never gets changed in the code
if activate_spawns then
...
end
2- Function Inlining and Folding
It's also possible to tell when a given function dispatch will always be to the same code, and just inline it to avoid ever doing the function call in the first place so long as the code in the function is sufficiently short.
EG:
function square(num)
return num*num
end
--...
local a = square(5) --> Can be calculated at compile-time
local b = square(a) --> Can also be calculated at compile-time
local c = square(num_from_user()) --> can be optimized to:
local __temp = num_from_user()
local c = __temp*__temp --> no function-call needed
3- Object unpacking
It's also possible to unpack an object if you can tell that the whole object won't actually be needed:
function doPrint(a oftype SomeObject)
print(a.Value)
end
function doStuff()
doPrint(new SomeObject{ Value = 5 })
end
doStuff()
Can be optimized to:
print(5)
Through fully unpacking the object and inlining the function calls.
Basically, the bottom line is that you won't get faster than pure Lua code. BUT you will get faster then high-quality well abstracted code: That is you can write your code in a really neat clean way and still have the same performance that you would if you had written it in as efficient a way as possible, it being really messy and convoluted as a result. |
|
booingJoin Date: 2009-05-04 Post Count: 6594 |
:P Oysi, you are a master scripter, but you have no creativity... nob have u even THOUGHT about string-embedding? Made the embedding surrounded in %type%-s. For an examle:
a=5
"My age divided by 2 is %i%a%i%." >> "My age divided by 2 is 5." |
|
booingJoin Date: 2009-05-04 Post Count: 6594 |
hmm not %i%a%i%, how would you tell a from a string or something else? Make that %i%var:a%i% instead :P |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
SNC, putting it in parenthesis would definitely make it possible. Thanks! =3
Also, I never planned on making it strictly typed. And seeing as mossy typed is a lot easier for newbies and harbor, ill go with that. |
|
MrNicNacJoin Date: 2008-08-29 Post Count: 28554 |
"And the speed is equal to a normal lua script that would do exactly the same, minus the time it takes for it to parse. Which is like 0.001 for a 1k lined script or something. xD"
Really now... that could be useful to help me learn syntax of other languages. |
|
SDuke524Join Date: 2008-07-29 Post Count: 6267 |
I think if it had some databse functions like mysql then it would be worth learning. |
|
miloguyJoin Date: 2009-12-19 Post Count: 7702 |
MAKE JAVASCRIPT INTERPRETER IN ROBLOX LUA |
|
aboy5643Join Date: 2010-10-08 Post Count: 5458 |
Are you making custom libraries perhaps?? |
|
|
Wow. I made something like that a couple months ago! Rather simple, really. However, yours is probably going to be more efficient than mine. |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
@Merlin
I've made something very similar before, too. But then I was too focused on making a new language. Here I'm basically modding the syntax, by doing fancy string manipulation stuff. =3
Which means that everything that works in normal lua, will also work in this ... language. |
|
OBFJoin Date: 2009-09-29 Post Count: 10709 |
Lua++, lol.
Anyways, when will it be released? Sounds epic. |
|
aboy5643Join Date: 2010-10-08 Post Count: 5458 |
Lua#
That would be fail :P |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
"Anyways, when will it be released? Sounds epic."
I'm not sure, yet. Thanks, though. =P
I'll probably release it in a few days. =)
And I'm planning on calling it: cLua, or rather CLua. Short for Custom Lua. |
|
OBFJoin Date: 2009-09-29 Post Count: 10709 |
Cool. Source code too? |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
Aye. Though I need more ideas for it.
Btw, I just noticed a major typo in my first post here. xD
"I will not be able to manipulate the syntax in which you code. =P"
I will _ONLY_ be able to manipulate the syntax in which you code... |
|
OBFJoin Date: 2009-09-29 Post Count: 10709 |
What's your current syntax for functions, tables and events? |
|
|
Mine was very basic, I just replaced some of the syntax and made comments. For instance, the function data type was declared f_funcName(). |
|
SDuke524Join Date: 2008-07-29 Post Count: 6267 |
will it have database functions? That would make it epic.
results=CLua_query("SELECT name FROM table WHERE id='" .. i .. "'")
|
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
@OBF
You didn't have to add events in your question.
Object.Event:connect(Func)
Object (Table)
.Event (Table)
:connect (Function)
Func (Function)
Heh, anyway. Same syntax as lua there. Though if you had something else in mind... |
|
FriazaJoin Date: 2008-12-26 Post Count: 6229 |
Ohh I see hints of Dream Maker (DM) in there, it sounds like a cool idea. |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
Any more ideas? |
|
|
How the heck do you get the machine to read your code and know what to do?! |
|
|
Someone should make a totally simple language. Example:
Give.jakinator90.chocolate.upon.entering. Lol, I know, HARD. |
|
|
@xlegox
wouldnt it make the code faster than if you wrote the same thing in normal lua?
Because you could optimize it more :P |
|
VarpJoin Date: 2009-11-18 Post Count: 5333 |
"I will _ONLY_ be able to manipulate the syntax in which you code..."
Ah. I was confused previously.
"wouldnt it make the code faster than if you wrote the same thing in normal lua?"
It takes less skill to get more speed. |
|