apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
9.85k stars 258 forks source link

Split out base settings in stdlib for reuse #493

Closed holzensp closed 1 month ago

holzensp commented 1 month ago

This PR defines pkl:AbstractSettings as a common parent module for pkl:settings and pkl:Project.

Since user-level evaluator settings should be limited to user/machine specific ones (to avoid unnecessary "works on my machine"), whereas PklProjects might want to set more detailed settings.

There isn't an overwhelming win from making pkl:AbstractSettings a super-module, other than evaluatorSettings (and possibly other properties in the future) being defined in all children by default. Alternatively, pkl:AbstractSettings could define all classes that might be used somewhere, and it just being imported, i.e.

settings.pkl:

module pkl.settings

import "pkl:AbstractSettings"

proxy: AbstractSettings.Proxy

//...

Project.pkl:

module pkl.Project

import "pkl:AbstractSettings"

evaluatorSettings: AbstractSettings.Evaluator

//...
holzensp commented 1 month ago

Rolling this into Proxy PR