News for hackers. Stuff that matters.
Re:My gamedever wishlist for Rust by rootlocus on Thursday October 01, 2015 @12:44PM (#10312503)
This article comes from a person who prefers copy+pasting to reusable macros:

"The reason why I have 15 "max" in my code is because it takes less time to copy-paste max( 15 times than it is to write a macro and think about where I should put it in my code structure!"

Am I the only one who sees a problem with that?

Re:My gamedever wishlist for Rust by kibwen on Thursday October 01, 2015 @12:54PM (#10312592)
Setting aside for the moment that game developers may have a tendency for quick-and-dirty solutions, tomaka is well worth listening to. :) They're the author of glium (https://github.com/tomaka/glium), which all my OpenGL-using friends perpetually rave about and which showcases how Rust can be used to provide safe abstractions over low-level APIs.
Re:My gamedever wishlist for Rust by TillE on Thursday October 01, 2015 @01:02PM (#10312643)
Every programmer is lazy sometimes. Obviously the author doesn't "prefer" this, it's probably just a resistance to implementing a macro which they think should be present in the standard library.

If you only need to do this two or three times in your code, I can see how you wouldn't bother refactoring it, but would include it in a list of annoyances.

Re:My gamedever wishlist for Rust by outworlder on Thursday October 01, 2015 @01:56PM (#10313097)
Yes and no. If it's a single instance (even if repeated 15 times), then it could be a net win in complexity to just leave the 15 max there – they are more obvious. This is in contrast to writing and maintaining a macro that does a trivial function, just once.
Re:My gamedever wishlist for Rust by rootlocus on Thursday October 01, 2015 @02:20PM (#10313353)
That may be your personal opinion, but 15 'max(' on a single would not pass code review in any decently maintained project, especially when there is a cleaner, reusable alternative.

Moreover, complaining that implementing such a macro is too cumbersome because it implies finding a place for it in your code structure certainly doesn't imply professionalism. Just step back a minute and imagine the fresh intern comes to you with this code and explanation. Would it fly? Or are you just finding excuses because he's the author of a well known library?

Re:My gamedever wishlist for Rust by kibwen on Thursday October 01, 2015 @02:46PM (#10313599)
You're a bit too over-focused on so trivial an issue. The game in question is a lone developer's personal side project and isn't even open-sourced yet. Don't jump to the conclusion that a codebase written for fun and developed in isolation has any bearing on that developer's professional capabilities.
Re:My gamedever wishlist for Rust by Ace17 on Thursday October 01, 2015 @02:56PM (#10313700)
Interestingly, I think it might have. Would you rather hire a "clean code" lone developer, or a "messy" one?
Re:My gamedever wishlist for Rust by kibwen on Thursday October 01, 2015 @04:27PM (#10314415)
That's a loaded question, I deliberately wouldn't judge a candidate based on their undisclosed personal projects. :P tomaka is a well-regarded author of many high-quality libraries, such as https://github.com/tomaka/glium . This is the output I would use to gauge his applicability for any hypothetical position.
Re:My gamedever wishlist for Rust by rootlocus on Thursday October 01, 2015 @03:00PM (#10313729)
The article is not about a game, is about what could be improved in the core language, from a professional point of view. I may write messy code in my spare time, but I don't. And I certainly don't wait for the standard library to implement trivial things on my behalf complaining there's no alternative.
Re:My gamedever wishlist for Rust by kibwen on Thursday October 01, 2015 @03:52PM (#10314168)
If you read the OP, in literally the second comment tomaka admits that this is the least important item in the list. You characterization of his remarks as "complaining" is uncharitable.
Re:My gamedever wishlist for Rust by evincarofautumn on Thursday October 01, 2015 @05:58PM (#10315069)
I don’t even see why a macro would come to mind as a first solution when you can just use a fold.
Re:My gamedever wishlist for Rust by SamReidHughes on Friday October 02, 2015 @12:32AM (#10316748)
That would be horribly slow.
Re:My gamedever wishlist for Rust by evincarofautumn on Friday October 02, 2015 @03:35PM (#10320756)
Would it? Inlining the fold should produce the same code, with no intermediate vector. Granted, such inlining is not guaranteed, whereas with a macro it would be.
Re:My gamedever wishlist for Rust by SamReidHughes on Saturday October 03, 2015 @12:17AM (#10322575)
I don't know about compiler optimization but there's a bit more to it than inlining a fold.
Re:My gamedever wishlist for Rust by SamReidHughes on Saturday October 03, 2015 @10:40PM (#10326203)
I just tried it and sometimes it avoided the vector allocation but at least once it allocated and filled the vector, and then immediately deallocated it. (It didn't reread the data back from the vector.)