Skip to content

Turn the prompter function slots into methods? #29

Description

@Ambrevar

Prompters have a bunch of slots which are meant to be functions.

  • prompt class:
    • constructor
    • before-destructor
    • after-destructor
  • source class:
    • constructor
    • destructor
    • suggestion-maker
    • filter
    • filter-preprocessor
    • filter-postprocessor
    • resumer

There are also actions and selection-actions but, since it's a list of functions, methods would not do here.

Generic functions have many benefits over standard functions, but I can think of one drawback: Typically they are defined globally and methods must be specialized on classes, not objects.

We often have a use case like this:

(prompt
 :prompt "Reduce buffer(s)"
 :sources (make-instance 'buffer-source
                         :constructor (remove-if #'internal-url-p (buffer-list)
                                                 :key #'url)
                         :return-actions '(identity)
                         :multi-selection-p t))

Here it's convenient that we do not have to define a source only for the purpose of specializing the constructor.

Suggestion: go with generic functions but keep the constructor and *-destructor slots for local overrides.

Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions