Skip to content

Short syntax thing or instance variable #283

@joente

Description

@joente

Is your feature request related to a problem? Please describe.
When creating a Type instance or a new thing, we quite often write something like:

Person{name: name};

where we need to write name twice, once as key and the other for the var which we use.

Describe the solution you'd like
I would like a syntax so we could write name only once using the syntax:

Person{name:};

I would like to add the : since it otherwise becomes confusing and (almost) incompatible with a block { .. } and/or enum {name}.

Multiple short and long syntax must also work, for example:

{
  color:,
  size:,
  description: 'This is just an example'
}

Describe alternatives you've considered
I've considered removing the : but require a , if only one variable will be used. This however is way more complex to parse. I've also considered to start with a : followed by the name, thus: Person{:name}. I think however that the suggested option is better, especially when using a combination of short and long syntax.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions