1,656 karma · joined Mar 24, 2014 (12y ago) · 1,717 submissions
comment 3y ago · link · parent
I picked up a habit in Go package design which I now apply everywhere: one of my immediate first thoughts when evaluating a library is how it creates or uses threads.
When I see that a library wants to consume all of the available cores of my system, or uses an internal task scheduler or threading mechanism, I worry that it will compete for CPU time with the other processes, threads, etc. that my system and process are using.
On the other hand, I appreciate when a library exposes an interface for me to offer it threads or a scheduler, or even better if it offers primitives that I can use directly in my own threads or tasks.
Perhaps this is mainly a problem for high-concurrency servers and UIs, but it’s always one of my first thoughts, and Rust is an ecosystem which needs to support those usecases. Many threaded libraries, even otherwise very good ones, are not designed with this in mind and it is a problem.
comment 3y ago · link · parent
comment 3y ago · link · parent
On the other hand, it made me think a lot about computer memory, and it makes computer memory easy to work with. Now I’m really comfortable with memory and encodings so that’s nice. I don’t think I would have gotten that by starting with Java or Python.
comment 3y ago · link · parent
```
type Iter[T] interface { More() bool It() T }
type mapOver[T] struct { Iter[T]; func (T) T f }
func (m mapOver[T]) It() T { return m.f(m.Iter.It()) }
func Map[T] (it Iter[T], f func(T) T) Iter[T] { return mapOver{it, f} }
type Range { to, at int }
func (r Range) More() bool { return r.at < r.to }
func (r Range) It() (is int) { is = r.at; r.at += 1 }
func DoEach[T] (it Iter[T], f func(T) T) { for it.More() { f(it.It()) } }
// etc
iter.DoEach(iter.Range(10), fx.Stdout(fns.MultBy(2)))
// or whatever
```
Translating to English:
If you can do it just fine with the syntax you have, why do you need to add it to the core language?
comment 3y ago · link · parent
I’m not really convinced because in Andrew’s livestreams he’s actively uncovered significant stdlib bugs that he is aware of and tables for later.
Hopefully those will all be gone by 1.0, but I doubt it. For now, I cannot consider it a viable alternative to anything for production software. I do hope it will be some day, because it’s a nice language, even if it has a few syntactic warts :)
that said... I feel safer choosing C89 or C99 for certain things due to its extremely wide availability and longevity.
It’s great for it to have competitors, but C and C++ are more like standards and less like one tool with a handful of people working on it.
comment 3y ago · link · parent
comment 3y ago · link · parent
FWIW, gRPC certainly has this problem too, but it’s very clearly distinct from protobuf, although pb has gRPC-related features.
That entanglement makes me lean towards flatbuffers or even protobuf every time I weigh them against capnp, especially since it means that fb and pb have much simpler implementations, and I place great value on simplicity for both security and maintenance reasons.
I think the lack of good third-party language implementations speaks directly to the reasonability of that assessment. It also makes the bus factor and longevity story very poor. Simplicity rules.
comment 3y ago · link · parent