[PR #493] [CLOSED] Split out base settings in stdlib for reuse #582

Closed
opened 2025-12-30 01:25:28 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/493
Author: @holzensp
Created: 5/15/2024
Status: Closed

Base: mainHead: settings


📝 Commits (1)

  • 6d44260 Add abstract base module for settings

📊 Changes

7 files changed (+104 additions, -10 deletions)

View changed files

pkl-core/src/test/files/LanguageSnippetTests/input/stdlib/settings.pkl (+25 -0)
📝 pkl-core/src/test/files/LanguageSnippetTests/output/errors/cannotFindStdLibModule.err (+1 -0)
📝 pkl-core/src/test/files/LanguageSnippetTests/output/projects/badProjectDeps4/bug.err (+2 -2)
pkl-core/src/test/files/LanguageSnippetTests/output/stdlib/settings.pcf (+6 -0)
stdlib/AbstractSettings.pkl (+58 -0)
📝 stdlib/Project.pkl (+3 -1)
📝 stdlib/settings.pkl (+9 -7)

📄 Description

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

//...

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/493 **Author:** [@holzensp](https://github.com/holzensp) **Created:** 5/15/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `settings` --- ### 📝 Commits (1) - [`6d44260`](https://github.com/apple/pkl/commit/6d4426088b58bb91b001c4a49e77e0e1aafa8804) Add abstract base module for settings ### 📊 Changes **7 files changed** (+104 additions, -10 deletions) <details> <summary>View changed files</summary> ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/stdlib/settings.pkl` (+25 -0) 📝 `pkl-core/src/test/files/LanguageSnippetTests/output/errors/cannotFindStdLibModule.err` (+1 -0) 📝 `pkl-core/src/test/files/LanguageSnippetTests/output/projects/badProjectDeps4/bug.err` (+2 -2) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/stdlib/settings.pcf` (+6 -0) ➕ `stdlib/AbstractSettings.pkl` (+58 -0) 📝 `stdlib/Project.pkl` (+3 -1) 📝 `stdlib/settings.pkl` (+9 -7) </details> ### 📄 Description 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 `PklProject`s 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 `class`es that might be used somewhere, and it just being `import`ed, i.e. `settings.pkl`: ``` module pkl.settings import "pkl:AbstractSettings" proxy: AbstractSettings.Proxy //... ``` `Project.pkl`: ``` module pkl.Project import "pkl:AbstractSettings" evaluatorSettings: AbstractSettings.Evaluator //... ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:25:28 +01:00
adam closed this issue 2025-12-30 01:25:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#582