Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload infix operators for table operations #42

Open
darrylabbate opened this issue Dec 3, 2022 · 0 comments
Open

Overload infix operators for table operations #42

darrylabbate opened this issue Dec 3, 2022 · 0 comments
Labels
experimental Purely experimental ideas (for now) feature New feature or request language Language features/requests
Milestone

Comments

@darrylabbate
Copy link
Member

darrylabbate commented Dec 3, 2022

Set operations:

  • &: intersection
  • |: union
  • ^: symmetric difference
  • -: difference

List operations:

  • +: append (concatenate?)

This goes slightly against some of the original design philosophy of the language - data types can be very freely coerced, but the operations themselves have always been consistent in the types of values they yield. This is why a separate concatenation operator exists; so that x + y will always yield a numeric result and x # y will always yield a string, regardless of whether x or y is a number or a string. As opposed to overloading + for string concatenation like many other languages.

However, I feel OK with making exceptions when both operands are tables, since the result of any of these operations would otherwise be completely useless.

@darrylabbate darrylabbate added feature New feature or request language Language features/requests experimental Purely experimental ideas (for now) labels Dec 3, 2022
@darrylabbate darrylabbate added this to the Riff 0.5 milestone Dec 9, 2022
@darrylabbate darrylabbate changed the title Overload infix operators for set operations on tables Overload infix operators for table operations Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental Purely experimental ideas (for now) feature New feature or request language Language features/requests
Projects
Status: No status
Development

No branches or pull requests

1 participant