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

Implicit trigger if no other members #12

Open
kiip1 opened this issue Jul 1, 2022 · 1 comment
Open

Implicit trigger if no other members #12

kiip1 opened this issue Jul 1, 2022 · 1 comment

Comments

@kiip1
Copy link

kiip1 commented Jul 1, 2022

Is your feature request related to a problem? Please describe.
Currently all events, functions, etc require a trigger: section to execute the code.
Even if the trigger: section is the only member, it's still required.

Describe the solution you'd like
Make trigger: implicit if there are no other members.
Example:

on load:
    trigger:
        print "hello"

Would become:

on load:
    print "hello"

Describe alternatives you've considered
I've thought about making a preprocessor to automatically generate trigger: sections when needed.

@Moderocky
Copy link
Owner

Moderocky commented Jul 8, 2022

Make trigger: implicit if there are no other members.

I'm not entirely sure what you mean by this: if you mean for something that has no other possible entries (I think events don't yet) then I don't really want to do this because I intend everything to have a lot more available entries for metadata (e.g. annotation-replacers) and micro-controlling tasks, plus any extra bits that third-party libraries or DSL versions would like to add

If, on the other hand, you mean if the user has only put a trigger entry (even though there are others available, e.g. in a simple function) -

I considered this at the start but decided against it on the grounds that it makes parsing very muddy.
E.g. if the parser defaults to looking for CODE_BODY elements if the line is not a MEMBER_BODY element it could start incorrectly compiling code that was in fact a mistake or an indentation error.

I've generally been in favour of keeping things quite rigid so that it's easier to know what goes where and what something is doing, however I'll leave this open in case it gets more support from other people and I'll consider it. :)

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

No branches or pull requests

2 participants