Lua Notes

nelua complaints
Login

nelua complaints

  1. Alpha status
  2. Misleading error messages
  3. Lua-ism and minimal-ism. An unavoidable matter of taste.

Alpha status

nelua.io is very clear about this: "Nelua is currently under development and in alpha status"

Other ways that nelua seems unpolished or inactive:

  1. broken roadmap link on nelua.io (in the same paragraph with the previous quote)
  2. sparse library documentation, and occasional gaps in the overview
  3. unimplemented but emphasized features: tables, 'any' type
  4. not having features expected of new languages: a curl|sh installer, a package system, etc.
  5. not having books, presence on Q&A and challenge sites, etc.
  6. the discord can be pretty quiet

I think Nelua's much more useful than the above suggests, but these are all reasons for someone to conclude that they'd save time by not looking into Nelua just yet.

Misleading error messages

Consider:

global Ball = @record {
    x: int32,
    y: int32,
    sizeX: usize,
    sizeY: usize
    vx: boolean,
    vy: boolean
}

error:

err.nelua:6:5: syntax error: unclosed curly brace, did you forget a `}`?
    vx: boolean,
    ^

The problem is that the previous line lacks a comma, but the error has you looking at braces.

Remarks on this:

this is not simple to improve, because how the parser was crafted, I feel like putting effort on improving this is not worth, also I feel that this could be improved outside Nelua compiler with more tooling, like a VSCode linter plugin for Nelua, with better errors, but I am not going to work on it either

Error messages from Lua (that is, the preprocessor) are also generally inscrutable. An inherited problem from Lua is that the free syntax means that a missing end will only be noticed at the end of the file.

Is that so bad?

It's a matter of personal standards. Some languages have famously good errors (Elm, Rust) and some have famously bad errors (OCaml - everything is a "syntax error", Nim - everything is "bad indentation"), and metaprogramming generally has poor errors (C++ - every template error is 500 lines long), and young languages generally have bad error messages.

The response was above was enough to lose Nelua a contributor, and the only point of this page is to catalog points of dissatisfaction.

I think that, once a compiler is committed to failing with an error, it's an appropriate time to load a bunch of extra libraries to reconsider the code and try and provide as useful an error as possible. This could include style linting that would complain about missing commas because good style requires a comma even if the compiler strictly doesn't. This also means that, while I agree the errors are poor, I'm not pessimistic about them remaining poor.

also...

print('hello'
print('how are you?')
$ python example.py
  File ".../example.py", line 2
    print('how are you?')
    ^
SyntaxError: invalid syntax

I don't like it when Nelua doesn't point to a line at all, but pointing near the line is good enough for Python.