rokucommunity / rokucommunity/brighterscript

feature request: case SENSITIVE object literals

Open
#723 2 comments 0 reactions 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

according to https://developer.roku.com/en-gb/docs/references/brightscript/language/expressions-variables-types.md

[...] an AssociativeArray literal like this will also create the entry in lower case:
aa = { NewKey: 55 }
To create mixed case keys, use the array operator or the ifAssociativeArray.AddReplace method:
aa["NewKey"] = 55

this means that when I wrote

foo = { aKey: "aValue" }
print(foo.keys()[0] = "aKey")

will print false

this behavior is... "unusual", IMHO, and I would like to have bsc to treat object literals in a way to force case sensitivity.
for example, the expression foo = { aKey: "aValue" } in .bs could be converted in something like

foo = {}
foo["aKey"] = "aValue"
foo.setModeCaseSensitive() ' this is just an additional enforcement on what I think is a "sane" behavior

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 with the Roku BrightScript language documentation linked in the issue and the object-literal example showing that keys are lowercased. Then trace how bsc handles { aKey: "aValue" } expressions; done means defining and implementing a clear case-sensitive behavior for object-literal keys, with coverage for the shown keys() example.

Written by the indexing model from the issue text.

Assessment

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.