IppClub / IppClub/YueScript

'local'-keyword has unexpected behavior

Open
#194 10 comments 0 reactions 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

Currently, local behaves in an unexpected way. For example, this YueScript code ...

local x = "y"

... compiles to the following Lua code:

local x
x = "y"

I would appreciate it if this was changed to behave the same as it does in Lua. If someone is going out of their way to explicitly declare the variable in the same statement, then there's likely a reason for it. If someone really wanted to pre-declare the variable, they could just do that instead.

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

Start by reproducing the issue's YueScript example and comparing its generated Lua with Lua's handling of an explicitly initialized local. Trace the compiler path for local declarations; done means local x = "y" emits the equivalent single Lua declaration and related behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.