IppClub / IppClub/YueScript

Some improvements to MoonPlus that worth to consider?

Open
#12 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
613
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Just think about some improvements to MoonPlus that worth to consider:

  1. Exist OP + "with" keyword. Let look at this code:
with io.open(test.txt, "w")?
  \write "hello"
  \close!

Compile to:

local _with_0 = (io.open(test.txt, "w") ~= nil)
_with_0:write("hello")
_with_0:clode()
return _with_0

Is it intended behaviour or maybe it should be:

local _with_0 = io.open(test.txt, "w")
if _with_0 ~= nil then
  _with_0:write("hello")
  _with_0:close()
end
return _with_0
  1. Support chain function call over new lines. With would be nice to look at and edit code.
    EX:
path = chain path
  \strip(" ")
  \strip("\\")
  \strip("/")
  \replace("\\", "/")
  \replace(" +", "_")
  \replace("-", "_")
  \lower()
  \title()
  \toString()
  1. It would be good if MoonPlus have options to keep full blank lines and full line comments.
    It would make generated lua file more easy to look at, work with, debug and make sense to distribute lua file.
    More over many Lua IDE like EmmyLua support editor autocomplete with meta data fetch from line comments.
    This feature would be a great addition to MoonPlus over old MoonScript.

  2. Support inline many statements separated with ";" because sometime keep many things on the same line many reason, especially when work with anonymous function.

  3. Macro feature is really good. And I have been thinking if something similar can do with operations. The idea is that can add other modern operations to lua like: power(**), floor division (//), bit and(&), bit or(|).
    EX:
    Instead of write:
    local res = bit32.band(a, b)
    We can write:
    res = a | b
    Or let symbol . or & or whatever to denote macro operations like:
    res = a .| b
    Or use normal macro string
    res = a $and b

  4. DSL support. Lua support it but MoonScript lost it.
    I write some dynamic scripts dialogue include game flow framework. DSL is very good at it kind of task but not play nice with MoonScript.
    It would be great it MoonPlus somehow make it but I know it would be kind of difficult.

  5. Until ... Repeat
    Not really need it but Lua have it. MoonScript have it for completion mapping to Lua.

What you thinks?
Many thanks and regards!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or compiler entry points are named. Review the seven proposed language changes and the with-expression examples first, then clarify which single feature is in scope and how its generated Lua should behave before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.