MoonScript & love

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: MoonScript & love

Post by bartbes »

Before I left last week I played around with it, as you may remember I reported a bug because of the lack of decimal point crashing my shader (and thus gpu).
The primary thing I'd like to see (but which will be hard to do) is having 'standard' lua be valid. Ideally moonscript would leave a standard lua file completely intact. (Which means forced whitespace might be an issue.)
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: MoonScript & love

Post by ljdp »

I've had a good read of the reference manual.
At first I got excited, there's lots of changes I like about it, but a few that are deal breakers for me.

For example the inherent flaws of calling functions without parenthesis.
a = x - 10 | local a = x - 10
b = x-10 | local b = x(-10)
c = x -y | local c = x(-y)
I personally do not like function declaration as
func = ->
Perhaps I should fork the project but i've taken a look and don't even know where to start to make changes.
Have you got any tips for customising it?
leafo
Prole
Posts: 28
Joined: Tue Aug 16, 2011 6:01 am

Re: MoonScript & love

Post by leafo »

bartbes wrote:Before I left last week I played around with it, as you may remember I reported a bug because of the lack of decimal point crashing my shader (and thus gpu).
The primary thing I'd like to see (but which will be hard to do) is having 'standard' lua be valid. Ideally moonscript would leave a standard lua file completely intact. (Which means forced whitespace might be an issue.)
Thanks for pointing out the number issue ;).
If I were to support the lua syntax as a baseline then I wouldn't be able to make the syntax as expressive. There are projects that try to enhance the lua language though, check out metalua.
ljdp wrote:Have you got any tips for customising it?
Your issues are just parsing issues. All the parsing in done in here: https://github.com/leafo/moonscript/blo ... e.lua#L257. Lucky for you it's still in lua. The parsing depends on a tool called LPeg, so it might be helpful looking into how it works first.

The parser constructs a tree made of plain old lua tables that is fed into the compiler. As long as you preserve the format of the tree then any changes to the parser will work fine. You can see the format of the tree with the moonc command line tool if you pass the -T flag.
Rad3k
Citizen
Posts: 69
Joined: Mon Aug 08, 2011 12:28 pm

Re: MoonScript & love

Post by Rad3k »

As for the syntax, I feel too that it's not my style. There seem to be a lot of shorthands that allow doing many things with less typing, but important thing to remember is that the code is read much more often than it's written. There are languages that try to be as smart and concise as possible, like Perl or C. But there's a great price they pay for it - readability. In terms of readability, plain Lua seems almost perfect for me. Its minimalistic syntax means you have to learn (or remember) very little to fully understand it, and that's one of things which make it so good.

Anyway, it's a cool project. I've always wanted to create a language myself, but never actually tried doing it ;)
One thing I like about it is that variables are local by default.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: MoonScript & love

Post by Robin »

Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C.
Hahahahaha. Ha.
Help us help you: attach a .love.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MoonScript & love

Post by BlackBulletIV »

Robin wrote:
Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C.
Hahahahaha. Ha.
Ha ha. Um... yeah, C is the exact opposite.
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: MoonScript & love

Post by ljdp »

Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C. But there's a great price they pay for it - readability.
Think he is saying they are not concise, he just worded it in a non concise way.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MoonScript & love

Post by BlackBulletIV »

ljdp wrote:
Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C. But there's a great price they pay for it - readability.
Think he is saying they are not concise, he just worded it in a non concise way.
True, but in the context of the previous sentence:
There seem to be a lot of shorthands that allow doing many things with less typing, but important thing to remember is that the code is read much more often than it's written.
That's definitely not C.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: MoonScript & love

Post by Robin »

Also, there are languages that are smart, concise and readable. Python, for example.
Help us help you: attach a .love.
Rad3k
Citizen
Posts: 69
Joined: Mon Aug 08, 2011 12:28 pm

Re: MoonScript & love

Post by Rad3k »

I agree that C may not be a very good example, but I meant that it encourages writing short and tricky expressions (that's not to say it's a good practice) - all that fancy operators like "++", ",", the fact that assignment is also an operator that can be used in larger expression, and so on. Also, some declarations, like "pointer to function that takes a pointer to pointer to something and returns a pointer to another function, that...", etc. can be expressed with only few asterisks and pairs of parentheses. Isn't that concise? I hope you get the point.
Robin wrote:Also, there are languages that are smart, concise and readable. Python, for example.
I haven't programmed in Python yet, but I'll definitely give it a try.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 56 guests