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.)
MoonScript & love
Re: MoonScript & love
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.
Have you got any tips for customising it?
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.
I personally do not like function declaration asa = x - 10 | local a = x - 10
b = x-10 | local b = x(-10)
c = x -y | local c = x(-y)
Perhaps I should fork the project but i've taken a look and don't even know where to start to make changes.func = ->
Have you got any tips for customising it?
Re: MoonScript & love
Thanks for pointing out the number issue .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.)
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.
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.ljdp wrote:Have you got any tips for customising it?
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.
Re: MoonScript & love
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.
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.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: MoonScript & love
Hahahahaha. Ha.Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C.
Help us help you: attach a .love.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: MoonScript & love
Ha ha. Um... yeah, C is the exact opposite.Robin wrote:Hahahahaha. Ha.Rad3k wrote:There are languages that try to be as smart and concise as possible, like Perl or C.
Re: MoonScript & love
Think he is saying they are not concise, he just worded it in a non concise way.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.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: MoonScript & love
True, but in the context of the previous sentence:ljdp wrote:Think he is saying they are not concise, he just worded it in a non concise way.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.
That's definitely not C.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.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: MoonScript & love
Also, there are languages that are smart, concise and readable. Python, for example.
Help us help you: attach a .love.
Re: MoonScript & love
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.
I haven't programmed in Python yet, but I'll definitely give it a try.Robin wrote:Also, there are languages that are smart, concise and readable. Python, for example.
Who is online
Users browsing this forum: Ahrefs [Bot] and 56 guests