Compiler Language With No Pronounceable Acronym

1.5M ratings
277k ratings

See, that’s what the app is perfect for.

Sounds perfect Wahhhh, I don’t wanna
piratesexmachine420
intercal

ran into an error with rustc because I was trying to use a "cyclic superpredicate", basically you can't do:

trait MyTrait: PartialEq<dyn MyTrait> { ... }

and the compiler says:

error[E0391]: cycle detected when computing the super predicates of MyTrait
= note: …which immediately requires computing the super predicates of MyTrait again

and then it links me to dev docs for the rust compiler query system internals. which feels more like an implementation limitation of rustc rather than unsound or incorrect code :|

piratesexmachine420

I'm curious why you needed PartialEq<dyn MyTrait> in the first place, I can't seem to come up with any reasons why I'd ever need that instead of just PartialEq. (I don't know your codebase though, and I'll admit I get a little hazy when it comes to dynamic dispatch.)

intercal

everything in the language gets passed around as a “Gc<dyn Object>”, and one of the functions I have on the Object trait is “Object::equals(&self, other: &dyn Object)” for basic equality among builtin types. I am working on implementing hash maps for the language, but you need to be able to implement PartialEq and Eq for the hash key types. I was hoping I could constrain the Object trait to those two since I’m going to be storing the “Gc<dyn Object>” pointers as both keys and values, and then just implement PartialEq::eq for all of the object implementors instead of my custom Object::equals function.

basically it’s just to get hashmaps to work for a wide variety of types that fall under a specific trait that’s tracked as an unsized type behind a smart pointer.

right now I am hoping to use the hashbrown crate’s HashTable type because it’s a little more flexible and takes functions for comparison and hashing instead of expecting traits to be implemented. I am still figuring out the “hashing an object in the context of a VM function call” story.

ran into an error with rustc because I was trying to use a “cyclic superpredicate”, basically you can’t do:

trait MyTrait: PartialEq<dyn MyTrait> { … }

and the compiler says:

error[E0391]: cycle detected when computing the super predicates of MyTrait
= note: …which immediately requires computing the super predicates of MyTrait again

and then it links me to dev docs for the rust compiler query system internals. which feels more like an implementation limitation of rustc rather than unsound or incorrect code :|

t