4 ms·
I'm a bit confused about the type system rant - and someone correct me if I'm wrong: The whole point of protobuffs is that they're easily usable in multiple pro
by izacus 7y ago
I'm a bit confused about the type system rant - and someone correct me if I'm wrong:
The whole point of protobuffs is that they're easily usable in multiple programming languages, so it seems to me that they kinda have to end up being the smallest common subset of typing features. If you try to do it strongly, they'll be hard to use in some languages (e.g. Java, the favorite beating horse of the OP and other language purists) or they'd have to restrict the amount of programming language targets.
Where am I wrong?
- ves 7y agoYou could have the type model mentioned in this post in nearly all languages as well.
- deleted 7y ago[deleted]
- izacus 7y agoYes, you could and that would certanly improve things (I'm not a fan of these restrictions either). But you'd still have a rather Java-ish type system right?
- wbl 7y agoYou can always turn the authors imagination of protobuffs into a tree and walk it if you have problems. Also you could use a better programming language.
- tjpnz 7y ago>The whole point of protobuffs is that they're easily usable in multiple programming languages, While that's true in theory there are issues in practice. It's especially true if you've had the misfortune of working with the Python or PHP compilers. Documentation isn't particularly great and I do recall a time when the Python compiler was generating code that was broken and required manual tweaks. Again in the case of Python things go even further downhill if you're trying to get everything working in a Docker container. Things are of course significantly better if you're working in Go or Java.
- kortex 7y agoPython3 relative import syntax was flat out broken for years [0][1]. It's workable finally (not sure which PR fixed it) but it's still a monster to try to get protoc/grpc plugin to emit _pb2.py files which a) have correct import syntax b) have a top-level package name c) are readily packageable for pip install d) do all the above in a reproducible and uninstallable manner e) also be able to import 3rd party protos f) all the above without any post-processing. Like, yes python constrains package names to the folder names. But why not check a flag so I can let the emitted python structure dominate the folder structure? Or, easier, just let me ignore the folder structure and specify a dang top-level-package in the emitted _pb2.py and let me wrangle it with setup.py? [0] - https://github.com/protocolbuffers/protobuf/issues/90 https://github.com/protocolbuffers/protobuf/issues/90 [1] - https://github.com/protocolbuffers/protobuf/issues/1491 https://github.com/protocolbuffers/protobuf/issues/1491
- sosodev 7y agoI had the displeasure of working with gRPC and Python as an intern. I ended up writing a makefile that would generate the files and then immediately run sed on them to fix their imports. It felt like a terrible hack and I hated having to do it. What’s worse is my overall task was to come up with ways of doing this type of thing reproducibly in a bunch of different languages that had poor gRPC support so that the team could distribute consistent (and verifiably working) API bindings to other teams. At that point it felt like we probably should have conceded that gRPC sucks and not used it at all. I’m 99% sure it was just resume driven development by the lead dev.
- zomglings 7y agoYep, that make + sed combination is exactly what I do every time I use protobuf in Python.