pkl icon indicating copy to clipboard operation
pkl copied to clipboard

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

Open holzensp opened this issue 1 year ago • 2 comments

holzensp avatar Oct 09 '24 15:10 holzensp

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

StefMa avatar Oct 09 '24 17:10 StefMa

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.

bioball avatar Oct 10 '24 00:10 bioball

Closing this as an outdated duplicate of #683.

holzensp avatar Oct 28 '24 10:10 holzensp