Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • ion ion
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 84
    • Issues 84
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-os
  • ionion
  • Issues
  • #956
Closed
Open
Created Apr 21, 2020 by matu3ba@matu3baMaintainer

RFC Deprecate `;` in control flow outside of single liners aka "all or nothing"-rule

Not sure, if it is worth it to break things. However I think it is bad practice the least.

feat: Simplification of ;
; means in the context of loops start and end body
; means in the context of matches start of body (which always has a newline)
; means in the context of assignments linear separation
It would be easier, if ; has only an effect on the current line and would also simplify the language analysis+readability.

BREAKING CHANGE: Deprecate code with ; inside logical control statements, which are not not single liners. These are currently not used in the book, but may work from time to time #869 .

perf: impact

performance
After discussion no big performance is expected.

usability Users are used to annotate

# the end statements is "overhead", but otherwise we need python indentation
for an in @split("a b c")
  echo $an
end

in additional 3 other ways:

# have fun identifying all endings of the loop in nested cases
for a1 in @split("a b c")
  echo $a1; end
for a in @split("a b c"); echo $a
end
# if this is allowed, then also
for a in @split("a b c"); for a in @split("a b c"); echo $a
end
end
# => inconsistent rule 
**# all or nothing**
for a in @split("a b c"); echo $a; end
match $a:
   case [ "a" "b" "c" ]; echo "yay"
end
**# but also **
match $a: case "a"; echo "boo"; case "b"; echo "boo"; case "c"; "boo"; end

maintainability marginally better

reason: Inconsistency is bad for learning and setting up things and code review for shell code

behavior of bash/dash/zsh/fish/oil bash supports the syntax with ; at arbitrary positions
dash supports the syntax with ; at arbitrary positions
zsh supports the syntax with ; at arbitrary positions
fish supports the syntax with ; at arbitrary positions
oil shell does not link a syntax definition or book, the help is poor and the man page broken

Edited Apr 22, 2020 by matu3ba
Assignee
Assign to
Time tracking