3 ms·
> Functions are camelCase > Types are PascalCase > Variables are lowercase_with_underscores Just why? It does not seem like the same language that used to tr
by nromiun 4y ago
> Functions are camelCase
> Types are PascalCase
> Variables are lowercase_with_underscores
Just why? It does not seem like the same language that used to treat tabs as a compiler error. Looks like the worst of every worlds to me. Why not just stick to one style?
- TeaDude 4y agoDid they remove that? I thought that tabs were still forbidden...
- nromiun 4y agohttps://github.com/ziglang/zig/issues/544 https://github.com/ziglang/zig/issues/544 Maybe? They say their stage2 parser accepts them now.
- generichuman 4y agoI don't see what's the problem here. That style has the advantage of being able to look at any identifier and understand whether it is an fn, a type or a variable.
- nromiun 4y agoIsn't fn and () already doing that for functions? Anyway, I just think it is a weird style for a minimalist language. Edit: Looks like they are already aware of the problem. That is good news. https://github.com/ziglang/zig/issues/1097#issuecomment-614260816 https://github.com/ziglang/zig/issues/1097#issuecomment-6142...
- canadianfella 4y ago[dead]
- zamalek 4y agoLike int_age and string_name make the type of a value obvious? Hard pass.
- throwawaymaths 4y agoit's a convention, not enforced. You can do whatever you want with names. These are just guidelines.
- claytongulick 4y agoIt's helpful when reading code. I actually use this approach in my style guides for my teams writing js too. Once you get used to it, it's quite pleasant. In js you run into some grey areas, like function type callable variables that look weird, but still make sense when named well: click_handler() read_complete_callback()
- randyrand 4y agoI’ve written 100k lines of C code the past 2 years, and this is also the convention I use. It’s quite nice to work with, and comes naturally after a short while.