4 ms·
Excuse me, what do you mean by 'replace all stdlib datatypes with your own implementations'. Why would I do that?
by cube2222 10y ago
Excuse me, what do you mean by 'replace all stdlib datatypes with your own implementations'. Why would I do that?
- kuschku 10y agoTo interface via an FFI with a game engine, which uses a custom allocator, and you need to pass datatypes between it and your own code? (As I’ve done in Java!) To replace existing implementations with your own, because you want a LinkedArrayList (a linked list of blocks)? Or because you want a TreeMap instead of a HashMap, or a Set with different implementation? Because you want to implement your own Either type to better handle return values (see https://github.com/spencerwi/Either.java https://github.com/spencerwi/Either.java )?
- cube2222 10y agoThis is an interesting point actually. Because it gets raised every time and I actually thought the same before starting with Go. Thing is, in practice you usually don't need special generic containers. And when I actually need it, I'll just code up a non-generic implementation. When I need a complex type system I'll use Scala.
- kuschku 10y agoWell, I use them a lot – I’ve written lots and lots of generic code in my projects, and reuse it across many dozens of projects. This allows me to have fully reactive collections in Java, lazy reactive collections, and more. I can just connect to a socket transmitting updates with netty, write a transformer, apply those to a lazy reactive collection, and have the changes directly appear in the list in the UI, fully threadsafe. Writing those things again, and again, every time, would be far more work, and increase the time I need to write code massively. I’ve actually used go a bit, and tried reimplementing several of my projects in go, but either it wasn’t easily possible, or I had to translate dozens of generic classes into hundreds of non-generic versions, with lots of duplicated code. And then I had found a bug, fixed it at one point, and had to copy it to hundreds of files.
- cube2222 10y agoI'd love to take a look at your codebase if it's hosted on github (or something comparable).
- kuschku 10y agoCurrently not, as I only used it in smaller projects in the past. In the future I’ll use it likely with QuasselDroid-NG, an app of mine that’s very early in development, and for which I developed it. The use case there is that we have a list of IRC messages, constantly updating and adding messages at any point of the list, and we want to update the UI and animate. The client can also cache, or preload, messages at any point, or throw them away. Additionally, users can filter, search, or choose to disable some messages. Other messages might get merged, or synthetic ones inserted. So I have a backing store of messages that can constantly change, I have on top of that a stream of transformations taking part, and on top of that an interface presenting a single, consistent Java List, but also triggering the relevant updates on Android’s recyclerview. Most importantly, you can just add a message to the lowest list, it will be properly filtered, transformed, animated, and displayed, and this properly threadsafe across UI thread, backend thread, and filtering threadpool, while being faster than the solutions Realms and co provide for such updated UI.
- cube2222 10y agoI'm not sure if I understand, are you actually using Go for your UI backing or using it as a backend for your application?