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

A possible change to syntax: wisp-y lists #69

Open
ahdinosaur opened this issue Oct 2, 2023 · 1 comment
Open

A possible change to syntax: wisp-y lists #69

ahdinosaur opened this issue Oct 2, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ahdinosaur
Copy link
Owner

ahdinosaur commented Oct 2, 2023

Is your feature request related to a problem? Please describe.

With the current Rimu syntax, when you call a function as a block, you pass arguments to the function as a block list.

add
  - 10
  - 20

This is confusing in two ways:

  • At the moment, the arguments to the block function is a block. If it's a list, it's presumed to be a list of arguments. Otherwise a single value is interpreted as the first and only argument. Sometimes you pass a value to the block, and it's a list, and you expect that list to be the first and only argument.
  • The -'s look like minus signs. The visual difference between the dash as a list marker and the dash for a unary negation operator is so small. More difference in the syntax highlighting will help, but still.

Describe the solution you'd like

A new approach would be change how lists are handled.

A list is a bunch of blocks, one after another, on the same level of indentation.

(Or this becomes a new concept: a tuple. And list stays the same.)

So

add
  10
  20

(This is very similar to wisp)

Then the question becomes, what do we do when you want to have two separate lists, one after another?

In wisp, this is handled with the : marker.

So

concat
  : 
    "a"
    "b"
    "c"
  : 
    "d"
    "e"
    "f"

???

Open questions

  • How do we differentiate between a single indented block value and a block list with a single value?
let
  list:
    - "a"
in list
let
  list:
    "a"
in list

I'm not sure yet, so for now will let the back brain have a think. Unless anyone else has thoughts.

How might this be added to Rimu?

What are possible alternatives?

Additional context

@ahdinosaur ahdinosaur added the enhancement New feature or request label Oct 2, 2023
@ahdinosaur ahdinosaur changed the title Another step towards WISP syntax A possible change to syntax: lists Oct 2, 2023
@ahdinosaur ahdinosaur changed the title A possible change to syntax: lists A possible change to syntax: wisp-y lists Oct 2, 2023
@ahdinosaur
Copy link
Owner Author

How do we differentiate between a single indented block value and a block list with a single value?

If we think about this using tuples, then we could say a tuple with one element is the same as that one element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant