Ticket #29 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

namespace-qualified property names in object initializers

Reported by: dherman Assigned to: anonymous
Type: enhancement Priority: major
Milestone: Component: Proposals
Version: 4 Keywords:
Cc: igor@mir2.org

Description (last modified by dherman) (diff)

Allow object initializers to namespace-qualify their properties.

Example:

public var dict = {
    ns::a: 1,
    ns::"@b": 2,
    toString: function() "<<dict>>"
}

This uses the syntax of namespace-qualified constant names (see #30)

Attachments

Change History

Changed 2 years ago by dherman

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::["a"]: 1, ns::["b"]: 2, toString: function() "dict" } }}} to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::"a": 1, ns::"b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by brendan

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::"a": 1, ns::"b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30) to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by dherman

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30) to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" }; }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by dherman

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" }; }}} This uses the syntax of namespace-qualified constant names (see #30) to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by dherman

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30) to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" }; }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by dherman

  • description changed from Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" }; }}} This uses the syntax of namespace-qualified constant names (see #30) to Allow object initializers to namespace-qualify their properties. Example: {{{ #!js public var dict = { ns::a: 1, ns::"@b": 2, toString: function() "<<dict>>" } }}} This uses the syntax of namespace-qualified constant names (see #30)

Changed 2 years ago by ibukanov

  • cc set to igor@mir2.org

If es4 allows

obj = { ns::"str": 1 },

should we also allow

obj.ns::"str"

and even

obj."str" ?

Similarly, for the symmetry with

obj = { 1: "text" },

what about

obj = { ns::1: "text"}; obj.ns::1 = "text"; obj.1 = "text"

That is, the idea here is to allow in name.<property> and in name.ns::<property> for <property> to be anything that is allowed in the object initializer as a property name.

Changed 2 years ago by jeffdyer

  • status changed from new to closed
  • resolution set to fixed

I second this proposal, including Igor's extended name syntax.

Hearing no objections...I say it's accepted.

Note: See TracTickets for help on using tickets.