IppClub / IppClub/YueScript

Can YUE support empty block and some logical falsity?

Open
#69 21 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

Can YUE support empty block and some logical falsity?

  • I hope Yue can support empty block code act as place holder for TODO and comments.
    Maybe we can use keyword 'pass' like python for this task.
    EX:
if os == 'win'
  print 'great'
else if os == 'mac'
  pass
else
  -- TODO: implement
  pass
  • I have some personal problem with lua 'FALSITY'.
    Well... when work with some other languages and yue/lua at same time, I have a tenacity to make this error: "nil and false are the only false values".
    It would nice if lua behave with 0 and "" like other languages. I known I can write a function or macro to achieve this. But this make code inconvenience and look ugly.
    Can Yue introduce a real 'FALSITY' logical operator do the dirty stuff. EX:
if !val
  print 'FALSE'
if !!val
  print 'TRUE'

==> Lua

if not val or val == 0 or val == "" then
  print 'FALSE'
end
-- if val and val ~= 0 and val ~= "" then
-- or
if not (not val or val == 0 or val == "") then
  print 'TRUE'
end
  • Support nullish coalescing operator like other modern languages.
    Maybe we can use '??' op like javascript, C#. EX:
valA = nullValue ?? "default for A"
valB ??= "default for B"

==> Lua

local valA
if nullValue ~= nil then
  valA = "default for A"
end
local valB
if valB ~= nil then
  valB = "default for B"
end

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 in the issue. Start by reviewing the 21-comment discussion to determine whether empty blocks, altered falsiness, and nullish coalescing are all in scope and what semantics are accepted. Done means an agreed feature scope and corresponding compiler behavior, with tests covering each accepted construct.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.