Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add properties and methods to Mapping/Listing API to resemble Map/List more #672

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

holzensp
Copy link
Contributor

@holzensp holzensp commented Oct 9, 2024

No description provided.

Comment on lines +1968 to +1972
/// The values contained in this mapping.
external values: List<Value>

/// The entries contained in this mapping.
external entries: List<Pair<Key, Value>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why there are Lists while keys is a Set? Mappings are ordered (and documented as such), so this sort of makes sense to me. Having this reasoning documented might be helpful.

@StefMa
Copy link
Contributor

StefMa commented Oct 9, 2024

While we are here, what is the reason that pkl has Mappings and Map and Listing and List? 🤔

@bioball
Copy link
Contributor

bioball commented Oct 10, 2024

While we are here, what is the reason that pkl has Mappings and Map and Listing and List?

Several reasons (not comprehensive):

  • Mapping and Listing are values of type Object; their members are lazy and late-bound, which has implications around how the object is represented in the underlying implementation. Map and List are a lot more performant for "algorithm-y" type logic; e.g. concat, map, filter, etc.
  • Mapping and Listing have a special property called "default". It's not really clear how something like .map() and .flatMap() should work; what do you do with the special "default" property?

It'd be good to simplify the language and not have this dichotomy, but we'd need to at least solve the above challenges first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants