Tim Moores wrote:Does the book delve into how to use Rust for developing Wasm code?
Even if not, I wondered if you had any opinion on using Rust for Wasm development. There is a bunch of detailed documentation at https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm to get started with. If I wanted to dip my foot into those waters, are those the tools you might use? Specifically, rustup and wasm-pack. I'm comfortable with CLI tools, just wondering if there are other options that a seasoned pro might prefer.
Tim Holloway wrote:
Campbell Ritchie wrote:Does Rust work on all platforms as C and C++ do, Carl? It can hardly replace them if it is platform‑specific.
The real question is "can Rust run in any environment from cold iron up?"
I could not do OS-level programming on IBM mainframes in Fortran, COBOL, or PL/1. They could only run under their respective language environments (which were not friendly to interrupt-level coding, privileged modes, real-time or small-footprint uses.) One cannot extend Java's "write once/run anywhere" to cold iron, as Java needs its JVM environment. Likewise, Python, although an essential part of the Red Hat Linux boot process, cannot run on bare metal.
Granted, there are exceptions. Prime Computer wrote most (but not all) of its OS in Fortran (the hardware was actually optimised for Fortran, as I've mentioned occasionally). They also later adopted a dialect of PL/1, as Fortran was not the best language to do byte manipulation in on a word-addressed machine. I'm fairly certain that the Honeywell GCOS minicomputer systems could do OS-level code in COBOL (!!!).
But the point is, those were exceptions. C and C++ can run OS-level code on virtually any platform. The languages are designed for a very minimal external language environment. Well, C was specifically designed to write an OS in (Unix).
Rust is at heart a safer C and its language environment is, so I understand, to be suitable for even low-level OS code just like C. So much that the Grand Penguin himself (Linux Torvalds) has been looking towards having Rust code in parts of the Linux OS.
Campbell Ritchie wrote:Does Rust work on all platforms as C and C++ do, Carl? It can hardly replace them if it is platform‑specific.
Carl Byrd wrote:Hi Ken,
Congrats on the book. Do you think Rust will eventually replace C/C++ for most system-level type projects? Thanks.
Junilu Lacar wrote:I realized I should have said "crate" instead of library.
Thanks for the tip. I'll check it out.
Junilu Lacar wrote:Is there a library for Rust to process command line arguments?
I've worked with libraries in Go, Groovy, and Java and those have some really good abstractions for processing of Unix-like command line arguments, including displaying of usage messages, long and short options, automatic type conversion of arguments, etc.
If there are multiple such libraries for Rust, which one(s) would you recommend?
D.J. Quavern wrote:Dear Ken,
I looked at the table of contents of the book and, in addition to the content (omy I did not know about `fortune`!), I love the typography I have to say.
For a while ago I was trying to put together a small program to "gamify" errors in Rust, displaying a cute graph on which error the programmer made, areas of improvement etc. I would like to pick it up again and I think reading the book would help me. (I did lots of tests, Junilu taught me well )
My question would be about your thoughts behind the book take-aways: if I understand correctly, every chapter have practical exercises where we implement the linux cli. How long do you estimate those little exercises would take to a beginner+ person with some experience with Rust?
Geoff McKay wrote:Congrats Ken Youens-Clark on your new book Command-Line Rust: A Project-Based Primer for Writing Rust CLIs.
With some languages it's necessary (or best practice) to define a variable's Type. (e.g. String, Numeric, Integer, etc.)
With Rust CLIs, is it best practice (or required) to specifically define a variable's Type?
Sometimes it's easier to read code if a variable Type is specifically defined initially, and this can help prevent potential confusion or debugging issues.
Using PHP as an example, you can specify a Type of Variable instead of allowing PHP to set this automatically based on how the variable is used. (I have heard people say PHP is a weak typed language, because you are not required to declare variable type)
What are best practices regarding Variable Type Declaration in Rust CLIs?
Junilu Lacar wrote:I'm planning on making Rust my choice for this year's Pragmatic Programmer Learn a New Programming Language every year.
A few questions for newbies:
1. Is there an IDE that works better for Rust programming? What does your development environment look like?
2. Is Rust mostly for command line / console programs or can it be used for other things?
3. What kind of programs might it not be the best choice to use?
Jeanne Boyarsky wrote:I just emailed him. Too late for the promo, but not too late to be helpful.
Hi Ken,
The idea was to check https://coderanch.com/f/60/ol and look at the titles. There are a number of questions about the book. Even though the promo is over, you can still go back and engage with those.
-Jeanne
Tim Cooke wrote:Don't forget that this thread is for welcoming the promo author only and posts here aren't eligible for the prize winners draw.
If you want to ask a question about the book and be eligible for the prize then start a new Topic in the Other Languages forum. For the promo week Ken will be watching the forum for your questions, although there's nothing stopping Ken from hanging around longer if he so desires. Everybody is welcome.
Campbell Ritchie wrote:Good to see you here; hope you have lots of
awkwardinteresting questions
D.J. Quavern wrote:Hello everyone! And welcome Ken .
Is it your second Rust book, I think I saw something else from you pass.
Long time no see <3. Ooooh I would love to play for this book!
I am in the (long on and off) process of writing a Rust gamepiler (compiler that gamifies the errors you do) and it would help me greatly :p