Skip to content

Consider changing constructors from glsp:: functions into associated functions #27

Open
@fleabitdev

Description

@fleabitdev

The glsp namespace is currently cluttered with around 100 toplevel functions. When a new user looks at the docs.rs page, I expect this doesn't make a great first impression. The functions are also quite verbose (glsp:: is six characters), they're not very self-documenting at the call site (glsp::arr_from_iter is debatably less clear than Arr::from_iter), and they introduce name-collision problems in the prelude.

Many of the toplevel constructors could be converted into associated functions. For example, glsp::coro could become Coro::new, and glsp::step_by could become GIter::step_by. A quick headcount suggests that this would eliminate around 40 toplevel functions.

Possible downsides:

  • Most of the constructors would return a Root, which might be counterintuitive
  • This change could make constructors less discoverable
  • It would make the codebase less organised (we would need to add many with_engine invocations outside of engine.rs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions