Skip to content

[v1][breaking] Make slog.Handler optional in public constructors #85

@robbyt

Description

@robbyt

Summary

Every public constructor in polyscript.go and the per-engine new.go files takes slog.Handler as a required positional argument. Most call sites pass slog.Default().Handler().

The compilers already default to a stderr handler in applyDefaults():

  • engines/risor/compiler/options.go:91
  • engines/extism/compiler/options.go:107

Top-level constructors should follow the same pattern.

Proposal

Treat a nil slog.Handler as "use the default". A library probably shouldn't write to stderr by default — a discard handler is more polite — but at minimum the constructors shouldn't require the argument.

Files

  • polyscript.go
  • engines/risor/new.go
  • engines/starlark/new.go
  • engines/extism/new.go
  • engines/new.go
  • (Reconsider stderr default in compilers' applyDefaults.)

This is a breaking-change candidate for v1; it removes a positional argument from the public constructor surface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions