ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
<andrewrk> g-w1, I don't think you missed anything- I went over zir.zig again and also explained the new SourceLocation stuff
<g-w1> thanks; can't wait to contribute to astgen
sundbp has quit [Ping timeout: 260 seconds]
earnestly has quit [Ping timeout: 265 seconds]
gazler__ has joined #zig
gazler_ has quit [Ping timeout: 256 seconds]
midgard_ has quit [Ping timeout: 260 seconds]
midgard has joined #zig
dimenus has joined #zig
midgard_ has joined #zig
midgard has quit [Ping timeout: 245 seconds]
ur5us has quit [Ping timeout: 244 seconds]
dyeplexer has joined #zig
ur5us has joined #zig
dimenus has quit [Quit: WeeChat 3.1]
leon-p has quit [Quit: leaving]
sm2n has quit [Read error: Connection reset by peer]
sm2n has joined #zig
ur5us has quit [Ping timeout: 244 seconds]
slowtyper has joined #zig
slowtyper has quit [Client Quit]
sm2n_ has joined #zig
sm2n has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
<andrewrk> holy mother of batman fuckballs
<andrewrk> my code is compiling
<andrewrk> g-w1, ifreund: I'm taking a break from coding but the branch is now compiling, with lots of stuff commented out and/or @panic("TODO"). it's at least clear how to contribute now I think
<txdv> i went to sleep 8 hours ago
<txdv> you are like flash except you are coding
<txdv> compiling? lets ship it!
<andrewrk> ha
<andrewrk> the first test case to repair is: `export fn _start() noreturn {}` - needs astgen for identifiers implemented
<txdv> did you push the compiling code?
<andrewrk> yes
<andrewrk> you have to check out master, build, then switch to this branch, and then use `./zig build`
<txdv> oh
<txdv> ok, i'll try :)
<txdv> You are a machine, almost as fast at writing code as the zig stage2 compiler will be
<andrewrk> `-Dskip-non-native` will save you a bit of compilation time
happyalu has joined #zig
drvirgilio has quit [Quit: No Ping reply in 180 seconds.]
sord937 has joined #zig
johannes has joined #zig
drvirgilio has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
cole-h has quit [Ping timeout: 265 seconds]
jcmdln has joined #zig
johannes has quit [Read error: Connection reset by peer]
tnorth_ has joined #zig
<txdv> hey you were speaking about data oriented design in one of your videos and as a key driving force behind your current rewrite, maybe you have a link to that book?
ur5us has quit [Ping timeout: 264 seconds]
ur5us has joined #zig
sundbp has joined #zig
yyp has joined #zig
waffle_ethics has quit [Remote host closed the connection]
waffle_ethics has joined #zig
yyp has quit [Quit: mc]
earnestly has joined #zig
leon-p has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
yyp has joined #zig
[Ristovski] has joined #zig
[Ristovski] is now known as Ristovski
happyalu has quit [Ping timeout: 240 seconds]
<yyp> Does Zig have size_t for C ABI?
<ifreund> yyp: usize
<yyp> Are they identical?
midgard_ has quit [Read error: Connection reset by peer]
midgard has joined #zig
<txdv> where is usize defined? :D
ur5us has joined #zig
<ikskuh> it's implicitly defined per platform
<ikskuh> it's a primitive type, it's defined by the compiler
<ifreund> yyp: usize == size_t isize == ssize_t
<yyp> ok, got it
<yyp> So, all @atomic* functions accept this weird ordering: builtin.AtomicOrder argument. What does it do and what is better to set it to?
<ifreund> this sepecifies how memory accesses around the atomic operation are to be constrained
<ifreund> yyp: see these docs:
<yyp> That's very helpful, thanks!
ur5us has quit [Ping timeout: 240 seconds]
<yyp> From what I've understood, .Release is best for writes and .Acquire is best for reads
<yyp> err
<yyp> That's best in the sense that it works but not really correct
cow-orker has quit [Quit: Lost terminal]
<mikdusan> this is master using an llvm built with `--llvm-enable-expensive-checks`:
<ifreund> mikdusan: I've recently started using an IO abstraction that uses callbacks instead of async and passes error unions with the results to callbacks as arguments, would such a design conflict with #7812?
<ifreund> I'm still not totally sure I've understood all the proposed changes there
<mikdusan> ifreund: passing error-unions as params or wrapped in struct means they're not treated as special
<mikdusan> so you should have no issue
<mikdusan> error-unions coming from a fn RESULT or being returned as a fn RESULT is what is impacted by #7812
<ifreund> cool, I feel like I always think your proposal changes more than it actually does
notzmv has quit [Ping timeout: 256 seconds]
<mikdusan> I assume that since you have a real error-union, then the 1 impact of #7812 to your code is, where do you get the error-union? is it a result of a fn? Then if you want to "capture" it then it'd be `var got_my_eu = catch doit();` and from there it is pure data as expected... UNLESS you "return got_my_eu" :)
<ifreund> not the result of a function, i switch on errno and construct the union manually
<mikdusan> oh neat
cow-orker has joined #zig
cow-orker has left #zig [#zig]
<mikdusan> marler8997: ping
cow-orker has joined #zig
<yyp> "@atomicLoad atomic ordering must not be Release or AcqRel" - is that a LLVM requirement or Zig does this to prevent incorrect use?
<ikskuh> it would be an incorrect use
<ikskuh> i would actually prefer that atomicLoad, atomicStore and atomicRmw would use different enums
<yyp> Interesting, what would happen if you pass release to atomic functions in Rust...
<yyp> *atomic write functions
<ifreund> ikskuh: could pretty easily make wrappers for the builtins that do that
<ikskuh> yyp: release is valid for write
<yyp> I know
<yyp> I still don't quite get why and how those work
<ikskuh> it's not a trivial thing sadly
<yyp> idk, maybe the resource I used is garbage
<ikskuh> what was your source?
<ifreund> I don't really understand them either, managed to avoid needing to learn the details so far :D
sord937 has quit [Quit: sord937]
<ikskuh> this one is pretty great
<yyp> ifreund: I just use .SeqCst and it works like a charm
happyalu has joined #zig
<ikskuh> acquire is a hard barrier (no reordering at all) whereas consume is only for dependent values
ave_0 has joined #zig
decentpe- has joined #zig
yyp_ has joined #zig
[Ristovski] has joined #zig
yyp_ has quit [Client Quit]
yyp_ has joined #zig
yyp_ is now known as real_yyp
yyp has quit [*.net *.split]
Ristovski has quit [*.net *.split]
leon-p has quit [*.net *.split]
decentpenguin has quit [*.net *.split]
tughi has quit [*.net *.split]
ave_ has quit [*.net *.split]
allan0 has quit [*.net *.split]
decentpe- is now known as decentpenguin
ave_0 is now known as ave_
real_yyp is now known as yyp
notzmv has joined #zig
amk has quit [Ping timeout: 246 seconds]
amk has joined #zig
[Ristovski] is now known as Ristovski
happyalu has quit [Ping timeout: 240 seconds]
wilsonk has joined #zig
wilsonk_ has quit [Ping timeout: 256 seconds]
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
<marler8997> huh?
leon-p has joined #zig
<mikdusan> marler8997: if you have a moment can you eyeball
<marler8997> yeah I would expect "try EXPR" to unwrap an error the same way regardless of whether it's a value or a function call
<mikdusan> ok cool
TheLemonMan has joined #zig
<TheLemonMan> hello fine folks
<ikskuh> hello mr TheLemonMan
<TheLemonMan> mikdusan, have you already tried reducing that LLVM problem?
<mikdusan> oh that big log? no but it's an oddball mips abi target, with optimization. I just wanted to see if `--llvm-enable-expensive-checks` caught something we've never seen before
<mikdusan> fyi, `--llvm-enable-expensive-checks` passes on macos `zig build test -Dskip-non-native` (ie. optimization targets are good for x86_64)
<mikdusan> ^ s/--llvm-enable-expensive-checks/-DLLVM_ENABLE_EXPENSIVE_CHECKS=ON/
<TheLemonMan> poor mips, nobody cares about it :(
<mikdusan> they have so many abi variants
<TheLemonMan> even more so when the MIPS corp is now producing risc-v CPUs
<TheLemonMan> n32,o32,o64 not far from i386,x86_64,x86_64-32 :P
jumpnbrownweasel has joined #zig
<danyspin97> how can I pass a []u8 buffer to a c function?
<danyspin97> i.e. getline
cole-h has joined #zig
<danyspin97> I am using `c.getline(@ptrCast([*c][*c]u8, &buf),...
<g-w1> does getline have a len paramater?
<g-w1> you can just do buf.ptr
<danyspin97> getline does have a len
<g-w1> for the ptr pass buf.ptr and the len pass buf.len :)
<mikdusan> the fn will realloc if needed
<danyspin97> g-w1: not good though
<g-w1> why?
<danyspin97> expected type '[*c][*c]u8', found '[*]u8'
<g-w1> its expecting an array of strings
<danyspin97> right, my bad
<danyspin97> thanks for the .ptr fix!
<mipri> no, it's getline: it's expecting a pointer to a string, because getline manages the memory
<mikdusan> it doesn't want a list. it wants 2 inouts
<g-w1> ah, not familiar with getline
<mikdusan> make arg0 a &ptr (where ptr = null). make arg1 &len (where len = 0).
<mikdusan> getline wants really badly to realloc. so just let it do it from the get go. unless you can guarantee your slice was alloc'd with c.malloc
tnorth_ has quit [Quit: Konversation terminated!]
<danyspin97> the examples online shows malloc
<danyspin97> when using malloc
<danyspin97> so I did the same
<danyspin97> `c.getline(@ptrCast([*c][*c]u8, &buf.ptr), buf.len, file.handle)`
<danyspin97> is this correct?
<danyspin97> when using getline*
<danyspin97> now I am understanding mikdusan comment about slice being alloced with c.malloc
<TheLemonMan> the [*c] pointers are an eyesore
<mikdusan> danyspin97: zig doesn't seem to have getline and I am avoiding the file pointer, but I think as simple as this:
<TheLemonMan> what the hell is ?
<mikdusan> crypto from discord made it
<mikdusan> comments mentioning "lines A-Z" highlight the line. and it has syntax color. so yeah
<mikdusan> works with curl pasting
<TheLemonMan> looks spiffy but I hate the syntax highlighting
<mikdusan> `cat getline.zig | curl -F 'file=@-'`
cole-h has quit [Quit: Goodbye]
<mikdusan> now imagine github let use highlight syntax'd blocks
<mikdusan> s/use/us/
tughi has joined #zig
<mipri> [*c] is "I don't know if this is a single or a multi-item pointer", isn't it? with getline it's known: it's a single-item pointer to a multi-item pointer, because the latter is a string with storage managed (alloc, realloc--but not free) by getline
cole-h has joined #zig
<aconbere> Hey, I'd be interested in contributing to the efforts to get a great robust set of http tools for zig. Is there any libraries that the community is gravitating towards? I see a number of attempts but it's hard to get a sense of where my efforts would be best spent.
<TheLemonMan> I suspect the definition comes from a @cImport
<g-w1> aconbere: a lot of people use zfetch i think. people are also using iguanatls for tls stuff, but its not complete so probably help would be appreciated there (I think cert validation in particular is incomplete)
<oats> I'm so thankful zig has different pointer types, conflation of arrays and pointers in C has been a constant pain point for me
<fengb> Iguana just merged SAN and a fix to ciphers, so it's becoming "complete"
<fengb> But... not audited or battle hardened so don't trust it with real security yet :P
<danyspin97> mikdusan: thanks for the code
<danyspin97> however, I need to have a zig ptr instead of [*c] because I'll call std.mem.split
<danyspin97> and then a zig ptr cannot be null
<TheLemonMan> but an optional one can...
<mikdusan> zig... does... it all :)
<mikdusan> danyspin97: one more; this gives you a slice that should work with mem.split.
<mikdusan> wonder why you're using getline tho
<danyspin97> mikdusan: I was about to ask!
sawzall has quit [Read error: Connection reset by peer]
<danyspin97> is there any better way in pure zig?
<TheLemonMan> that's unsafe, you're passing garbage to getline and, by consequence, to realloc
sawzall has joined #zig
<mikdusan> oh
<mikdusan> yeah TheLemonMan caught my lazy
<oats> mikdusan, what g-w1 said
<danyspin97> I am not reading from stdin though
<danyspin97> i am reading from a file
<g-w1> it works with any reader
<TheLemonMan> using the C stdlib is _never_ an option
<danyspin97> should I create a reader
<danyspin97> I see
<g-w1> file.reader().whatever
<danyspin97> oh, awesome
<oats> TheLemonMan, but libedit is nice ;_;
<g-w1> returns a File
<oats> g-w1, and Files have a .reader() method
<TheLemonMan> oats, that's not part of libc (right?)
<yyp> oats: just implement libedit in Zig :)
<oats> TheLemonMan, no, but it still uses libc
<mikdusan> right, where is std.edit :)
<oats> yyp, look, wheel improvisation is fun, but I don't wanna reinvent all the wheels I need to use
<yyp> mikdusan, maybe not in the standard library
<TheLemonMan> oats, what I wanted to say is that the stdlib is quite comprehensive
<yyp> oats: that was a joke, nobody prevents you from using libedit through C
<oats> I know :P
<mikdusan> yeah danyspin97 in case it wasn't clear don't use my slice example. bad.
<oats> libedit's got quite a few features
<oats> I suspect overall it'd be a bit much to have all of them in the stdlib
<danyspin97> mikdusan: yea, I'll use the reader, thanks everyone for the suggestions :)
<oats> readers++
Akuli has joined #zig
jhartog has joined #zig
halbeno has quit [Quit: Leaving.]
halbeno has joined #zig
<g-w1> andrewrk: I do not know if you saw my pr, but I think it is needed to build zig from scratch with zir-memory-layout since the llvm backend was not updated. I am now working on astgen identifier
dyeplexer has quit [Remote host closed the connection]
jumpnbrownweasel has quit [Ping timeout: 240 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<g-w1> its pretty satisfying
<companion_cube> <-- there comes new competition… or maybe not as ambitious?
happyalu has joined #zig
<fengb> Oh he finally announced it
<yyp> fengb: Not really
<fengb> He's been fake announcing it for months
<yyp> Wait what
<g-w1> early 2021 wow
<yyp> Meanwhile I'm writing about concurrency in Zig...
<mikdusan> > Zig takes about 30 minutes to compile and run its test suite
<mikdusan> zig has more tests :)
<mikdusan> and well zig[0] takes about 15 seconds to compile
<yyp> idk, it took at least 20 minutes for me.. and still failed
<mikdusan> and to slag on zig compile times during transition to self hosting is sad.
<fengb> I'm curious what he'll do with concurrency
<fengb> Cause I think Drew's mentioned that he likes how C handles it
<yyp> For the sake of joke I guess, I tested not-so-my-own programming language. Clean build + tests runs in 17 seconds given that it's written in Rust :)
<yyp> fengb: I don't think he will even implement it
<companion_cube> fengb: I don't think there'll be threads
<companion_cube> probably just callbacks?
<yyp> Use multiple processes :)
<yyp> - written by Drew
<companion_cube> yep
<companion_cube> oh well
<aconbere> :q
<aconbere> dammit
<fengb> Ah right
<fengb> Handle concurrency by not handling it
<mikdusan> punt
<yyp> You have a thread::spawn function but it will segfault once used
<companion_cube> enjoy your epoll with callbacks in a language without closures
<mikdusan> me searches my history for that hidden link
<mikdusan> to that unannounced thing
<mikdusan> runes. gimme runes
<yyp> runes? go? wut?
<yyp> nevermind
<mikdusan> btr has runes
<yyp> Each time I hear 'rune' I think of Golang's rune type (Unicode char)
LanceThePants has joined #zig
<v0idify> how do i insert a breakpoint by line number on gdb?
<yyp> v0idify: do you have debug symbols?
sawzall has quit [Ping timeout: 240 seconds]
<v0idify> yyp, yes
<yyp> break filename:linenumber
<v0idify> oh
<mikdusan> unspecified global init order. what could go wrong?
happyalu has quit [Ping timeout: 240 seconds]
yyp has quit [Quit: now it's safe to turn off your computer]
<mikdusan> > use 8-column-wide tab characters for indentation
<jcmdln> As god intended
<mikdusan> pffft
<companion_cube> use 3 spaces or gtfo
<jcmdln> yikes
<mikdusan> for your punished you are banned to 80x24 terminal with 8-space tabs
<mikdusan> wow my broken words
<jcmdln> ain't even mad
<companion_cube> good luck with an expression based language and 8-column tabs, lol
<fengb> 1 column tabs, discuss
<mikdusan> from zero to zig0: 8.43 seconds. (ok I repeated it to cache it). and I don't have anything fancy. 6 core 3 ghz.
<jcmdln> I use emacs and have a nearly 2k line configuration file (with newly added zls support). I have an extremely dulled sense of pain
<jcmdln> joking aside, I prefer 4-spaces within 80 columns in most languages
<companion_cube> I'm ok with 2 or 4 spaces, depending
<g-w1> andrewrk: you have 3 new pull requests waiting for you :)
LanceThePants has quit [Read error: Connection reset by peer]
<mikdusan> i give you: bizarro tabs:
<dutchie> didn't know it was possible to be worse than gnu style but there it is
<mikdusan> hehe
<mipri> what a weird pastebin
<noam> First line of generated codefrom zyg :D
<noam> `start2_1: movz $0, r0` :D
<mipri> look at it with developer tools open. it sends one paste, then loads all the JS, then replaces the paste with a completely different one -- the intended one, apparently.
yyp has joined #zig
<andrewrk> good morning
<Nypsie> o/
<noam> Morning!
<g-w1> good morning!
apotheon has joined #zig
SebastianM has joined #zig
yyp has quit [Quit: now it's safe to turn off your computer]
gpanders has quit [Ping timeout: 268 seconds]
gpanders has joined #zig
<andrewrk> I wonder how effective a non-exhaustive enum will work as a "distinct type" for an int
<g-w1> andrewrk for the common integer types those are covered in simple_types so we don't need them again
yyp has joined #zig
fputs has joined #zig
yyp has quit [Quit: now it's safe to turn off your computer]
SebastianM has quit [Quit: -a- Bye Bye]
<andrewrk> ah nice
<fengb> It's okay. You can't math with it so it's only really good for stuff like DB ID where mathing makes no sense
flokli is now known as FLOKLI
<andrewrk> hmm one problem is that I want to be able to coerce, or at least explicitly cast, a []u32 to a []Distinct, and vice versa
<andrewrk> that might be a strong argument for #1595
<andrewrk> you can't really do that in userland
<fengb> `@ptrCast([*]Distinct, u32_array.ptr)[0..u32_array.len]` ?
<ikskuh> andrewrk: i use enum(u32) { _ } quite often already
<ikskuh> as long as those are IDs and not arithmetic types
<ikskuh> it's super-convenient
<fengb> I adopted `struct { ptr: u32 }` in wazm because I needed to do pointer math
<ikskuh> (although i'd love to have distinct arithmetic types as well)
cole-h has quit [Ping timeout: 246 seconds]
yyp has joined #zig
<andrewrk> fengb, the ptr cast will work but it's invoking more unsafety than it needs to
<andrewrk> if it were a distinct cast it could emit a compile error if you tried to convert to something that didn't have the same memory representation for example
<ikskuh> andrewrk: i think fengb is referring to a offset into a buffer and not an actual pointer (from @ptrCast)
<andrewrk> consider though, that ptr cast would allow a conversion from distinct types which had mismatched ABI sizes
<andrewrk> a distinct cast could still emit an error for such case
<andrewrk> distinct(u32) vs distinct(i64) you don't want to accidentally ptrcast slices of these to the other
<fengb> Yeah it's a "pointer" in wasm, but represented in the host as an offset
<fengb> Oh he meant my terrible ptrCast hack. Yeah it's bad lol
<fengb> But we can add some safety checks in a std.meta function
<andrewrk> std.meta, more like std dot "meh"
<ikskuh> meh-tax-ah!
<andrewrk> 😱
spacelove has joined #zig
<g-w1> andrewrk: im unsure what to put for src for rvalue?
<g-w1> or should the src field be deleted?
<ikskuh> andrewrk: looks like you need one or the other enumToInt :D
<andrewrk> g-w1, rvalue wants: src_node: ast.Node.Index
<andrewrk> token_starts arrays have byte offsets
<g-w1> so its just main_tokens[node]?
<andrewrk> it wants a node index, not a token index
<andrewrk> it's just node :)
<g-w1> oh nice
<andrewrk> sorry for the lack of type safety
<andrewrk> turns out with Data Oriented Design, everything ends up being u32s
<g-w1> oh hmm, my zig fmt is somehow borked, it wasn't a formatting change. nice
sundbp has quit [Ping timeout: 260 seconds]
<noam> andrewrk: `const NodeIndex = u32;`?
<noam> Would `NodeIndex = @as(u32, 0)` still work?
<noam> If so, can we change that? :P
<yyp> NodeIndex is a const, why would that work?
<g-w1> reject types, return to chump
<noam> lol oops
<noam> would `var foo: NodeIndex = @as(u32, 0)`
<noam> sorry, truncated /s
<g-w1> it does work, that is my problem
<noam> Even with explicitly named types?
<noam> Special rule: if two types are aliased to the same primitive type, they should require an explicit @intCast ?
<noam> Or, `const foo = <integer type>` creates a non-exhaustive enum instead of an alias?
<noam> There's a few relatively simple solutions I can think of
yyp has quit [Quit: now it's safe to turn off your computer]
<spacelove> Hi all. I'm new to programming in general, and I've been doing little projects in python. I'm trying to use Zig to do some operations on strings, basically, reproducing a working program I already have in python. But it's challenging to find the documentation. Where can I find better info on how to work with strings? At the risk of betraying my
<spacelove> lack of understanding of things, I'd like to just try to see if two strings differ by one letter. I'm not asking for you to solve it, just to point me in the direction of where to find that information.
<noam> ?
<spacelove> In python it would be:
<spacelove> def check_diff(word_a,word_b):
<spacelove>     # Do two different words differ by a single letter?
<spacelove>     delta = sum([la == lb for la, lb in zip(word_a,word_b)])
<spacelove>     return delta == len(word_a) - 1
<noam> please don't paste here directly, use a pastebin of some sort
<andrewrk> welcome, spacelove!
<spacelove> Ok, sorry.
<noam> (general IRC ettiquette to avoid spam)
<spacelove> Word. Makes sense.
<g-w1> you could iterate over the strings and compare the letters at one index. if they are different do something else. see this for loops and stuff
<spacelove> andrewrk I was inspired by one of your talks, that's why I'm here. You seem like a sharp guy.
<spacelove> Thanks dudes, reading now.
<aconbere> spacelove: I'm old at programming but have also been learning zig. For /most/ of my questions about what functions do what where and signatures, I just have to read the source.
<aconbere> Luckily the zig source is in zig, totally accessible, and super readable
<noam> pseudocode could be something like `if size is different return false , otherwise set difference to zero, loop over characters, if different increment difference, return difference == 1`
<aconbere> (but I recognize that it might be daunting for a beginner)
<spacelove> I think, coming from a non-C background, a lot of knowledge is taken for granted. If I weren't psychotically motivated to learn new things... I wouldn't even be trying.
<noam> spacelove: for something like that, you can probably just figure out a solution on pen and paper by writing down what you want to check, writing pseudocode, testing it (still on paper), then writing actual code
<andrewrk> spacelove, maybe start here?
<noam> I often have a notebook or three next to me while at my computer
<spacelove> @noam same. andrewrk I think that's what I was looking for, thanks. I gotta get the basics down.
<aconbere> actually, while I'm saying it, what's the current state of work on the documentation?
<aconbere> I'd be happy to send PRs as I encounter undocumented functions
<g-w1> most of the functions are documented, but the documenter needs to be rewritten
<aconbere> g-w1: most might be /technically/ accurate, but I run into a bunch that have no documentation when I'm digging around the std library :)
<g-w1> ah, then I guess docs might be needed!
<aconbere> I guess in either case my question stands just... happy to help improve the state of documentation but I haven't seen much in the way of a guide to contributions in that regards
<aconbere> Maybe the question is then about ordering the priorities?
<g-w1> i think adding doc comments would do that. stage2 probably needs a little more work before auto-generated docs will be able to be made with it
<aconbere> Fixing the documenter vs. adding documentation that might need to be rewritten
<aconbere> kk
<g-w1> andrewrk: I think I updated all 3 prs
<aconbere> g-w1: I think there are also three classes of documentation to cover, and the zig docs often are missing at least one
<andrewrk> g-w1, thanks! while you did that I tried to add type safety to our u32s but I think I might push for a language feature in order to do this
<aconbere> you have "what are my inputs and outputs" usually covered by types, a terse description of operation (this is the most common documentation reference I've found in the std line), and then there's the more high level documentation on "what is going on here, how should you think about it, what mental model is useful"
<aconbere> and the latter is rarely pressent
<andrewrk> spacelove, there is also
<aconbere> it's hardly needed but `get` has not documentation:
<g-w1> yeah I think a language feature would be nice
<aconbere> I'm new and dumb so I spent some trying to figure out what the ownership model for Hashmap was (in retrospect obvious to the design of zig is that the caller owns the memory)
<aconbere> but, it's hard to know from the call signatures, especially since hashmap owns an allocator
<aconbere> so i think getting specific about expectations of generic types
<aconbere> examples of useage etc
<aconbere> but I also know that being REALLY consistent is important
<aconbere> ANYWAY
<aconbere> haha
<g-w1> I actually think that this branch will *remove* code
<andrewrk> g-w1, that decl field should be non-optional right?
<andrewrk> there is never a case when we are generating LLVM code and it's not for a Decl
<g-w1> no, since on create there is no decl
<g-w1> I had that first
<andrewrk> ah but it's not really ever supposed to be null
<andrewrk> this would be more clear if those fields that should not be mutated were extracted to a separate type
<g-w1> yeah, it is a workaround; Firefox317 said he is extracting it to another type
<andrewrk> my only concern is that the person extracting it will keep it optional
<andrewrk> note the other fields nearby which use undefined
<g-w1> oh, will that work?
<andrewrk> what do you mean?
<g-w1> I guess undefined will work since the optional is never used
<g-w1> ill switch it
<andrewrk> initializing a struct field to undefined is a pretty strong code smell
<g-w1> what do you think?
<andrewrk> and it's correct to be smelly in this case, since those fields should be extracted to a per-function struct
<andrewrk> make it stink real bad so firefox gets more motivated to fix it :D
<g-w1> ah :)
<g-w1> added an extra TODO to make it smell even more ;)
<andrewrk> perfect!
<jcmdln> I just read over (ie skimmed) #943 regarding the package manager, and I have to ask... does Zig need a package manager? From some suggestions people made in this issue to look at npm, yarn, dart, clojure, go, etc... I don't think any of these package managers made a significant case against git submodules
<jcmdln> I was into Node.js a few years ago. NPM/Yarn should be demonized, no lionized.
<companion_cube> git submodules are a royal pain
<jcmdln> s/no/not/
<andrewrk> git submodules are a non-starter. you have to put extra info in your readme just to get contributors to check out all of your source code instead of only some of it
<companion_cube> yeah, and github releases won't include the submodules
<andrewrk> that is right out. I won't even consider doing that
CommunistWolf is now known as burnies
burnies is now known as bernies
<andrewrk> nice work g-w1!
<jcmdln> I think I didn't use the right wording. I mean npm/yarn and the examples are worse than git submodules
<andrewrk> do we compile `export fn _start() noreturn {}` yet? xD
<g-w1> maybe??
<andrewrk> jcmdln, don't you want to be able to have dependencies on other libraries?
<andrewrk> one of the main selling points of zig is how reusable zig code is
<jcmdln> I'm not arguing against having a package manager, or in favor of git submodules
bernies is now known as CommunistWolf
<noam> First full codegen from zyg :D ->
<jcmdln> I'm saying npm and yarn are terrible :)
<andrewrk> noam, you're generating asm source? what's your plan for getting that into machine code?
<noam> I have an assembler
<andrewrk> as part of the zyg project?
<companion_cube> jcmdln: cargo is pretty ok imho
<noam> andrewrk: effectively, yes
<noam> It's not originally part of it, but I'm incorporating it
<andrewrk> neat
<apotheon> jcmdln: To be fair, I think yarn's purpose was to make one thing about npm better.
<noam> and retargeting it :P
<noam> it's originally for the z80 XD
<jcmdln> companion_cube: note that I didn't complain about cargo, I think that's a decent example
<noam> and I'm rewriting half of it to simplify / optimize / bugfix :P
<andrewrk> g-w1, we should probably try to repair zir printing asap
<andrewrk> I'll start on that now
<g-w1> ok
knebulae has joined #zig
sundbp has joined #zig
bsrd has joined #zig
Miaourt9 has joined #zig
dongcarl has quit [Write error: Connection reset by peer]
Ankhers has quit [Ping timeout: 264 seconds]
Miaourt has quit [Quit: Ping timeout (120 seconds)]
marler8997 has quit [Read error: Connection reset by peer]
iceball has quit [Read error: Connection reset by peer]
Miaourt9 is now known as Miaourt
Ankhers has joined #zig
Flaminator has quit [Ping timeout: 246 seconds]
Flaminator has joined #zig
midgard has quit [Remote host closed the connection]
decentpenguin has quit [Ping timeout: 240 seconds]
midgard has joined #zig
decentpenguin has joined #zig
Akuli has quit [Quit: Leaving]
ryan_greenblatt has joined #zig
<spacelove> How do I pass strings as function arguments?
<spacelove> I'm getting: ```./word_chains.zig:7:31: error: expected type '[]u8', found '*const [5:0]u8'```
<ryan_greenblatt> []const u8
<spacelove> I'm getting: ```./word_chains.zig:7:31: error: expected type '[]u8', found '*const [5:0]u8'```
<spacelove> Sorry -- accidentally hit "up"
<spacelove> I get an invalid token error: fn distance(start: []const u8, end: const[] u8)...
<ryan_greenblatt> []const u8 not const[] u8
<spacelove> Oh shucks.
<spacelove> Thanks, you are a genius.
marler8997 has joined #zig
<noam> spacelove: this isn't C ;)
<noam> (C lets you put const on either side in that scenario lol)
<spacelove> Zig is blowing my mind coming from python.
<spacelove> It's so... structured, and simple. I can't make everything magically work. I feel like it's putting wrinkles in my brain.
<spacelove> Turning my brain into filo pastry.
sundbp has quit [Ping timeout: 240 seconds]
aconbere has quit [Ping timeout: 256 seconds]
<spacelove> I see in the docs how to initialize a 2d array with a specific set of values, and a number of ways for how to programmatically initialize a 1d array. But how does one initialize a 2d array full of zeros? I tried [_][_]u8 {{0} ** 5}**5 and combinations of different braces and whatnot but it's not obvious what to do.
<noam> hmm... I'm not sure if ** is a valid operation on arrays?
<noam> Well, no, that's stupid, it has to be
<noam> Not sure why that wouldn't work, sorry
<spacelove> Error msg:
<ryan_greenblatt> const x_dim = 10;
<ryan_greenblatt> const y_dim = 10;
<ryan_greenblatt> const arr: [y_dim][x_dim]u8 = .{.{0} ** x_dim} ** y_dim;
<ryan_greenblatt> Seems to work
<ryan_greenblatt> You need ".{" as opposed to "{" for struct/array literals
<Gliptic> spacelove: I assume start.len and end.len are not comptime, that's never gonna work
<spacelove> I marked them as comptime.
<spacelove> While only kinda/sorta knowing what that means.
<Gliptic> ok, maybe it'll work then, but it's hard to tell when you're just posting a single line
<ryan_greenblatt> I would recommend reading the docs
<ryan_greenblatt> It would answer most of these questions faster.
<ryan_greenblatt> for instance
<spacelove> Yea, that's what I had open actually.
<spacelove> That's what I was working from.
<ryan_greenblatt> Cool, just making sure you were aware.
<ryan_greenblatt> No issue with asking for help of course.
<spacelove> Yea I'm try not to make this my personal therapy session lmao
<spacelove> trying*
squeek502 has quit [Remote host closed the connection]
<ryan_greenblatt> In theory, what is supposed to be going on with UEFI with respect to debug symbols? currently the code makes no sense (uses pdb `ModuleDebugInfo` type while also trying to use `lookupModuleDl` in `getModuleForAddress`)