Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jarrettc
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
1.
▲
by
jarrettc
11y ago
Yep! That was my inspiration. I'd love to be able to do this in Rust. Soon, hopefully!
2.
▲
by
jarrettc
11y ago
Will the Rust compiler ever understand numbers in types? I.e. will the numbers ever be more than just part of the string that is the type name? If not, then I don't know how possible powers will be. Maybe the solution would be to defin
3.
▲
by
jarrettc
11y ago
Great question. I believe each unit struct would need to implement PartialEq or something similar. That would define the canonical nesting order. Alphabetical would make sense. We would to resolve the nesting during multiplication and divis
4.
▲
by
jarrettc
11y ago
Lately I've been playing around with static dimensional analysis in Rust. The overall idea is similar: Use PhantomData to add a type parameter and define an empty struct for each unit. So you might end up with, say, Scalar<Newtons&g
5.
▲
by
jarrettc
11y ago
> Hasn't every template language in the world has come to a similar conclusion? No, not even every mainstream template language. For example, I still use ERB and EJS extensively, and so do many other engineers. ERB and EJS use the c
6.
▲
by
jarrettc
11y ago
I'm skeptical that 3d printed objects could replace very much of what we now obtain from factories. In industrial design, the materials and fabrication process are (supposed to be) selected very carefully with an eye towards cost, phys
7.
▲
by
jarrettc
11y ago
> This isn't security through obscurity I don't necessarily disagree. But how, other than through obscurity, does HTML5 DRM inhibit copying, given that the client possesses the decryption key? (Let's assume the would-be at
8.
▲
by
jarrettc
11y ago
> Or does it truly rely on blackbox obfuscation? The client ultimately has to decrypt the data somehow. So the key is there on the client. I take it obfuscation is the only thing standing between the user and that key. Am I correct about
9.
▲
by
jarrettc
11y ago
Thanks so much for working on the grammar docs! This is much needed and very helpful, considering how quickly Rust's grammar has been evolving.
10.
▲
by
jarrettc
11y ago
Ah, my mistake. So would I be correct in saying that a trait is a type, but it does not necessarily implement the Sized trait, and if it does not, then it cannot be allocated directly on the stack? Also, I've been wondering something a
11.
▲
by
jarrettc
11y ago
Rust has algebraic data types. They're one of Rust's most important features. But algebraic data types do not in themselves provide a way to express the notion of a type with variants or sub-types.
12.
▲
by
jarrettc
11y ago
I'm hoping the next post will talk about this use case: Suppose I have an enum called "Canine" and I want each of its variants to implement a different "bark" method. Currently, as far as I know, I have to write a m
13.
▲
by
jarrettc
11y ago
> I guess it just seems overly ambitious to me.. finding the right abstraction for the server is difficult enough without polluting it with the front-end. Certainly. That's why I'm skeptical that this will ever happen. > why
14.
▲
by
jarrettc
11y ago
> The examples you give don't seem to be typing problems, they seem to be wrong-value problems. They're like type or name errors because the "apple" and "orange" here are like identifiers, not data. Sure, to
15.
▲
by
jarrettc
11y ago
Strong typing on the web has been an intractable problem for me so far. Sure, I can have strong typing in my server-side code. But so many errors result from the interaction between the server, CSS, HTML, and JS. For example, you define a r
16.
▲
by
jarrettc
11y ago
True, but the parent commenter is getting at something important. The article suggests that researchers have found a new, much more concise way to express the solutions to difficult problems. That's different from a library, which mere
17.
▲
by
jarrettc
11y ago
Good to know. Thanks! So I guess the moral is, if you have a big, expensive struct, make sure the expensive part is in a sub-structure you know is heap allocated, such as a Vec. E.g.: struct Expensive { cheap_value: u32,
18.
▲
by
jarrettc
11y ago
Oh, agreed. But how about this: let x = BigExpensiveStruct::new(); some_function(x); That won't trigger a big, expensive memcpy of the BigExpensiveStruct, will it? I'd thought that its memory was on the heap.
19.
▲
by
jarrettc
11y ago
Yes, I had understood the struct's memory to be on the heap. My thinking was, keeping the memory on the heap allows for inexpensive moves. Whereas, the pointer to the heap space may indeed be on the stack, as far as I know. But I could
20.
▲
by
jarrettc
11y ago
> Semantically speaking, the only difference between a move and a copy is that you're allowed to use a copy type afterwards Are you speaking about Rust specifically, or move in general? I had always understood that move was no more
21.
▲
by
jarrettc
11y ago
> It seems to me like the value would be memcpyed, when you pass by value. As far as I know, the compiler should not copy in that instance. Rather, it should move. > There is not one unit of memory that is "taken over," or i
22.
▲
by
jarrettc
11y ago
The author mentions that Rust's "Box type is an owning type" and compares Box to C++'s std::unique_ptr. Worth noting: Rust's most basic variable syntax provides unique_ptr-like behavior, so you usually don't ne
23.
▲
by
jarrettc
11y ago
The relative impact of your money vs your time depends in part on your income, you skill-set, and the causes you would choose. A person with a high income but few relevant skills would probably have the greatest impact by donating money. Fo
24.
▲
by
jarrettc
12y ago
I've always been uneasy about the fact that Stack Overflow users can edit each other's posts more or less arbitrarily. User A can edit user B's post to say something embarrassing, and most readers will attribute it to User B.
25.
▲
by
jarrettc
12y ago
Even though 1.0 isn't out yet, today you can use Rust for many real projects. I'm unsure whether I'd bet my business on it yet, but I'd be open to the idea. And I'm usually a very late adopter. I've been buildi
26.
▲
by
jarrettc
12y ago
The article suggests that solar panels could be an "existential threat" to power companies. For those of you who are familiar with the math of solar panels, how realistic is that prediction? How much of a normal home's energy
27.
▲
by
jarrettc
12y ago
I agree that HTML needn't be strictly semantic in the way that the OP suggests. But for the foreseeable future, it does need to encode basic structural data for CSS-less presentation. That includes links, headings, inter-page and intra