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

Self Hook #258

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

Self Hook #258

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

Comments

@robcxyz
Copy link
Collaborator

robcxyz commented Jan 1, 2024

Self Hook

Create a special self hook to reference the hook's methods during parsing

Overview

MyHook<-:

  foo: bar

  a_method:

    bar: bar

  exec:

    get_a_method->: self a_method --merge

call->: MyHook --foo baz
self<-:

  foo:

    type: str

    default: baz

#  ...
  • Same as before but the instantiated type is now the default

self as Hook

If self was a hook it would be simple to implement but the issue is we need to know that we are inside a hook from the context, otherwise if self is called, within that hook it will not know that it is in fact executing within another hook. For instance:

Foo<-:

  bar: baz

  Method<-: ...

  exec:

    do->: self Method

Inside do we don't know that we are within an exec of another hook. If we did know that, we could easily build the hook

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

No branches or pull requests

1 participant