Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
v2/src/services/logger.zig
Outdated
| prng_state: []const u8 = &.{}, | ||
| }; | ||
|
|
||
| pub fn main(writer: *std.io.Writer, ro: ReadOnly) !noreturn { |
There was a problem hiding this comment.
Please choose a different name. main has a very specific meaning and this does not conform to the pattern. My preference would be run but there are many other acceptable options.
some ideas:
- run
- entrypoint
- run_service
- service_entry
- service_main
There was a problem hiding this comment.
main has a very specific meaning and this does not conform to the pattern.
I don't really agree with this - every programming environment has its own idea of what main means; even zig has multiple kinds of main functions.
We're basically opting out of Zig's start.zig and using our own startup code instead. So I think the name reflects well?
There was a problem hiding this comment.
Sure we could reinterpret the word main because we have a different startup, but I just don't see the point. I only see potential for confusion. I don't see any compelling reason why the word main is better than any of the other names I've suggested.
There was a problem hiding this comment.
I prefer 'main'. What specific meaning are you referring to that does not conform to this pattern? In this context it is the entry point to a service which is intended to run as isolated process. Personally I don't see what is confusing about it or how any of the suggested names are an improvement
There was a problem hiding this comment.
The problem is simply that it's a source of confusion. The word "main" is almost always used make it so the file can be compiled to a standalone binary executable using the standard build process. That's not what's going on here. I don't see why you would use the word "main" to mean something different than what it's normally used for, when you have the freedom to select any name, and there are actually more descriptive names you could choose. This already caused confusion when this was demoed to the team with multiple people making wrong assumptions about how this code works because of this name. I don't want to use a name that I know is going to confuse people when there are equally valid alternatives that are less confusing.
There was a problem hiding this comment.
I'll pitch in my opinion:
main as a symbol, by default, in most (overwhelming majority?) programming languages is the the executable entry point when your code is compiled and linked. If main isn't the entry point for the executable then I don't think we should use main, it can only add confusion.
Using service_main, service_entry, {service_name}_entry etc. will communicate the same thing, and eliminate any possible confusion to those coming from other projects or languages.
There was a problem hiding this comment.
I don't mind. Anything works
There was a problem hiding this comment.
I feel strongly that this should not be named main. I'm fine with a variety of other options.
v2/src/services/net.zig
Outdated
| const MAX_SOCKETS = 10; | ||
|
|
||
| /// `ports` is the list of ports it'll listen on. | ||
| fn tile(pairs: []const *Pair) !noreturn { |
There was a problem hiding this comment.
let's avoid this name too. also why does this function need to be separate from the function above?
| .zig-cache/ | ||
| zig-out/ No newline at end of file |
There was a problem hiding this comment.
I think this belongs in the root .gitignore
There was a problem hiding this comment.
it's fine to have multiple, conceptually this is a different project, this follows the same pattern as the conformance folder
There was a problem hiding this comment.
I understand it's fine to have multiple, but if the root project had the same lines in .gitignore, then adding these lines here would have no effect. It's in the same monorepo so it's not realistic to try to create a .gitignore as if this is an isolated repo. I don't see the benefit to this redundancy.
There was a problem hiding this comment.
I don't have a strong feeling that we need to remove this file. My main concern is that we have inconsistency in our approach and it feels slightly chaotic. In here, and in conformance, we ignore these names at any nested level, but in the root we only ignore them if they exist at the root level.
My thought is that the approach here is actually good: we shouldn't be committing folders called .zig-cache or zig-out regardless of where they are. The problem is that it's only being applied locally in a few places. I'd rather use this as the general approach. So I would change the repo root's .gitignore to follow this same pattern. Once we do that, there's not really a need for this file. But deleting this file isn't necessary my goal here, so I'm open to leaving it if you see some good reasoning for it to exist.
Working
Example output:
What a minimal service looks like: