4 ms·
While I do agree that it is possible to do something like that, I think we can all agree that the following (available in Rust) is soooooo much nicer: let
by jamescostian 9y ago
While I do agree that it is possible to do something like that, I think we can all agree that the following (available in Rust) is soooooo much nicer:
let stuff = include_bytes!("my.file");
- phkahler 9y agoNow I have to rewrite my arcade game emulator in rust just so I can use that to load rom images...
- FreeFull 9y agoinclude_bytes! is for compile-time inclusion of files though, not for runtime.
- phkahler 9y agoYeah but when it only runs 15 games with a max size of 32K... But yeah it makes it non-distributable because it would then include the images.
- jamescostian 9y agoNot only did you completely miss the point (a systems language has a very nice thing very well built-in - yay!), but you also built a strawman (as if praising a language means is the same as telling everyone to rewrite all code in that language) and then beat it up using a poor example (why package those images into the binary?). Congratulations! You just won the internet!
- dang 9y agoPlease don't comment uncivilly, regardless of what you think of someone else's comment. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newswelcome.html https://news.ycombinator.com/newswelcome.html
- zokier 9y agoWhile include_bytes is nice, xxd -i in a makefile is pretty workable solution in the scale of things.
- jamescostian 9y agoFair point, however I believe the OP made the game work for many different OSes, and I don't think xxd or Makefiles are the best when you have to deal with Windows (whereas Rust's include_bytes! provides a platform-independent solution). I had never heard of xxd until your comment though, so thank you very much!
- zokier 9y agoSomehow I'm reminded of the old adage "UNIX is IDE for C"