On Thu, Jul 5, 2012 at 10:41 PM, James Deng <[email protected]> wrote: > Hi all, > > I am a language enthusiast. I found that Rust is an elegant combination of > procedure, functional and concurrent paradigm, thus can be a promising > practical system programming language. Among all that fantastic features, my > favorite one is the ad-hoc polymorphism, aka type class from Haskell. >
It's great that you like it! As I'm sure you realize, Rust has type classes (expressed with the keywords "iface" for class declarations and "impl" for class instances, though the syntax is still subject to change) that are based on Haskell's type classes. > I have some suggestions about Rust's syntax. > > Replace "let" with "val", and "let mut" with "var", like Scala does. We have discussed this, and you should be able to find the relevant issues by searching the issue tracker. > Replace module name separator "::" with "/" as Scheme, which is shorter and > and cleaner I think. I don't think anyone has suggested this before. However, I think it would cause a parsing ambiguity, since '/' is also the division operator. > > Regarding to grammar, I think current type kind constraint (a: copy) is not > flexible, I think the type constraint (Ord a, F a b => defs...) is more > powerful and flexible. Do you mean that we don't support multi-parameter type classes? If so, that's true, but it's somewhat deliberate on our part. In Haskell, multi-parameter type classes have spawned two different language extensions (type functions and functional dependencies) that, while differing mainly syntactically, have caused a bit of acrimony about which is better. We decided not to shave that yak just now. However, this could change in the future if there are compelling reasons for MPTCs in the first round of applications implemented in Rust. > > In addition, it seems that current Rust relies on crates(.rs) to form module > hierarchy. I don't think it's intuitive. When programmers see a module path, > they want to have a sense where the module resides. I think the module > hierarchy system in Haskell is a good compromise between power and > simplicity. > I'm not sure I understand -- Rust has nested modules, which are actually more expressive than Haskell's module system. An example might be good. Cheers, Tim -- Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt "Debate is useless when one participant denies the full dignity of the other." -- Eric Berndt _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
