Live data from Hacker News

Announcing Rust 1.0 Alpha

blog.rust-lang.org

161–170 of 255 posts

Re: Announcing Rust 1.0 Alpha

#161
post #79
post #69

The one thing that would put rust over the top right now is something along the lines of gofmt - something simple, with zero configuration, that can be run on commit or even save.

gofmt is a huge win for Go. Bye bye bikeshedding. I'd love to see that for Rust too.

There has been talk of it, and one of the core team members had a prototype. It's most definitely something to look at this year.

Re: Announcing Rust 1.0 Alpha

#162

I've been incredibly impressed by the willingness of the Rust team to take a step back and re-evaluate old decisions. I think this 1.0 release will be much better for all the iterations put into e.g. dynamically sized types and other things that never quite fit in their first half-dozen iterations of the design. Congrats all!

Yeah, that was what impressed me at the beginning when I was starting. For example: ripping out classes just after they were documented and implemented, because structs/traits were enough.

Re: Announcing Rust 1.0 Alpha

#164

Earlier quoted context omitted.

One reason is that let takes a pattern, so you can do things like: let (x, mut y) = ... Another reason is that we feel 'mut' more cleanly communicates mutability than 'var.' Another reason is that we prefer immutability by default, and let/var doesn't communicate that as nicely as let and let mut. There are some discissions about this on the ML archives, RFC repo, or discuss, if you're interested.

let (x, var y) = ... can easily express the intention. Also, communication is in the ear of the beholder. Var: variable, that varies. 'Let' would be immutable by default. Thanks for the response anyway.

Well then it would be:

    let var x = ...
the `mut` or `var` is part of the pattern match.

Re: Announcing Rust 1.0 Alpha

#165
post #145
post #143

Earlier quoted context omitted.

Why is it a good idea in principle then? Automatic reformatting of the source code always seemed like a bad idea to me for precisely the sort of reason you describe.

It's good enough when you can configure it and apply it selectively. If I want to clean up a function in my code base, I can e.g. select it and run "perltidy" over it, which has a configuration dot file for the company code standard (or CPAN guidelines etc.). Or just clean up some nags so that version control behaves better. But if the only option is not running it at all or having all the code automatically fit to w…

It's irksome when the auto formatter does something ugly. Though, I think the issue is far worse with Perl tidy. With, gofmt my view is more "I don't like this bit but fuck it." Probably because, Go has much simpler syntax.

Re: Announcing Rust 1.0 Alpha

#166
post #146
post #115

Earlier quoted context omitted.

I haven’t tried Go yet, but gofmt seems like something that every new language should strongly consider.

FWIW, C++ already has it with clang-format

clang-format is amazing. I think it can format more languages than just C++ too. For example js, I think?

Re: Announcing Rust 1.0 Alpha

#167
post #131

Earlier quoted context omitted.

> Duck would have a GameObject, rather than be a GameObject Duck should not be a class, it should be a factory function that creates a generic GameObject and configures it with the set of components that allows it to look, walk and quack like a duck.

Can you elaborate on the reasons for that?

Once you move to components, these implement all the game-related behaviour and the GameObject becomes a simple piece of scaffolding to hold components together. You don't gain anything by making different GameObject code-level classes that only differ in the components they contain (there may be a debate in the case of languages that support mixins).

It's also much easier to data-drive entity types; at some point you will even do away with factory functions for GameObject types and describe these types in data files loaded at runtime. This opens up options for designer-friendly editing tools and even 3rd party modding.

Re: Announcing Rust 1.0 Alpha

#168
post #62

Earlier quoted context omitted.

> I think Python and Go are two examples where the standard library has very much proven invaluable. C#. The amount of time I've wasted in Java programming teams while arguing over things like which of three quirky XML parsing implmentations[1] was the One To Use while the .net team powered off and built useful functionality... [1] This was a few years ago, obviously.

So you prefer not having a choice over having a choice because choice will lead to discussions to pick the best solution. Quite an odd view from a software engineer. I like having as much choice as possible.

> So you prefer not having a choice over having a choice because choice will lead to discussions to pick the best solution.

I prefer to get things done.

Re: Announcing Rust 1.0 Alpha

#169
post #111

Earlier quoted context omitted.

We have them.

Like three different kinds, too! // Old-style generics; monomorphized // with S as an "input" type of MyTrait fn foo >(elem: T) { ... } // Where-clause-style generics; monomorphized, // with S as an "output" (associated) type of MyTrait fn foo (elem: T) where T: MyTrait { ... } // Trait objects; dynamic dispatch fn foo(elem: Box ) { ... }

Well, the first two are really just the same thing :P

Re: Announcing Rust 1.0 Alpha

#170

Being a game developer, inheritance is a really important language feature. I'm not one to abuse the power. Currently, for school I've been working on an OpenGL game engine in C++. It's a component based system. The only real inheritance situation that's important to me, is to allow the user of the engine to create any object and make it inherit from GameObject (example: Duck would inherit the members and methods fro…

Solution: Don't inherit from GameObject. Make GameObject "final" and simply be a container of components. Move all object-specific behaviour into the components.
Post reply on HN