profile
viewpoint
Philipe Fatio fphilipe @valora-digital Zurich, Switzerland phili.pe

fphilipe/i18n-debug 139

Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!

fphilipe/PageExtender.app 72

Safari extension that injects custom CSS and JS files based on page host.

electric-feel/i18n-backend-side_by_side 49

Tired of jumping between language files when translating keys? Stop jumping and have all the languages side by side.

fphilipe/PHFArrayComparator 20

Animated table updates made easy.

fphilipe/dotfiles 19

My precious dotfiles

fphilipe/ETH-MAVT-Zusammenfassungen 6

Zusammenfassungen für Maschinenbau Studiengang an der ETH Zürich – von Philipe Fatio

fphilipe/bundler-private_install 3

https://phili.pe/posts/loading-additional-ruby-gems-in-development/

fphilipe/apartment 0

Database multi-tenancy for Rack (and Rails) applications

fphilipe/articles 0

Articles for NSHipster.com

fphilipe/awesome-postgres 0

A curated list of awesome PostgreSQL software, libraries, tools and resources, inspired by awesome-mysql

startedsamguyer/FastLED

started time in 9 hours

created repositoryRumbleDB/hep-iris-benchmark-jsoniq

JSONiq benchmark for HEP

created time in a day

startedmatrix-org/matrix-ios-kit

started time in a day

startedpms67/STM32F1-Breakout-Board

started time in 2 days

startedwoltapp/blurhash

started time in 2 days

startedcelaxodon/buildroot

started time in 2 days

startedfphilipe/premailer-rails

started time in 3 days

startedgugarosa/opytimizer

started time in 3 days

startedel10savio/PNCounter-crdt

started time in 3 days

Pull request review commentapple/swift-evolution

[Proposal] Codable synthesis for enums with associated values

+# Codable synthesis for enums with associated values++* Proposal: [SE-NNNN](NNNN-filename.md)+* Authors: [Dario Rexin](https://github.com/drexin)+* Review Manager: TBD+* Status: **Draft**+* Implementation: [apple/swift#34855](https://github.com/apple/swift/pull/34855)+* Pitch: [Forum Discussion](https://forums.swift.org/t/codable-synthesis-for-enums-with-associated-values/41493)++## Introduction++Codable was introduced in [SE-0166](https://github.com/apple/swift-evolution/blob/master/proposals/0166-swift-archival-serialization.md)+with support for synthesizing `Encodable` and `Decodable` conformance for+`class` and `struct` types, that only contain values that also conform+to the respective protocols.++This proposal will extend the support for auto-synthesis of these conformances+to enums with associated values.++## Motivation++Currently auto-synthesis only works for enums conforming to `RawRepresentable`.+There have been discussions about adding general support for enums in the past,+but the concrete structure of the encoded values was never agreed upon.+We believe that having a solution for this is an important quality of life+improvement.++## Proposed solution++### Structure of encoded enums++The following enum with associated values++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++would be encoded to++```json+{+  "load": {+    "key": "MyKey"+  }+}+```++and ++```json+{+  "store": {+    "key": "MyKey",+    "value": 42+  }+}+```++The top-level container contains a single key that matches the name of the enum case,+which points to another container that contains the values as they would be encoded+for structs and classes.++Associated values can also be unlabeled, in which case they will be encoded into an+array instead (that needs to happen even if only one of the value does not have a label):++```swift+enum Command: Codable {+  case load(String)+  case store(String, value: Int)+}+```++would encoded to++```json+{+  "load": [+    "MyKey"+  ]+}+```++and ++```json+{+  "store": [+    "MyKey",+    42+  ]+}+```++An enum case without associated values would encode the same as one where all values have labels,+i.e.++```swift+enum Command: Codable {+  case dumpToDisk+}+```++would encode to:++```json+{+  "dumpToDisk": {}+}+```++This is done for compatibility reasons. If associated values are added to a case later on, the structure+would not change, unless those values are unlabeled.++With the exception of the last case, this solution is closely following the default behavior of the Rust library [serde](https://serde.rs/container-attrs.html).++### User customization++For the existing cases users can customize which properties are included in the encoded respresentation+and map the property name to a custom name for the encoded representation by providing a custom `CodingKeys`+declaration instead of having the compiler generate one. The same should apply to the enum case.+Given that enums are encoded into a nested structure, there are multiple `CodingKeys` declarations. One+that contains the keys for each of the enum cases, and one for each case that contain the keys for the+associated values.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++Would have the compiler generate the following `CodingKeys` declarations:++```swift++// contains keys for all cases of the enum+enum CodingKeys: CodingKey {+  case load+  case store+}++// contains keys for all associated values of `case load`+enum CodingKeys_load: CodingKey {+  case key+}++// contains keys for all associated values of `case store`+enum CodingKeys_store: CodingKey {+  case key+  case value+}+``++Since cases with unlabeled parameters encode into unkeyed containers,+no `CodingKeys` enum will be generated for them.++Users can define custom `CodingKeys` declarations for all, or a subset+of the cases. If some of the cases in an enum should not be codable,+they can be excluded from the `CodingKeys` declaration.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+  case dumpToDisk++  enum CodingKeys: CodingKey {+    case load+    case store+    // don't include `dumpToDisk`+  }+}+```++The compiler will now only synthesize the code for the `load` and `store`+cases. An attempt to en- or decode a `dumpToDisk` value will cause an error+to be thrown.++Customizing which values will be included follows the same rules as the+existing functionality. Values that are excluded must have a default value+defined if a `Decodable` conformance should be synthesized. If only `Enodable`

Thanks!

drexin

comment created time in 3 days

Pull request review commentapple/swift-evolution

[Proposal] Codable synthesis for enums with associated values

+# Codable synthesis for enums with associated values++* Proposal: [SE-NNNN](NNNN-filename.md)+* Authors: [Dario Rexin](https://github.com/drexin)+* Review Manager: TBD+* Status: **Draft**+* Implementation: [apple/swift#34855](https://github.com/apple/swift/pull/34855)+* Pitch: [Forum Discussion](https://forums.swift.org/t/codable-synthesis-for-enums-with-associated-values/41493)++## Introduction++Codable was introduced in [SE-0166](https://github.com/apple/swift-evolution/blob/master/proposals/0166-swift-archival-serialization.md)+with support for synthesizing `Encodable` and `Decodable` conformance for+`class` and `struct` types, that only contain values that also conform+to the respective protocols.++This proposal will extend the support for auto-synthesis of these conformances+to enums with associated values.++## Motivation++Currently auto-synthesis only works for enums conforming to `RawRepresentable`.+There have been discussions about adding general support for enums in the past,+but the concrete structure of the encoded values was never agreed upon.+We believe that having a solution for this is an important quality of life+improvement.++## Proposed solution++### Structure of encoded enums++The following enum with associated values++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++would be encoded to++```json+{+  "load": {+    "key": "MyKey"+  }+}+```++and ++```json+{+  "store": {+    "key": "MyKey",+    "value": 42+  }+}+```++The top-level container contains a single key that matches the name of the enum case,+which points to another container that contains the values as they would be encoded+for structs and classes.++Associated values can also be unlabeled, in which case they will be encoded into an+array instead (that needs to happen even if only one of the value does not have a label):++```swift+enum Command: Codable {+  case load(String)+  case store(String, value: Int)+}+```++would encoded to++```json+{+  "load": [+    "MyKey"+  ]+}+```++and ++```json+{+  "store": [+    "MyKey",+    42+  ]+}+```++An enum case without associated values would encode the same as one where all values have labels,+i.e.++```swift+enum Command: Codable {+  case dumpToDisk+}+```++would encode to:++```json+{+  "dumpToDisk": {}+}+```++This is done for compatibility reasons. If associated values are added to a case later on, the structure+would not change, unless those values are unlabeled.++With the exception of the last case, this solution is closely following the default behavior of the Rust library [serde](https://serde.rs/container-attrs.html).++### User customization++For the existing cases users can customize which properties are included in the encoded respresentation+and map the property name to a custom name for the encoded representation by providing a custom `CodingKeys`+declaration instead of having the compiler generate one. The same should apply to the enum case.+Given that enums are encoded into a nested structure, there are multiple `CodingKeys` declarations. One+that contains the keys for each of the enum cases, and one for each case that contain the keys for the+associated values.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++Would have the compiler generate the following `CodingKeys` declarations:++```swift++// contains keys for all cases of the enum+enum CodingKeys: CodingKey {+  case load+  case store+}++// contains keys for all associated values of `case load`+enum CodingKeys_load: CodingKey {+  case key+}++// contains keys for all associated values of `case store`+enum CodingKeys_store: CodingKey {+  case key+  case value+}+``++Since cases with unlabeled parameters encode into unkeyed containers,+no `CodingKeys` enum will be generated for them.++Users can define custom `CodingKeys` declarations for all, or a subset+of the cases. If some of the cases in an enum should not be codable,+they can be excluded from the `CodingKeys` declaration.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+  case dumpToDisk++  enum CodingKeys: CodingKey {+    case load+    case store+    // don't include `dumpToDisk`+  }+}+```++The compiler will now only synthesize the code for the `load` and `store`+cases. An attempt to en- or decode a `dumpToDisk` value will cause an error+to be thrown.++Customizing which values will be included follows the same rules as the+existing functionality. Values that are excluded must have a default value+defined if a `Decodable` conformance should be synthesized. If only `Enodable`
defined if a `Decodable` conformance should be synthesized. If only `Encodable`
drexin

comment created time in 3 days

Pull request review commentapple/swift-evolution

[Proposal] Codable synthesis for enums with associated values

+# Codable synthesis for enums with associated values++* Proposal: [SE-NNNN](NNNN-filename.md)+* Authors: [Dario Rexin](https://github.com/drexin)+* Review Manager: TBD+* Status: **Draft**+* Implementation: [apple/swift#34855](https://github.com/apple/swift/pull/34855)+* Pitch: [Forum Discussion](https://forums.swift.org/t/codable-synthesis-for-enums-with-associated-values/41493)++## Introduction++Codable was introduced in [SE-0166](https://github.com/apple/swift-evolution/blob/master/proposals/0166-swift-archival-serialization.md)+with support for synthesizing `Encodable` and `Decodable` conformance for+`class` and `struct` types, that only contain values that also conform+to the respective protocols.++This proposal will extend the support for auto-synthesis of these conformances+to enums with associated values.++## Motivation++Currently auto-synthesis only works for enums conforming to `RawRepresentable`.+There have been discussions about adding general support for enums in the past,+but the concrete structure of the encoded values was never agreed upon.+We believe that having a solution for this is an important quality of life+improvement.++## Proposed solution++### Structure of encoded enums++The following enum with associated values++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++would be encoded to++```json+{+  "load": {+    "key": "MyKey"+  }+}+```++and ++```json+{+  "store": {+    "key": "MyKey",+    "value": 42+  }+}+```++The top-level container contains a single key that matches the name of the enum case,+which points to another container that contains the values as they would be encoded+for structs and classes.++Associated values can also be unlabeled, in which case they will be encoded into an+array instead (that needs to happen even if only one of the value does not have a label):++```swift+enum Command: Codable {+  case load(String)+  case store(String, value: Int)+}+```++would encoded to++```json+{+  "load": [+    "MyKey"+  ]+}+```++and ++```json+{+  "store": [+    "MyKey",+    42+  ]+}+```++An enum case without associated values would encode the same as one where all values have labels,+i.e.++```swift+enum Command: Codable {+  case dumpToDisk+}+```++would encode to:++```json+{+  "dumpToDisk": {}+}+```++This is done for compatibility reasons. If associated values are added to a case later on, the structure+would not change, unless those values are unlabeled.++With the exception of the last case, this solution is closely following the default behavior of the Rust library [serde](https://serde.rs/container-attrs.html).++### User customization++For the existing cases users can customize which properties are included in the encoded respresentation+and map the property name to a custom name for the encoded representation by providing a custom `CodingKeys`+declaration instead of having the compiler generate one. The same should apply to the enum case.+Given that enums are encoded into a nested structure, there are multiple `CodingKeys` declarations. One+that contains the keys for each of the enum cases, and one for each case that contain the keys for the+associated values.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+}+```++Would have the compiler generate the following `CodingKeys` declarations:++```swift++// contains keys for all cases of the enum+enum CodingKeys: CodingKey {+  case load+  case store+}++// contains keys for all associated values of `case load`+enum CodingKeys_load: CodingKey {+  case key+}++// contains keys for all associated values of `case store`+enum CodingKeys_store: CodingKey {+  case key+  case value+}+``++Since cases with unlabeled parameters encode into unkeyed containers,+no `CodingKeys` enum will be generated for them.++Users can define custom `CodingKeys` declarations for all, or a subset+of the cases. If some of the cases in an enum should not be codable,+they can be excluded from the `CodingKeys` declaration.++**Example**++```swift+enum Command: Codable {+  case load(key: String)+  case store(key: String, value: Int)+  case dumpToDisk++  enum CodingKeys: CodingKey {+    case load+    case store+    // don't include `dumpToDisk`+  }+}+```++The compiler will now only synthesize the code for the `load` and `store`+cases. An attempt to en- or decode a `dumpToDisk` value will cause an error+to be thrown.++Customizing which values will be included follows the same rules as the+existing functionality. Values that are excluded must have a default value+defined if a `Decodable` conformance should be synthesized. If only `Enodable`+is synthesized, this restriction does not apply.++**Example**++```swift+enum Command: Codable {+  case load(key: String, someLocalInfo: Int)++  // invalid, because `someLocalInfo` has no default value+  enum CodingKeys_load: CodingKey {+    case key+  }+}+```++```swift+enum Command: Codable {+  case load(key: String, someLocalInfo: Int = 0)++  // valid, because `someLocalInfo` has a default value+  enum CodingKeys_load: CodingKey {+    case key+  }+}+```++```swift+enum Command: Codable {+  case load(key: String)++  // invalid, because `someUnknownKey` does not map to a parameter in `load`+  enum CodingKeys_load: CodingKey {+    case key+    case someUnknownKey+  }+}+```++Keys can be mapped to other names by conforming to `RawRepresentable`:++**Example**++```swift+enum Command: Codable {+  case load(key: String)++  enum CodingKeys: String, CodingKey {+    case load = "lade"+  }++  enum CodingKeys_load: String, CodingKey {+    case key = "schluessel"

😄 fun example use-case

drexin

comment created time in 3 days

startedfphilipe/psql2csv

started time in 3 days

startedpacthq/mrio

started time in 4 days

startedfphilipe/premailer-rails

started time in 4 days

starteddano/aioprocessing

started time in 4 days

startedasim/nitro

started time in 4 days

MemberEvent

fork tmm1/pluto-for-channels

M3U generator optimized for Channels' custom channels.

fork in 4 days

startedgrafana/tempo

started time in 4 days

pull request commentapple/swift-evolution

Ability to declare executable targets in Swift Package manifests (to support @main)

This is not quite yet ready for review; it still should have:

  • a reference to the SR on bugs.swift.org
  • an answer to the question about whether any compiler flag changes should accompany this change
  • possibly further discussion about alternatives, if anyone feels this is needed
abertelrud

comment created time in 4 days

Pull request review commentapple/swift-evolution

Ability to declare executable targets in Swift Package manifests (to support @main)

+# Declaring executable targets in Package Manifests++* Proposal: [SE-NNNN](NNNN-filename.md)+* Authors: [Anders Bertelrud](https://github.com/abertelrud)+* Review Manager: TBD+* Status: **Draft**+* Implementation: [apple/swift-package-manager#3045](https://github.com/apple/swift-package-manager/pull/3045)+* Bugs: [SR-NNNN](https://bugs.swift.org/browse/SR-NNNN), [SR-MMMM](https://bugs.swift.org/browse/SR-MMMM)+* Pitch: [Forum Disucssion](https://forums.swift.org/t/pitch-ability-to-declare-executable-targets-in-swiftpm-manifests-to-support-main/41968)
* Pitch: [Forum Discussion](https://forums.swift.org/t/pitch-ability-to-declare-executable-targets-in-swiftpm-manifests-to-support-main/41968)
abertelrud

comment created time in 4 days

PR opened apple/swift-evolution

Reviewers
Ability to declare executable targets in Swift Package manifests (to support @main)

This proposal lets Swift Package authors declare targets as executable in the package manifest. This replaces the current approach of inferring executabilty based on the presence of a source file with the base name "main" at the top level of the target source directory.

Forum discussion: https://forums.swift.org/t/pitch-ability-to-declare-executable-targets-in-swiftpm-manifests-to-support-main/41968 Implementation: https://github.com/apple/swift-package-manager/pull/3045

+124 -0

0 comment

1 changed file

pr created time in 4 days

startedtailwindlabs/tailwindcss

started time in 5 days

created repositorymbj/xray

AWS XRay traceing / recording and submitting for Haskell

created time in 5 days

push eventapple/swift-evolution

Yim Lee

commit sha 24126799e8ee91ee6466917a5e22a8f1be4d43e8

Amendment to SE-0291 Package Collections (#1207) Motivation: Multiple members of the Swift community have inquired about the data (JSON) format and questioned why it is left out of the proposal. Modifications: Adding a "Data format" section to the proposal to explain that the data format is not considered stable API and thus is not included. Also mentioning that tools will be provide to help generate and consume package collection JSON.

view details

push time in 5 days

PR merged apple/swift-evolution

Amendment to SE-0291 Package Collections

Motivation: Multiple members of the Swift community have inquired about the data (JSON) format and questioned why it is left out of the proposal.

Modifications: Adding a "Data format" section to the proposal to explain that the data format is not considered stable API and thus is not included. Also mentioning that tools will be provide to help generate and consume package collection JSON.

+8 -1

0 comment

1 changed file

yim-lee

pr closed time in 5 days

push eventapple/swift-evolution

Boris Bügling

commit sha 9091821a71e35d9fb9cc67f4c4820c682c0634fa

Update package collections proposal with revisions (#1208) - remove profiles - merge the two `describe` commands - clarify use of git config syntax

view details

push time in 5 days

PR merged apple/swift-evolution

Update package collections proposal with revisions
  • remove profiles
  • merge the two describe commands
  • clarify use of git config syntax
+19 -31

0 comment

1 changed file

neonichu

pr closed time in 5 days

more