Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta language ? #3

Closed
tst2005 opened this issue Jan 10, 2019 · 1 comment
Closed

Meta language ? #3

tst2005 opened this issue Jan 10, 2019 · 1 comment

Comments

@tst2005
Copy link
Contributor

tst2005 commented Jan 10, 2019

Hello,

I wonder what is your goal for the ljs project.

  • for the fun / experimental ?
  • for production ?

IMHO, the Lua syntax is not really sexy at all but I'm using it without problem.
I'm still looking about alternative, like moonscript, etc.

I thought (like your project) to using different language syntaxes to execute on the Lua VM (in fact in the LuaJIT one).

There is some case where the usual way to code is complicated to make abstraction.

For sample,
How to you deal with the first array's index is 1 in Lua VS 0 in JS ?

local cars = {"Saab", "Volvo", "BMW"}
print(cars[1]=="Saab")

VS

var cars = new Array("Saab", "Volvo", "BMW");
print(vars[0]=="Saab")

Regards,

@mingodad
Copy link
Owner

Hello TsT !
My idea is to use it in production.
The case of 1/0 base index is still there LJS/LjsJIT is 1 based index right now, because this way it's easy to port existing Lua code for testing, in fact I'm finishing now Openresty and Torch, this way I can verify that my changes do not make the language buggy.
As a second stage probably a 0 index based version will come to light, I'm thinking how that can be implemented in a way to make easy to have mainly extensions usable on both Lua/LuaJIT and LJS/LjsJIT .
Probably having some macros/inline functions to hide the conversion in C/Lua code:

#define LUA_ADJUST_INDEX(x)  ...
...
for(int i=LUA_ADJUST_INDEX(1), last_i = LUA_ADJUST_INDEX(len_of_object); i < last_i; ++i) {...}

@r-lyeh r-lyeh mentioned this issue Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants