Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

No way to access string fields on objects #200

@reynir

Description

@reynir

For example it's impossible to access the 'foo/bar' field on the following object

let a = { 'foo/bar' : 42 } // It's impossible to access a['foo/bar']

In general you can't access the fields if you

  1. Don't know the key in advance, or
  2. The key isn't a valid identifier (ex. 'foo/bar')

A "workaround" is to use eval:

let a = { 'foo/bar' : 42 }
let x = eval 'a["foo/bar"]'

It's not pretty and requires that the identifiers are "stable".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions