Moonscript Support For Cider In The Future?

After watching the recent Elevate talk at Corona, I decided to check out Moonscript. So far, it looks pretty impressive to me. Any chance you guys would consider adding support for it sometime down the line? I Just had to ask. :wink:

Keep up the good work, Iā€™m loving Cider.

  • Mike [import]uid: 14700 topic_id: 29444 reply_id: 329444[/import]

Hello Mike,

Thanks for letting us know about moonscript. We feel that object oriented programming is a great thing for desktop applications but for mobile apps there is just simply too much overhead added. Check out the benchmark test here :
http://lua-users.org/wiki/ObjectBenchmarkTests

In effect what it says is that directly accessing a table is twice as fast as using the object oriented approach. If performance is a concern for you then please do not use OOP in lua.

Our solution for this would be to give you the best of both worlds, the readability of OOP and the performance of non OOP. The upcoming Glider 1.7 IDE will allow you to define your own virtual classes and even extend virtual classes. The difference is that all this information will be contained in comments and no runtime overhead is added (still direct table access). Here is a typical OOP scenario we purpose:

---  
-- @param x @class number  
-- @param y @class number  
-- @param rotation @class number  
-- @return @class entity  
--  
function createEntity(x,y,rotation)  
 ---@classdef entity  
 local entity = {}  
 entity.x = x;  
 entity.y = y;  
 entity.rotation = rotation;  
 return entity;  
end  
  
--- Ship inherits Entity  
-- @param entity @class entity  
-- @param isEnemy @class boolean  
-- @param weapon @class weapon  
-- @return @class ship  
--  
function createShip(entity, isEnemy, weapon)  
 ---@classdef ship @extends entity  
 local newShip = entity;  
 newShip.isEnemy = isEnemy;  
 newShip.weapon = weapon;  
 function newShip:fire()  
 self.weapon:fire();  
 end   
 return newShip;  
end  

The IDE will give you a warning if you try to do something like:

createShip(1,2,3)  

And the autocomplete knows whats inside each of the objects so you and your team do not have to keep referring to an object reference.

So type safety is maintained, but at the IDE level not at the device level.

Regards,
M.Y. Developers

[import]uid: 55057 topic_id: 29444 reply_id: 118249[/import]

Interesting. Thanks for the explanation. I never considered there would be performance issues with OOP in Lua.

Seeing how there are a lot of discussions revolving around the use of OOP in Lua, this seems like a topic worth covering further outside of this particular thread.

Iā€™d be interested to hear what the guys at Elevate have to say, according to the video theyā€™ve switched over to Moonscript exclusively. For instance, the new Crawlspace library will be written entirely with Moonscript.

Anyhow, seems like there are a lot of interesting features coming up. Looking forward to the new release.

Cheers!

  • Mike [import]uid: 14700 topic_id: 29444 reply_id: 118251[/import]

Iā€™m very interested in what both of you are bringing up here.

Iā€™ve seen the virtual class examples in the Glider video. This looks powerful and being new to scripting/programming am still trying to get my head around that.

@SA Studio, is this Elevate talk something you watched online? Iā€™d be interested in learning about what theyā€™re up to. [import]uid: 105707 topic_id: 29444 reply_id: 118523[/import]

@ EHO,

Hereā€™s the link to the video: http://www.youtube.com/watch?v=h4DxackvV-U&feature=plcp
[import]uid: 14700 topic_id: 29444 reply_id: 118530[/import]

@SAS - that was great to see, thanks for the link.

Iā€™ve done a little research on Moonscript. Lua feels pretty streamlined already so thatā€™s impressive to hear that it is even quicker to work with. I can see that as an asset for their team. Iā€™d like to get to the point where thatā€™s a clear advantage for myself but Iā€™m still ā€œfocusing on the fundamentalsā€ :slight_smile:

There were a lot of other nice take aways from the talk, I recommend it for anyone thatā€™d like to see how a successful team is operating.

Iā€™ve already been focusing on trying to create reusable submodules of codes so I was glad to hear Adam mention that. Iā€™m going to look into using Git, he seemed emphatic about that even for a solo project. I use Google docs nearly exclusively for docs/spreadsheets etc so I guess that makes sense the same way for code.

Back to Glider though, I did notice in one of the videos that Glider supports Git (or atleast Github! not clear on the difference just yet).

The Elevate team seemed very positive about debugging with print statements. I donā€™t have their experience on this type of work but I really feel that a tool like Glider is a paradigm changer with a proper debugger. [import]uid: 105707 topic_id: 29444 reply_id: 118592[/import]