rokucommunity / rokucommunity/brighterscript

Support const within classes

Open
#1,243 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

It would be nice to have class-scoped consts which don't pollute the global scope.

const THIS_IS_GLOBALLY_AVAILABLE = "abc"

class Abc
    const A_LOCALLY_SCOPED_CONST = "def"

    function getMeAValue()
        return A_LOCALLY_SCOPED_CONST
    end function
end class

print THIS_IS_GLOBALLY_AVAILABLE         ' > "abc"
print new Abc().getMeAValue()            ' > "def"
print new Abc().A_LOCALLY_SCOPED_CONST   ' > invalid
print Abc.A_LOCALLY_SCOPED_CONST         ' > invalid (I think)

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

Use the examples in the issue as the behavioral specification. Start by locating the compiler's existing handling for global const declarations and class members, then trace how scope and member visibility are validated. Done means class-scoped consts work inside their class without entering global scope, while the shown external accesses remain invalid.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.