foolang icon indicating copy to clipboard operation
foolang copied to clipboard

association syntax: key -> value

Open nikodemus opened this issue 4 years ago • 0 comments

key -> value --> Association from: key to: value

Implement as operator or syntax?

Pro syntax:

  • Cannot be overridden
  • { a -> x } is a dictionary
  • -> is already syntax in method signatures
  • Support for destructuring possible: dict do: { |a -> b| ... }

Pro operator:

  • less syntax, less special casing
  • {} syntax is already wrought

Current thinking: syntax. Mainly because -> is already syntax instead of an operator.

But why is association syntax needed in the first place? ...that's a really good question. Maybe it's not needed right now after all.

nikodemus avatar Feb 14 '20 10:02 nikodemus