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

Splat Operators #257

Open
robcxyz opened this issue Jan 1, 2024 · 0 comments
Open

Splat Operators #257

robcxyz opened this issue Jan 1, 2024 · 0 comments
Labels
implemented proposal Proposal for changes in syntax / behaviour

Comments

@robcxyz
Copy link
Collaborator

robcxyz commented Jan 1, 2024

Splat Operators

Allow splat operators to instantiate hooks - ie a_hook **a_dict or a_hook *a_list

Overview

Could be done with the peg parser proposal

Would be really helpful to support splat syntax like this.

obj<-:

  foo: bar



data:

  foo: baz



call_with_tpl->: obj **{{data}}

call_no_tpl->: obj **data

call_raw->: obj **{'foo':'bar}

With splat, you don't need templating as it is always going to be a reference to a var.

This is most helpful when the data is in another file. For my use case, I want to have a number of files that all have the same schema. In that case, I want to be able to quickly validate if the data is right and not have to run full business logic to see if it is right.

Implementation

  • tokenize the splat operators

  • run macro on output before parsing

@robcxyz robcxyz changed the title tmp Splat Operators Jan 1, 2024
@robcxyz robcxyz added proposal Proposal for changes in syntax / behaviour implemented labels Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
implemented proposal Proposal for changes in syntax / behaviour
Projects
None yet
Development

No branches or pull requests

1 participant