Live data from Hacker News

Rust in Large Organizations

gist.github.com

41–50 of 51 posts

Re: Rust in Large Organizations

#41
post #31
post #21

Earlier quoted context omitted.

> I don't think that's a great example for Python; that's just knowing what "is" is for. The fact that it works the same as == for small integers in CPython is an optimisation showing through, but only in a place where it doesn't really matter. Python should have prevented checking primitives with is though -- only let object pointers...

I believe they're still object pointers in CPython, they're just ordinary singletons; in other implementations, they aren't even singletons. Python's object model doesn't have primitives. Adding special rules around them would significantly complicate the language as well as limit the implementors' ability to fiddle with the ranges of pre-allocated instances, for minimal benefit.

>in other implementations, they aren't even singletons

That would have been less surprising (since for < 256 the singleton-ness means all same valued instances have the same "address" (id), so behave in equality check as if they were plain numbers).

Re: Rust in Large Organizations

#42

Can any rust experts tell me that unsafe rust is powerful and expressive enough to let me do anything? I have a use case where I have two iterators on a linked list in nested loops and the second iterators deletes some elements as it goes. Is this something I can express in unsafe rust?

I’m no expert but yes, you can do anything in unsafe as in C can do anything. Unsafe Rust provides you access to raw pointers.

Re: Rust in Large Organizations

#43

Can any rust experts tell me that unsafe rust is powerful and expressive enough to let me do anything? I have a use case where I have two iterators on a linked list in nested loops and the second iterators deletes some elements as it goes. Is this something I can express in unsafe rust?

I’m no expert but yes, you can do anything in unsafe as in C can do anything. Unsafe Rust provides you access to raw pointers.

I'll add more details to see if it helps-

C:

``` node prime= list.head;

while () { node probe = prime.next;

  while()
  {

    if () //condition on prime.data and probe.data {
      probe.next = probe.next.next; //& drop stuff
  }
} ```

Re: Rust in Large Organizations

#46

Earlier quoted context omitted.

I’m no expert but yes, you can do anything in unsafe as in C can do anything. Unsafe Rust provides you access to raw pointers.

I'll add more details to see if it helps- C: ``` node prime= list.head; while () { node probe = prime.next; while() { if () //condition on prime.data and probe.data { probe.next = probe.next.next; //& drop stuff } } ```

You need to use four space indent to create code blocks, triple-ticks don't work here.

Re: Rust in Large Organizations

#47
post #9

It's interesting how many organizations had problems with build.rs. Other build systems like Make, scons, or autotools have the ability to run arbitrary things in any step in the process compared to Rust which has a clear separation. There is a proposed RFC to reduce the need for build.rs scripts in many cases [1], will likely be merged within the next 2 weeks. [1]: https://github.com/rust-lang/rfcs/pull/2523

If people are worried about build.rs files running arbitrary things, you can isolate cargo inside docker, using a project I recently released: https://gitlab.com/mikecardwell/saferrust

Re: Rust in Large Organizations

#49
post #6

I tried to learn those languages, my IQ level can handle java/golang/python/c just fine, but c++ and rust is beyond my comfort zone for sure, for c++, getting familiar with it is OK, but getting good at it is hard, really hard, mastering it is impossible for me. similar can be said to rust as far as I can tell. even python has some "tricks", try "x=256; y=256; x is y" and "x=257, y=257, x is y" under python, or 'x=[]…

> I feel golang has the right trade off for programmers

Have you tried Clojure?

Re: Rust in Large Organizations

#50
post #5

Earlier quoted context omitted.

A slight difference is that Rust really wants to be the top level compiler. More than a lot of languages, even C++, it really relies on link time optimization to get the perf you'd expect.

How this is more true of Rust than modern C++?

Most "modern" C++ involves template metaprogramming of a sort that is in header file, so the modern aspect doesn't stand to increase the need for LTO that much.

I would imagine that Rust programs benefit from LTO by removing static assertions necessary for memory safety that C++ programs simply omit, and by unraveling functional style code that Rust programs often get shoehorned into. Or maybe not, but that's one non-LTO that's needed.

Post reply on HN