Clue icon indicating copy to clipboard operation
Clue copied to clipboard

Compiler feature request

Open progmboy opened this issue 2 years ago • 10 comments

When I use Clue to generate lua, I found that the original comments are discarded, can the compiler add an option to keep the comments.

progmboy avatar Oct 20 '22 02:10 progmboy

Is it really helpful and necessary? As I see it, Clue is like C code and Lua machine code, you need the comments in the original code (so inside the Clue files) but when you compile it you don't need them anymore (so inside Lua files). Another point is that right now the compiler does change the code, rearrange some thing, add new variables and etc... In the future it may do even some kind of optimization and thus making the original comments obsolete in the Lua code (although this does happen even now).

Enn3Developer avatar Oct 20 '22 04:10 Enn3Developer

It could be done but I'm not sure if it would be useful, the output Lua code doesn't prioritize readability and can seem messy when compiling many files. I think it may be faster to read the output to identify the line in the Clue code, and continue debugging from there. (3.X may add better debugging too)

Maiori44 avatar Oct 20 '22 05:10 Maiori44

Is it really helpful and necessary? As I see it, Clue is like C code and Lua machine code, you need the comments in the original code (so inside the Clue files) but when you compile it you don't need them anymore (so inside Lua files). Another point is that right now the compiler does change the code, rearrange some thing, add new variables and etc... In the future it may do even some kind of optimization and thus making the original comments obsolete in the Lua code (although this does happen even now).

Yes, I agree, but it is useful in the following scenarios, such as we have multiple people developing lua. Not everyone has the hope of using Clue then convert to Lua, but some people want to use Clue. In order to ensure the unity of the code base language, we can let those who like to use Clue compile Lua code with comments.

It is true that some annotations can complicate the implementation:

like. some comments in expression or some comments in block

match expr {
    1 => {
        ...
    }
    2 || 3 => /*this is comments*/ {
        ...
    }
}

progmboy avatar Oct 20 '22 07:10 progmboy

I think in this case it is better to develop a library in Clue with all the comments and everything else and from Lua use the compiled version of that library

Enn3Developer avatar Oct 20 '22 08:10 Enn3Developer

What should be done of this issue?

Maiori44 avatar Nov 18 '22 17:11 Maiori44

After a few days of using clue a lot in the project, I feel that this feature is useless if we implement our own language server and debug server. Our project team has reached an agreement to use clue for development.

In addition, we found that some other features may be useful:

  1. Language server (3.0?)
  2. Debug server (we use luapanda to debug now)
  3. Documentation generator (generate documentation from comments, like luadoc or typedoc)

progmboy avatar Nov 28 '22 05:11 progmboy

After a few days of using clue a lot in the project, I feel that this feature is useless if we implement our own language server and debug server. Our project team has reached an agreement to use clue for development.

In addition, we found that some other features may be useful:

  1. Language server (3.0?)
  2. Debug server (we use luapanda to debug now)
  3. Documentation generator (generate documentation from comments, like luadoc or typedoc)

we are considering to make a language server in the future but we haven’t really discussed the about the rest. Also a language sever would require changes to how the parser works.

Markos-Th09 avatar Nov 28 '22 08:11 Markos-Th09

The documentation generator could be added in 3.1

For the language server...I'm planning to do a beta before 4.0

Maiori44 avatar Nov 28 '22 09:11 Maiori44

Some initial progress is being made on the language server, but it's still mostly planning for now.

Maiori44 avatar Feb 21 '23 09:02 Maiori44

The documentation generator on the other hand will have to be delayed as 3.1 became unexpectedly too big

Maiori44 avatar Feb 21 '23 10:02 Maiori44