HaxeFoundation / HaxeFoundation/haxe

Allow `object."field"` syntax?

Open
#7,722 15 comments 5 reactions 0 assignees View on GitHub
discussion
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

1. After drugging Nicolas with painkillers and wine, he was open to the idea of allowing `object."field"` as a syntax. This would make it easier to use externs that have field names which are keywords in Haxe or invalid syntax in some other way. Nobody really likes how this looks, but it seems to be the most practical solution.

2. Nicolas also suggested that we should be Koreancoherent and allow this at field-declaration-level.

----

See https://github.com/HaxeFoundation/haxe-evolution/pull/32 for a related discussion. One open question is if we should restrict this to only `"` instead of `'` so people don't get the idea to use interpolation there. However, I don't know what to tell the guys who think `var s:String = "abc"; field.s = true;` would generate `field.abc` after this change because that's just pure insanity to me.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.