This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVMj2JxwEJc8zpHLSD3T1memwQ/tkCJk5Rf2zseCvpv soares@soares-desktop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is an example of how the Scala cake pattern can be used in CGP, | |
| // following the example at https://www.baeldung.com/scala/cake-pattern | |
| pub mod traits { | |
| use std::collections::BTreeMap; | |
| use anyhow::Error; | |
| use cgp::prelude::*; | |
| // For simplicity of the example, we use `dyn` trait to represent test cases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is a response on how to use Context-Generic Programming (CGP) | |
| // to solve the specialization problem in the following blog post: | |
| // https://oakchris1955.eu/posts/bypassing_specialization/ | |
| // | |
| // More info available at https://contextgeneric.dev/. | |
| use cgp::core::error::ErrorTypeProviderComponent; | |
| use cgp::prelude::*; | |
| // Redesign the FileSystem trait with CGP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is an example use of the extensible builder pattern in Context-Generic Programming (CGP) | |
| // to progressively build a struct with missing fields filled with default values. | |
| // | |
| // This is in response to the question at https://www.reddit.com/r/rust/comments/1m4d8a8/how_to_handle_default_values_for_parameters/. | |
| // More info at https://contextgeneric.dev/blog/extensible-datatypes-part-1/ | |
| use cgp::core::field::CanFinalizeWithDefault; | |
| use cgp::prelude::*; | |
| #[derive(Default)] |
OlderNewer