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

Provide a way of iterating over all defined functions #468

Open
asampal opened this issue Mar 11, 2022 · 8 comments
Open

Provide a way of iterating over all defined functions #468

asampal opened this issue Mar 11, 2022 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@asampal
Copy link

asampal commented Mar 11, 2022

It would be great to have a function that allows introspection over all defined functions (possibly scoped by some of the functions' metadata) in order to be able to act on the other metadata. I can see this being helpful for tooling (e.g. a language server that might want to provide prioritized auto-completion when in a particular module, etc.).

Maybe this is already there and I missed it (since I guess something like this is being used to generate some of the documentation).

@asampal asampal added the enhancement New feature or request label Mar 11, 2022
@drkameleon
Copy link
Collaborator

All currently-defined symbols can be accessed via the symbols command, as a dictionary (name-value).

Starting from there you can obviously get whatever you want (note: there was a tiny issue with the REPL not handling nested templates well, but it has also been fixed as per the latest PR).

For example:

This returns an array of tuples (name / description) for each of the defined built-in functions. 😉

map select keys symbols => [function?.builtin var] 'sym -> @[sym, get info.get sym 'description]

This is pretty much the same like:

map 
    select keys symbols 'sym [
        function?.builtin var sym
    ] 
    'sym [
        @[
            sym,
            get info.get sym 'description
         ]
    ]

P.S. That being said, the whole thing reminds that I have to add dictionary support for all the remaining functions in the Iterators module, so that e.g. you can select the items you want from a given dictionary and get back a dictionary. I always end up using similar things (as would be the case here), but I still haven't implemented it for Arturo... :S

@stale
Copy link

stale bot commented Nov 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 7, 2022
@stale
Copy link

stale bot commented Mar 7, 2023

Closing issue as stale.

@stale stale bot closed this as completed Mar 7, 2023
@drkameleon
Copy link
Collaborator

Issue is still active.

@drkameleon drkameleon reopened this Mar 7, 2023
@stale stale bot removed the stale label Mar 7, 2023
@RickBarretto
Copy link
Collaborator

@drkameleon How should we name this?

@drkameleon
Copy link
Collaborator

@drkameleon How should we name this?

Good question. It could be functions and work in an identical way as symbols, only returning just the functions?

Copy link

stale bot commented May 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 13, 2024
Copy link

stale bot commented Sep 12, 2024

Closing issue as stale.

@stale stale bot closed this as completed Sep 12, 2024
@RickBarretto RickBarretto reopened this Jan 6, 2025
@stale stale bot removed the stale label Jan 6, 2025
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

3 participants