ceronman
Joined 15 years ago
Joined 15 years ago
2. Even with my Mastercard credit card, the process is still inconvenient. For small purchases, it's fine. But for larger ones, there is an annoying second factor authentication, I have to enter a special password, and the wait to receive an SMS.
3. Visa and Mastercard fees. Most of the time these are paid by the merchant. But sometimes the customer has to pay more if the payment method is credit card. Some places don't accept these at all.
In general iDEAL is simple, secure and convenient. Not only to pay online, but also for example for splitting a bill with friends. I'm very happy to see this being adopted more widely in Europe.
What do you have against this pattern? Or what is a better alternative?
The richest, most powerful organizations are spending billions every month to make it more addictive, to reach more people.
- You can add new traces, or modify/disable existing ones at runtime without having to recompile and rerun your program.
- Once you've fixed the bug, you don't have to cleanup all the prints that you left around the codebase.
I know that there is a good reason for debugging with prints: The debugging experience of many languages suck. In that case I always use prints. But if I'm lucky to use a language with good debugging tooling (e.g Java/Kotlin + IntelliJ IDEA), there is zero chance to ever print for debugging.
struct Constant { value: i32 }
struct BinaryPlus { lhs: i32, rhs: i32 }
trait Evaluate {
fn evaluate(&self) -> i32;
}
impl Evaluate for Constant {
fn evaluate(&self) -> i32 { self.value }
}
impl Evaluate for BinaryPlus {
fn evaluate(&self) -> i32 { self.lhs + self.rhs }
}
// Adding a new operation is easy. Let's add stringify:
trait Stringify {
fn stringify(&self) -> String;
}
impl Stringify for Constant {
fn stringify(&self) -> String { format!("{}", self.value) }
}
impl Stringify for BinaryPlus {
fn stringify(&self) -> String { format!("{} + {}", self.lhs, self.rhs) }
}
// How about adding new types? Suppose we want to add FunctionCall
struct FunctionCall { name: String, arguments: Vec<i32> }
impl Evaluate for FunctionCall {
fn evaluate(&self) -> i32 { todo!() }
}
impl Stringify for FunctionCall {
fn stringify(&self) -> String { todo!() }
}To me it looks like this is exactly the expression problem. The expression problem is not about adding methods to a trait, it's about adding an operation to a set of types. In this case every operation is defined by a single trait.
The idea behind the expression problem is to be able to define either a new operation or a new type in such a way that the code is nicely together. Rust trait system accomplish this beautifully.
> That's not unique to Rust, you can add new interfaces in any language...
Many languages have interfaces, but most of them don't allow you to implement them for an arbitrary type that you have not defined. For example, in Java, if you create an interface called `PrettyPrintable`, but you can't implement it for the `ArrayList` type from the standard library. In Rust you can do this kind of things.
The orphan rule only disallow impls if both the trait and the type are defined outside the crate.
But in this example if you are adding a new type (struct) or a new operation (trait), well this new item should be in your crate, so all the impls that follow are allowed.
If you are interesting in learning in more detail how to write a C compiler, I highly recommend the book "Writing a C Compiler" by Nora Sandler [0]. This is a super detailed, incremental guide on how to write a C compiler. This also uses the traditional architecture of using multiple passes. It uses its own IR called Tacky and it even includes some optimization passes such as constant folding, copy propagation, dead code elimination, register allocation, etc. The book also implements much more features, including arrays, pointers, structs/unions, static variables, floating point, strings, linking to stdlib via System V ABI, and much more.
Tim Cook explains it better that I could ever do:
The product looks polished and I definitely see myself using it. My only concern is: Are they taking VC money? Is this going to be enshittified to death trying to pursue a 1000x investment return?