ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
notzmv has quit [Remote host closed the connection]
nvmd has quit [Quit: Later nerds.]
ur5us has quit [Ping timeout: 264 seconds]
xackus__ has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
notzmv has joined #zig
notzmv has quit [Read error: No route to host]
<andrewrk> 17 failing zig fmt test cases left
notzmv has joined #zig
notzmv has quit [Read error: No route to host]
_whitelogger has joined #zig
earnestly has quit [Ping timeout: 260 seconds]
craigo_ has quit [Ping timeout: 256 seconds]
fengh has quit [Ping timeout: 240 seconds]
squeek502 has quit [Remote host closed the connection]
squeek502 has joined #zig
notzmv has joined #zig
sebonirc has quit [Quit: sebonirc]
ur5us has quit [Ping timeout: 264 seconds]
ur5us has joined #zig
leon-p has joined #zig
blueberrypie has quit [Quit: leaving]
blueberrypie has joined #zig
swills has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 260 seconds]
<g-w1> andrewrk: for #786, I think a builtin @setGlobalErrorSize would be better than a pub const - how would the logic in main.zig work?
<andrewrk> g-w1, I don't understand your question
<g-w1> also is this a language feature, or impl feature? if its a builtin I assume the spec will define it, if not idk. I think the default of u32 will be in the spec
<g-w1> sorry, s/main.zig/start.zig
<g-w1> or will it just be magic that if it sees ErrorIntegerType it does fancy stuff?
<g-w1> looking to see how panic works, thuoght it was in start.zig
<g-w1> its not in debug.zig either?
<g-w1> ah in builtin.zig, so its still in userspace. would this be passed to the compiler somehow?
<g-w1> oh not entirely in userspace since the compiler sees it -- so it could be done
<g-w1> I will make a pr making the default u32 and cleaning some error stuff up, but we need to get a little farther for that to work fully in stage2
xackus__ has joined #zig
<daurnimator> g-w1: something I've been thinking about for a while is a way to actually set error integers for performance reasons
<daurnimator> e.g. it would be beneficial if error.PermissionDenied was 1; so that its "free" to convert errno to a zig error number
<g-w1> like per function?
<daurnimator> g-w1: no globally
<daurnimator> okay I have a proposal to add to #786
<noam> daurnimator: the issue is that errnos don't map 1:1 to errors
<noam> A single errno value can actually indicate multiple errors
<daurnimator> noam: yes... but at least those are usually exceptions/in the minority
<noam> That doesn't seem good enough to me.
<noam> If errno→error conversion is context-dependent, we shouldn't say "99% coverage is good enough"
<daurnimator> noam: I'm approaching this purely from a performance and binary size side of things
<g-w1> so this would make @errorToInt of one of those special values just return the value?
<g-w1> but other errors would also work?
<daurnimator> g-w1: huh?
<daurnimator> g-w1: see what I added to #786
<g-w1> like @errorToInt(error.PermissionDenied) == std.os.EPERM?
<daurnimator> g-w1: yes that would be true (if you specified that mapping)
<daurnimator> I believe that @errorToInt isn't comptime known.
<g-w1> but if a mapping was in the _ part of the enum, the compiler will choose how it is?
<daurnimator> g-w1: yep
<g-w1> it is comptime known
<g-w1> but i dont see how that is a problem
<daurnimator> I was thinking to avoid cycles; but I guess we can detect those in other ways
<daurnimator> e.g. would need to detect cycle of: `pub const ErrorSet = enum(u16) { Foo = @errorToInt(error.Foo), _}`
<daurnimator> or maybe its not a cycle and just latitude to invent a number? all values satisfy that relation :P
<g-w1> that would also simplify the proposal because then you can do enum(u32) { _ } to declare the size
<daurnimator> g-w1: yes that was my intention
<g-w1> ok cool
<g-w1> oh didn't see the first example :)
<watzon> Hmm. Just tried to install Zig from Homebrew on macOS Big Sur and I get `Unable to find library for -lSystem`. Anyone know of a fix for this?
<watzon> Same happened when using Zig installed from ASDF
<watzon> `ZIG_SYSTEM_LINKER_HACK=1` seems to make no difference either
<mikdusan> watzon: likely the version of Zig on homebrew isn't new enough
<mikdusan> if I read homebrew correct, 0.7.1 zig is our latest release, but for Big Sur we have some things in master that are required. So either get on master, or wait for next rel cycle
<watzon> Seems like it's an issue with 0.7.1
<watzon> I guess I'll get on master
<mikdusan> interesting. homebrew also uses llvm-11.1.0 as dep for zig 0.7.1. me shrugs.
bitmapper has quit [Quit: Connection closed for inactivity]
<watzon> Well master seems to work at least
<watzon> Damn macOS just had to go changing things in Big Sur. I've had so many issues.
wilsonk__ has quit [Ping timeout: 240 seconds]
swills has joined #zig
swills has quit [Ping timeout: 260 seconds]
<siraben> watzon: oof, you upgraded?
<siraben> These days I hold off upgrading until about a year after
waleee-cl has quit [Quit: Connection closed for inactivity]
<andrewrk> ifreund, when you get a chance, I have an open question for you re: zig fmt test cases that I would value your opinion on what the expected result should be (see latest comment in the thread)
<andrewrk> anyway, I'm done for the day. we're down to 11 failing test cases in the branch
<watzon> Yeah. I tend to always upgrade right away. Bites me in the ass sometimes
swills has joined #zig
sord937 has joined #zig
<watzon> Is there a good way to add extra information to an error type? For instance, in Rust errors are enums which are abstract data types which can include extra metadata.
swills has quit [Ping timeout: 264 seconds]
tnorth has joined #zig
<andrewrk> watzon, not other than the manual way
mjsir911 has quit [Quit: Goodbye, World!]
mjsir911 has joined #zig
neptunepink has quit [Ping timeout: 265 seconds]
ur5us has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
swills has joined #zig
midgard has quit [Read error: Connection reset by peer]
midgard has joined #zig
swills has quit [Ping timeout: 240 seconds]
swills has joined #zig
swills has quit [Ping timeout: 265 seconds]
earnestly has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
craigo_ has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<karchnu> hugo is nice, it reminds me of Zola
geemili has quit [Ping timeout: 272 seconds]
<ifreund> isn't zola the RIIR version of hugo?
<dutchie> i'm sure hugo was one of the first SSGs
<karchnu> ifreund: possible, I really didn't search much for a SSG, I kinda took one of the first that came in my way
knebulae has joined #zig
bitmapper has joined #zig
Swahili has joined #zig
swills has joined #zig
mikdusan has quit [Ping timeout: 265 seconds]
Swahili has quit [Remote host closed the connection]
mikdusan has joined #zig
Snaffu has joined #zig
<g-w1> for #786, what should the max error set size be? I can see anyone using > u64
<g-w1> s/can/cant
<ikskuh> heh, i can't anyone see using more than u32
<ikskuh> getting to error set size to u32 requires already ~30 gigs of ascii source text
<ikskuh> a sorry. i forgot. 34 gigs. we require commas to declare them :D
* yeti . o O ( "640k should be pretty much for everything" )
<g-w1> ok, if it is u32, then i think the compiler can just use that as the max and not have to do any fancy data structures
<g-w1> with a string hash map
<ikskuh> i think it should still be as small as possible
<ikskuh> AVRs would hugely benefit from u8
<viashimo> what's an AVR?
<g-w1> ofc, but in the compiler impl, I dont think we need to go out of our way to make the memory usage as small as possible with these error sets. like a []const u8 -> u32 mapping would be enough
<ikskuh> AVR is 8 bit cpu, we have a backend for that already
<ikskuh> ah yeah
<yeti> nice ctitters
<ikskuh> btw, for the log on how to get those numbers: (ceil(log(2*26+10;1<<32)) + 1) << 32
<ikskuh> "how many letters and numbers do we need to encode 2^32 different options", (this value + 1) times 2^32 because we also encode each of those and separate them with a comma :D
<g-w1> also what was the reasoning for defaulting to u32? I think u16 is a good default since most programs will never hit u16 let alone u32
fengh has joined #zig
Miaourt has quit [Quit: Bye!]
amk has quit [Ping timeout: 256 seconds]
waleee-cl has joined #zig
<tnorth> Hey there. Could someone tell me why I get "error: use of undefined value here causes undefined behavior" (line 9) in this minimal program?
<ifreund> tnorth: I think you want init() to return @This() not type
<ifreund> well, would need to be an error union since you use `try` in the function
<tnorth> ifreund: thanks. I'm a bit confused about "type"
<tnorth> + the allocator doesn't return the right type....
<g-w1> type means that it returns a type like u32, struct {}, enum {}, not a value like an instance of a struct
<ifreund> tnorth: you probably want ?[]@This() not ?*[]@This()
<tnorth> g-w1: understood, thanks!
<ifreund> (for the children field)
<tnorth> ifreund: thanks. I still get "error: expected type 'Cell(2)', found 'std.mem.Allocator.Error'"
<g-w1> use try
<ifreund> tnorth: the return type of your function needs to be an error union because you are using try
<tnorth> fn init() ?@This() doesnt' seem to work
<ifreund> e.g. !@This(), or error{OutOfMemor}!@This()
<ifreund> ? is for optionals not error unions
<g-w1> fn init() !?@This()
<tnorth> oh... !
<tnorth> my bad...
<tnorth> ok thanks a lot.
amk has joined #zig
<tnorth> btw, what would be the difference between using [*]T or []T in this case?
<g-w1> the latter stores the length the former does not
<ifreund> []T is like a struct { ptr: [*]T, len: usize }
<tnorth> make sense, thanks
craigo_ has quit [Quit: Leaving]
craigo has joined #zig
<tnorth> And last question, when assigning explicitely values to a slice, is it possible to omit the type? foo = [_]{1,2,3} doesn't work, but foo = [_]u8{1,2,3} does. If the type of foo is already known, this should be possible?
<g-w1> foo = .{1,2,3};
<g-w1> but if its a slice you probably want foo = &.{1,2,3};
<tnorth> g-w1: thanks again!
nvmd has joined #zig
<v0idify> how do i tell build-exe to save the output somewhere specific?
<v0idify> or is there a way to make zig run return an error if the underlying program fails?
<ifreund> -femit-bin=foo gives you full agency
wilsonk has joined #zig
Akuli has joined #zig
TheLemonMan has joined #zig
<v0idify> why when doing zig build-exe src/file.zig it writes zig-cache in src/?
SimonNa has quit [Remote host closed the connection]
<g-w1> yes, if your cwd is src it does.
<g-w1> there is no concept of a project root with build-exe
SimonNa has joined #zig
<ikskuh> you can set the cache dir manually though :)
Techcable has joined #zig
<mikdusan> even with an ENV var
neptunepink has joined #zig
<v0idify> g-w1, cwd is not src, that's why i'm saying
<v0idify> cwd is src/..
nycex- has joined #zig
hnOsmium0001 has joined #zig
nycex has quit [Ping timeout: 268 seconds]
<g-w1> oh yeah, thats probably a bug. just tried it
<TheLemonMan> no bugs, only features
<v0idify> it's features all the way down
<karchnu> from time to time in the overview page, there is a mention about the freestanding target. I took the liberty to put a word or two to explain it in the french version.
Techcable has quit [Ping timeout: 240 seconds]
geemili has joined #zig
marijnfs has joined #zig
<karchnu> is that okay to you?
<marijnfs> heya, how do I get the showtime discord?
<g-w1> the discord link here
Techcable_ has joined #zig
<marijnfs> ah thanks!
<g-w1> marler8997: I am trying to add github actions check and deploy binaries of zigup, can I add more steps besides x86-linux to the github release step?
<g-w1> if so, does it work on windows yet? should I add windows?
SimonNa has quit [Ping timeout: 260 seconds]
SimonNa has joined #zig
<g-w1> seems like it doesn't even compile for windows because of the symlink stuff
<ifreund> g-w1: oops, thanks for the catch
<ifreund> now the commit history is messy :/
<marler8997> it doesn't work on windows yet
<TheLemonMan> that's when you rebase everything (and end up losing a few commits)
<g-w1> marler8997: ok I will just do macos and linux for now
<g-w1> ill test on mac first though
<marler8997> ok, which backend are you going to use though?
<marler8997> would be nice to either use iguana or bearssl I think, for the prebuilt-binary backend
<ifreund> TheLemonMan: this branch is being pushed to by at least 3 people so rebasing isn't a great idea :/
<marler8997> but iguana not working yet
<marler8997> and bearssl also not working, need to figure that one out
<ifreund> maybe andrew will give it a quick pass before merge
<g-w1> iguana
ky0ko has quit [Ping timeout: 265 seconds]
<TheLemonMan> that's when you #yolo and rebase everything
<ifreund> yeah just squash the current 154 commits in to one to keep things clean amiright?
<g-w1> ah, are there any backends that work and are statically linked?
<TheLemonMan> I still have 'nam flashbacks of trying to rebase some commits in Fossil
<ifreund> what made you use fossil?
<marler8997> g-w1, that's why I was saying bearssl and/or iguana, because they can be compiled statically
<TheLemonMan> hard drugs (and people already using that)
<TheLemonMan> git makes the most sense to me, despite not making much sense
<ifreund> the core concepts and data structures of git make a lot of sense to me
<ifreund> I've come to think that the cli is mostly garbage though despite being pretty good at it by this point
<TheLemonMan> yeah, the cli is the bottleneck
<TheLemonMan> speaking of pull requests, #7844 got no feedback (except for ikskuh, but I explicitly asked his two cents)
<g-w1> ah, so we have no working static backends yet. I guess I will wait for that issue to be resolved in iguana.
frmdstryr has joined #zig
<ifreund> TheLemonMan: what's up with the extern struct wrapper for os.socket_t?
<g-w1> marler8997: what was wrong with bearssl? it seems like you fully nuked it?
<TheLemonMan> ifreund, future proofing
cole-h has joined #zig
<TheLemonMan> I installed Age of Empires II for nostalgia sake but I keep getting my ass handed to me, I didn't remember the game to be so hard
<TheLemonMan> or maybe I'm just bad at it
<Amun_Ra> AoE DE has new AI, much better than the old one
<Amun_Ra> s/old/original
<earnestly> TheLemonMan: ikr
<TheLemonMan> the DE looks cool _and_ it seems to work on Wine, interesting
<TheLemonMan> is this how I die?
<ikskuh> heya TheLemonMan!
<TheLemonMan> ohai
<ikskuh> sorry for my sparse response on #7844 btw
<TheLemonMan> I do appreciate your input both there and in the associated ticket :)
<ikskuh> thanks :)
<ikskuh> i want to get zig-network to replace eventually, but i think there have to be a lot of redoing though
<ifreund> andrewrk: down to 5 zig fmt test cases if we just delete that empty comment one
<ifreund> we could also remove empty line comments only at the start/end of several consecutive line comments without causing other test cases to fail, but I'm not sure if that complexity would really gain us anything
<ifreund> I'm off to make dinner now though, then I'll see if anything can be done about the "comments in field access chain" test case
<watzon> Someone remind me. If I want a struct to have a field which is a `[][]u8` the best way to do that is to have an `ArrayList([]u8)` right?
<ikskuh> just use [][]u8 ?
<ikskuh> or should it be a list of strings?
<ikskuh> like, resizable, dynamic list?
<watzon> It's a list of strings
<watzon> Dynamic, but after the creation of the struct they shouldn't be modified. I just don't know until the struct is intialized how big the list will be.
<ifreund> only reason to use ArrayList is if you want it to be resizeable
<ifreund> sounds like you just want [][]u8
<watzon> Hmm ok. Makes sense.
<ifreund> or perhaps [][]const u8
<watzon> `const` would mean that I know the string values at compile time though, wouldn't it? In this case the strings are coming from a parsing operation, so they'll be known at runtime.
<watzon> Granted it's been a bit since I've used Zig. Trying to get back into it.
<ifreund> []const u8 means that you can't modify the data stored in the slice
<ifreund> the data doesn't need to be comptime known
<ifreund> actually that's not 100% correct, const only means that you cant modify it through this handle, there may be some other mutable pointer to the same data
<watzon> Ahh ok. Good to know.
<ikskuh> TheLemonMan: have you taken a look at my PR?
<TheLemonMan> ikskuh, the one that's failing the CI?
<ikskuh> yep ^^
<ikskuh> oh, i see a cli invocation in there
<ikskuh> going to trigger it
<ikskuh> ah, found the mistake :)
<marler8997> g-w1, not sure, it should be working but for some reason it's failing
<g-w1> ok
* andrewrk rolls out of bed
<ikskuh> good morning andrewrk!
<watzon> Mornin Andrew
<andrewrk> morning!
<watzon> Well, afternoon anyway
<andrewrk> good time of day to you, wherever you are!
<ikskuh> "late evening"
<andrewrk> ifreund, don't forget to run `./zig build test-translate-c test-run-translated-c` in that branch now :D
notzmv has quit [Remote host closed the connection]
<andrewrk> uh and `make` before that
notzmv has joined #zig
<marler8997> I'm developing a new scripting language to replace my BASH scripts:
<marler8997> Might be time for me to pick a far my best idea is "stitch". Any suggestions?
<watzon> Stitch isn't a bad name. Would make a cute mascot too.
<watzon> Are you planning on writing it in Zig? I see you have the prototype in Python,
<marler8997> probably
<marler8997> might also go with C
<marler8997> I'm hoping by the time it's done it will be easy to implement, maybe I will have both
<marler8997> I incorporated alot of the same ideas/Zen from Zig into it's design, still not done yet though
nycex has joined #zig
nycex- has quit [Ping timeout: 268 seconds]
tnorth has quit [Ping timeout: 258 seconds]
ky0ko has joined #zig
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
<andrewrk> "stitch" has a nice ring to it
<marler8997> yeah ok, stitch it is then
<ikskuh> yep, i like it too
<marler8997> andrewrk, how did you come up with the name Zig?
<ikskuh> marler8997: are you writing a script language or an interactive shell?
<marler8997> ikskuh, just a scripting language, not an interactive shell, in fact I explcitly mention it's not meant to be interactive
<g-w1> iirc he just used a random python script
<ikskuh> ah
<ikskuh> marler8997: i wanted to write a small shell for myself in zig
<marler8997> rename complete, feedback welcome but alot of things are still being worked through:
<marler8997> ikskuh, I've written multiple small shell languages, it's a very hard problem to get right I think
<ikskuh> yeah, i know
<ikskuh> that's why i don't even have a project folder yet :D
<marler8997> I'm hopeful I'm finally close to something good
<marler8997> The stuff I've learned from Zig may have been the secret sauce I needed
<ikskuh> hehe, i can imagine
<ikskuh> zig has a very positive influence on people
<ikskuh> i see it on myself a lot
<marler8997> wait that script creates 4-letter names....?
<andrewrk> *shrug* I can't explain that
<andrewrk> I don't even remember making this gist
<marler8997> zega, ooo
<ikskuh> i started rewriting every code that uses exceptions at work when i have the time to :D
<marler8997> zude
jokoon has joined #zig
<marler8997> this script would be perfect for custom zig projects
<ikskuh> zune?
<ifreund> andrewrk: whoops, thanks for the fix
<marler8997> maybe you didn't have the 'z' prefix originally
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<marler8997> nah that's not it, maybe c2 didn't exist
<mikdusan> maybe the result `zigg` came in
<marler8997> ahhh
<ifreund> andrewrk: are the translate-c tests passing for you after your latest commit? they fail for me...
<ikskuh> also a good advice: rewrite every boolean that is not a boolean value (is_foobar) into two-item booleans (.foobar, .barfoo)
<marler8997> to-item enums you mean?
<marler8997> *
<ikskuh> yeah LOL
<ikskuh> i just changed a parameter in the build stuff from "is_dynamic" to enum{dynamic,static}
<ikskuh> now 100% more readability
<ikskuh> createExecutable(builder, "foo", "file", true) // what is this now? :D
<marler8997> Zig's ability to allow ".dynamic" really makes that work well
<ikskuh> yeeeees <3
<ikskuh> i love enum literals so freaking much
<marler8997> otherwise, you have to potentially import a type and qualify it
<andrewrk> ifreund, no they are failing for me:
<ikskuh> yep, even then it's better
<andrewrk> nice thanks for that api improvement ikskuh
<andrewrk> looking forward to these build.zig changes
<ikskuh> i do a lot of api improvements on my way through :)
<ikskuh> also still +916 −920
<ikskuh> andrewrk: i'm currently fighting the CI :D
<ikskuh> (well, it triggers certain errors i didn't have locally)
<ifreund> andrewrk: hrm, mine are failing on a different test
<andrewrk> ifreund, well I guess we have our first WTF bug of the branch
<andrewrk> I'll look into it
<ifreund> usually I just go "it's probably lastToken() or firstToken()"
<ifreund> not this time though :P
<ifreund> andrewrk: my output if it's useful:
<andrewrk> thx
<andrewrk> so strange that it's different for vexu, you, and me
<ifreund> yeah, and I'm assumin we're all still on x86_64 glibc linux
<andrewrk> yeah, and the translated C code isn't from an h file
<andrewrk> so that shouldn't matter regardless
<ifreund> very weird indeed :/
<andrewrk> idk where the non determinism is coming from. valgrind is clean
<andrewrk> I'll just step into it with a debugger and understand why it's doing what it's doing
<andrewrk> ifreund, hmm I'm getting different results with a clean build
<ifreund> as in all zig-caches nuked or the cmake build dir as well?
ur5us has joined #zig
<andrewrk> just the cmake build dir
<ikskuh> how long does a typical CI run take?
<andrewrk> ikskuh, 2 hours
<ikskuh> damn
<andrewrk> you can run it much faster locally by only testing the thing you are changing
<ikskuh> i survived the first 20 minutes
<andrewrk> most of the time is spent on various combinations of -lc, --single-threaded, -O modes, and different targets, for behavior & std lib tests
<ikskuh> andrewrk: i have no idea what will break
<ikskuh> but i think i survided
<ikskuh> all use of the build API :D
<andrewrk> if you look at the --help menu you can see the test categories
<andrewrk> I recommend to run these locally: test-standalone test-cli
<ikskuh> "test" and "install" both run :D
<andrewrk> like this: `./zig build test-standalone test-cli`
<andrewrk> should be relatively quick, tests some build.zig stuff
<mikdusan> this undertministic thing.. not sure if it helps:
<ikskuh> yeah locally everythin was right
<ifreund> andrewrk: I get the same as you with a clean build
<g-w1> ill try too :)
<andrewrk> mikdusan, this looks like you didn't run make
<andrewrk> or running a different zig lib dir than expected
<andrewrk> the top arrow should be pointing at an unreachable
<g-w1> I get this too: /home/jacob/dev/zig/lib/std/zig/ast.zig:871:21: 0x94fb31 in std.zig.ast.Tree.lastToken (zig1)
<ifreund> hrm, looks like I need to rebuild stage1 to test this
<andrewrk> the translate-c code needs to get updated to not use the _trailing or _comma when there are 0 elements
<ifreund> this panic is probably my fault though, it happens cause a container_decl_two_trailing has no members
<andrewrk> foo(,) does not make sense - the translate-c code should be updated IMO
<ifreund> yeah that makes sense
<andrewrk> but I'm still confused why a clean build was required to properly reproduce the error
<ifreund> I for one wasn't rebuilding stage1 to test stuff
<g-w1> a ninja and ./zig test ... was all it took for me. is that clean?
<mikdusan> (and my clean builds get that unsync'd source code dump)
<ifreund> but to modify the translate-c code a stage1 rebuild sees to be necessary
<andrewrk> hmm I think I know the problem
<andrewrk> daurnimator is gonna say "I told you so"
notzmv has quit [Remote host closed the connection]
<andrewrk> our list of .zig files that trigger a stage1 rebuild is incomplete, and does not include vexu's new translate-c ast file
<mikdusan> oh that thing. oh my
<andrewrk> :-O never mind! it's in there
<g-w1> 🤯
<andrewrk> alright well I pushed a fix. I still can't explain what happened with the non-clean builds. the fix works in my non-clean build directory though.
<andrewrk> alright! *rubs hands* only 7 more test cases to go!
<ifreund> thought it was 5?
<ifreund> maybe I can't count though :D
<andrewrk> uh I think it's me who can't count!@
<andrewrk> lunch break, bbiab
<ifreund> o7
tracernz has quit [Ping timeout: 265 seconds]
r0bby has quit [Ping timeout: 265 seconds]
kushalp has quit [Ping timeout: 268 seconds]
r0bby has joined #zig
tracernz has joined #zig
<g-w1> wat I think this should be allowed
kushalp has joined #zig
<g-w1> is there a better way to do this?
wootehfoot has joined #zig
<g-w1> making code to convert an enum to an error set
midgard has quit [Remote host closed the connection]
midgard has joined #zig
notzmv has joined #zig
<g-w1> oh, found a way around it, but I still think it should be allowed
<ifreund> I don't think so, @field(ErrorSet, "foo") works
<ifreund> the keyword error is not a container though
<g-w1> oh, so it should be @field(anyerror, "foo");?
<marler8997> @AnyError()?
<marler8997> ah right, anyerror, derp
<ifreund> maybe, I suspect that doesn't work either currently though
<ifreund> what's your workaround?
<mikdusan> anyerror works
<g-w1> using @Type bc im just creating a set
<ifreund> yeah I think that's the proper thing to do tbh
<g-w1> anyerror is incostinsistent though
<ifreund> how so?
<g-w1> vs @field(anyerror, "foo")
<mikdusan> well you could do @field(@TypeOf(err), "foo")
<ifreund> I guess it might me more consisent to have instead of
eddyb[legacy] has quit [Ping timeout: 264 seconds]
<ifreund> s/me/be/
<g-w1> or just allow error in field
eddyb[legacy] has joined #zig
<g-w1> that seems more constisent since error is an instance of the anyerror type (i think, maybe not)
<g-w1> ooh im running into tons of stage1 bugs
<g-w1> you cant concat arrays with different lengths?
sord937 has quit [Quit: sord937]
<ifreund> g-w1: you probably want to use slices, I'm guessing that what you're doing tries to change the type of a variable
<g-w1> ah
<g-w1> ./test.zig:15:25: error: expected type '*const [0]std.builtin.Error', found '*const [1]std.builtin.Error' | errors = errors ++ &[1]builtin.TypeInfo.Error{ .{.name = n }, };
<ifreund> you can also use anytype, but then you'd need to wrap your variable in a struct
<ifreund> variables of type anytype can change type at comptime in stage1
<ifreund> s/variables/struct fields/
<g-w1> ok, this is getting too complicated :) Ill have to wait for stage2
<ed__> its fascinating how simple changes in code and give really big boosts to performance. With valgrind its easy to see just what is happening. I have been able to get things running 5x faster here... (nothing important, just a learning exercise)
<ed__> things like using shifts instead of bitmasks, passing integers instead of a point structure. The first case caused the comiple to using one instruction instead of three, in the second case it keeps vars in registers which makes pass the parms faster.
<andrewrk> ifreund, I'm about to take on a new zig fmt test case - do you have any WIP code?
<ifreund> not at the moment, though I started thinking about the one with the function call chain broken up by comments
<andrewrk> ok I'll work on test cases starting last to first
<ifreund> cool
jokoon has quit [Read error: Connection reset by peer]
<ifreund> andrewrk: would you be opposed to this test case passing?
notzmv has quit [Remote host closed the connection]
<ifreund> seems weird to allow forcing this with comments but not without
<andrewrk> I'm fine with it. What happens if you put the dots at the end of line instead of the beginning? does zig convert it to this canonical way?
<ifreund> should yeah, I'll add a transform test case
<ifreund> (that one already passes)
notzmv has joined #zig
<andrewrk> go for it :)
<ifreund> it was actually quite simple to implement, I'm finally understanding how and why the AIS works
<andrewrk> oh damn you've got that over me then, I've read the code a few times and still puzzled
<andrewrk> I gotta say though (re: the test case), although this is how people usually write code, I think common convention has it wrong for a couple reasons:
<andrewrk> * dots before the newline is more friendly with a language that does not have semicolons
<andrewrk> * dots before the newline is consistent that all exprs have a trailing punctuation
<ifreund> if you want the dot's before the newline I can make that happen
<andrewrk> * the indentation already clues that the expr is continued on that line, however the previous line looks wrong (looks like it's missing a semicolon)
karchnu has quit [Read error: Connection reset by peer]
<andrewrk> but this is how people want to write code, because it feels natural, because we are used to seeing it this way, even though I think it is objectively worse syntactically
<andrewrk> it's your call on this one, whatever decision you make I will support
frmdstryr has left #zig ["Konversation terminated!"]
<ifreund> so much power :D
<andrewrk> you earned it, heh
<earnestly> I only want one dictator D:
<ikskuh> andrewrk: i don't think it's objectivly worse
<ikskuh> the question is how people read code
<ikskuh> and i'd say people read top-to-bottom first, then left to right
<ikskuh> if the continuation "." is on the "far right", i might not see it (same for the binary ops btw)
<ikskuh> so when i look at the code i see
<ikskuh> var x
<ikskuh> + 10
<ikskuh> + foo
<ikskuh> + bar
<ikskuh> ;
<ikskuh> which has way more context when reading it than just "10", "foo", "bar", ";"
<ikskuh> which both can be standalone statements *or* a continuation
<ikskuh> for the same reason i prefer "}\nelse if(" over "} else if"
n0tekky has joined #zig
<andrewrk> ikskuh, I agree that what people are used to is also important
<ifreund> yeah, trailing .'s just looks too weird to me I think
<ikskuh> i also think it's not easier to parse for *humans*, but worse
<ikskuh> in general
<ikskuh> as a brain can parse 2D
<ikskuh> okay, one question on the build thingy:
<ikskuh> i have the assumption that FileSource.getPath returns an absolute path
<ikskuh> which seems to fail on
<ikskuh> on the others it seems to run fine
<ikskuh> is the assertion okay and it's a bug that a path used in the build step is relativ or is this an "okay" use case?
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
<ifreund> andrewrk: I think I'm done for the day, have fun with the last few test cases :)
notzmv has quit [Remote host closed the connection]
sebonirc has joined #zig
notzmv has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
Snaffu has quit [Ping timeout: 246 seconds]
mikdusan has quit [Quit: WeeChat 3.0.1]
<andrewrk> thanks!
<andrewrk> ikskuh, in general, when you run `zig build` the cwd remains whatever it is; however paths provided to APIs are relative to build.zig
<andrewrk> so there is some point where we must convert
<andrewrk> that's why you see pathFromRoot everywhere
<ikskuh> yeah
<ikskuh> i was just confused as some thing returned a relative path from a file souce
<andrewrk> also in general, I try to avoid unnecessarily producing absolute paths
<andrewrk> so that when the user runs a command, when they see paths in the output, they remain relative if possible
Akuli has quit [Quit: Leaving]
<ikskuh> sounds about right
<andrewrk> I don't think I answered your question directly, but did that provide enough info to tell you what code to change to fix it?
<ikskuh> not quite
<ikskuh> i introduced this assertion in FileSource.getPath:
<ikskuh> std.debug.assert(std.fs.path.isAbsolute(path));
<ikskuh> path is either constructed with pathFromRoot
<ikskuh> or is assumed to be absolute when returned from a GeneratedFile
<ikskuh> which doesn't seem to be the case for everything
<andrewrk> that assertion does not seem correct to me
<ikskuh> okay, that was my question :)
<ikskuh> i'll leave it out and the bug is resolved
<andrewrk> I see `/// Relative to build root` documenting the path field
ur5us has quit [Ping timeout: 240 seconds]
<ikskuh> "relative to build root or absolute."
<andrewrk> that sounds OK
<ikskuh> oh man i love zig so much <3
<andrewrk> <3
<ikskuh> andrewrk: excellent job
<ikskuh> seriously
<ikskuh> snippet which made me grin right now
<ikskuh> handleClientConnection(&arena.allocator, client) catch |err| { std.log.err(...); };
Techcable_ has quit [Remote host closed the connection]
<andrewrk> try/catch/finally always bothered me in other languages, from the first moment I learned about it
<ikskuh> yep
<ikskuh> it's just unintuitive and inflexible
<ikskuh> accept socket, spawn arena, handle connection, release resources. next!
<ikskuh> i start to feel real hate towards classic exception handling
<ifreund> I've always felt real hate towards classic exception handling
Techcable has joined #zig
<ikskuh> nah, it's the thing i learned first
<ikskuh> but i grow my hate on a day-to-day basis
<ikskuh> it's impossible to get under control
<ifreund> the first language I got good at was C++ in a codebase that didn't use exceptions or any real form of error handling besides returning NULL
n0tekky has quit [Quit: Leaving]
ur5us has joined #zig
<ikskuh> sounds better than "throw up;"
redj has quit [*.net *.split]
dom96 has quit [*.net *.split]
fgenesis has quit [*.net *.split]
<ikskuh> also that char literals are *just* untyped unicode codepoints is brilliant
mipri has joined #zig
dom96 has joined #zig
redj has joined #zig
fgenesis has joined #zig
<ifreund> also comptime <3
notzmv has quit [Remote host closed the connection]
<ikskuh> can i sanitize a relative path that it doesn't leave the root/start folder?
notzmv has joined #zig
<andrewrk> yes
<ikskuh> i see pub fn resolvePosix, but that has a dependency on the cwd
craigo has quit [Quit: Leaving]
<andrewrk> that should probably be changed; either way it only has a dependency on the cwd if you pass len = 0 paths
<ikskuh> nah, passing "path" would also resolve to "$(pwd)/path"
notzmv has quit [Remote host closed the connection]
<andrewrk> ah right
Biolunar has quit [Ping timeout: 268 seconds]
Biolunar has joined #zig