ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
decentpenguin has joined #zig
a_chou has quit [Ping timeout: 240 seconds]
a_chou has joined #zig
<tdeo> hmm now i've spent a while more trying to solve #131 and still haven't gotten anywhere
<tdeo> should every variable reference be lazy now?
msingle has joined #zig
jjsullivan has quit [Ping timeout: 260 seconds]
a_chou has quit [Ping timeout: 272 seconds]
xd1le has joined #zig
osa1 has joined #zig
<tdeo> hmm this really feels like a types problem too
<tdeo> we need to know the type of a to know the type of b, but it's the same both ways
<tdeo> i can't see a way to correctly solve this issue without adding some sort of advanced type inference so far
<tdeo> or it could just say "couldn't infer type", that probably works too
<pixelherodev> tdeo: I honestly don't see the issue with the "inference"
<pixelherodev> If there's no type specified, the compiler should error out IMO
<pixelherodev> If there's no possible way to infer the type, don't make one up, just report it
<g-w1> I am just a beginner at compilers, but could we search for b after we see a reference to it, or would that be really bad space time complexity
<tdeo> are you talking in general or about the loops?
<pixelherodev> tdeo: I was talking in general, but I think I confused it with 137 again :P
<tdeo> i mean there is a possible way to infer the type but zig doesn't use advanced type inference like some other languages
<tdeo> like rust lets you `let vec = Vec::new(); vec.push(1i32);` and vec is inferred to be of i32
<tdeo> i'm not saying zig should do this, it's just the only possible way i see to make that test case work is with something similar
<pixelherodev> Why?>
<pixelherodev> I know
<pixelherodev> I'm looking at it
<pixelherodev> Why would that be needed?
<pixelherodev> Heck, why is type inference needed at all?
<pixelherodev> It should be explicit as the type of Node.next
<tdeo> inferring the type of an expression that refers to another variable needs to know the type of that variable
<tdeo> in general
<tdeo> but to know the type of b we need to know the type of a and so on
<pixelherodev> That makes no sense IMO
<pixelherodev> That's needed for type *validation*, sure
<pixelherodev> `const a = Node { .next = &b };`
<pixelherodev> But &b there semantically must be `*Node`
<pixelherodev> The type of b can then be assumed to be Node, which can be validated later
<tdeo> &b has to be something that implicitly casts to *Node
<pixelherodev> ah, true
<pixelherodev> but why's that matter?
<tdeo> hmm
<tdeo> well there's no general way to know what type is expected i think
<pixelherodev> basically, why does that need to be resolved *first*?
<pixelherodev> 131 is specifically about recursive addresses of globals, no?
<pixelherodev> in that case, it's always going to be a pointer
<pixelherodev> the address can be resolved before the type, can't it?
<tdeo> well, the zig compiler has no way to say "i finished resolving this expression, but i don't know its type"
<tdeo> i think adding that and making it work would need to be a big type inference change
<tdeo> like, i think making circularly inferred constants would require making type inference in general more powerful
<tdeo> ok, so i think it makes sense to just fail inference for that
<tdeo> the compiler doesn't have a way to fail inference without failing evaluation though
<tdeo> which was the whole problem i guess, but at least i don't think the language has to change
msingle has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
nullheroes has quit [Quit: WeeChat 2.9]
msingle has joined #zig
Kingsquee has joined #zig
msingle has quit [Ping timeout: 240 seconds]
msingle has joined #zig
kristoff_it1 has joined #zig
<redj> /a/sd/d/zig/bootstrap/out/zig-x86_64-linux-musl/bin/zig --version
<redj> Illegal instruction
<redj> this is what I ran: ./build -j9 x86_64-linux-musl
<redj> sorry for not asking a proper question... is anyone aware of some issue with bootstrap?
<redj> this is master 42f01b333
<redj> Linux 5.8.4-artix1-1 #1 SMP PREEMPT x86_64 GNU/Linux
<redj> out/zig-x86_64-linux-musl/bin/zig: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
<redj> not a dynamic executable
<redj> the "not stripped" is surprising me as this is supposed to be the release configuration
<redj> I see c581efa0c was pushed 4-5 hours ago... llvm11 and updated zig... nice! I will try that..
<redj> trying native
osa1 has quit [Ping timeout: 272 seconds]
marnix has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
jeyr has joined #zig
jeyr has left #zig [#zig]
waleee-cl has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #zig
<redj> and it works! it took a little over 2 hours but I got zig! :D
<redj> fresh zig :)
msingle has quit [Ping timeout: 260 seconds]
<daurnimator> redj: 2 hours is a while; that was just solving compilation issues?
<redj> daurnimator: that was just running the build script from zig-bootstrap.. aka the compilation time
<redj> how long it tool to get a working zig-x86_64-linux-musl-native zig binary :)
<andrewrk> it includes building llvm, clang, and lld twice, so 2 hours sounds about right
<redj> yes
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
tdc has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
frett27_ has quit [Ping timeout: 272 seconds]
ur5us has joined #zig
<ikskuh> andrewrk: nice, you closed #130 :O
<ikskuh> i think interface.zig is already close-to-awesome
earnestly has joined #zig
cole-h has quit [Ping timeout: 258 seconds]
jjido has joined #zig
osa1 has joined #zig
osa1 has quit [Remote host closed the connection]
kristoff_it has joined #zig
kristoff_it1 has quit [Ping timeout: 272 seconds]
dermetfan has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
osa1 has joined #zig
semarie has joined #zig
haliucinas has quit [Ping timeout: 272 seconds]
tundrax has joined #zig
haliucinas has joined #zig
dermetfan has quit [Ping timeout: 260 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
dermetfan has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
omglasers2 has joined #zig
<ifreund> tdeo: right now I'm thinking we should just require explicit type annotations of gloabal variables involved in recursive deps for stage1
<ifreund> stage2 can have the better type inference
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
metaleap has joined #zig
<andrewrk> ifreund, they tricked us with that opaque{} thing, now they tryna take our struct files away from us :P
<ifreund> it was a trap!
<ifreund> what is it, like 4am where you are?
<andrewrk> yes
<andrewrk> I've been... not handling release month very well
Kingsquee has quit []
<andrewrk> pushed a little too hard last month
<ifreund> yeah, I could tell you were burning out a little on 6250
<ikskuh> andrewrk, go to bed!
<andrewrk> good idea
<ifreund> and now release stress as well, remember that your long term health is much more important for the project than any small details for this release
<ikskuh> ^=
<andrewrk> true. I'll be ok, I'll take it easy
<ikskuh> says the man up at 4 am
<ifreund> well i was up to 3 last night, I can't judge
<andrewrk> in my defense I am playing monster train and watching anime
<ifreund> sounds good for the soul
<ikskuh> okay, that's a good thing
<ikskuh> Oh man, i feel bad for countering CodeHz :(
<ifreund> on the opaque(u32) proposal?
<ikskuh> yeah
<ikskuh> it's not opaque if we back it with an integer
<ifreund> yeah I feel kinda bad too but it's just not a good idea
<ikskuh> also: what ABI rules to apply? they even made the example why their code is a bad idea :D
<ifreund> yeah, what they want is totally orthagonal to opaque types
<ifreund> they want distinct types
<ifreund> or something
<ifreund> which I would also be in favor of if done right
<ikskuh> yeah, cloning an integer to be distinct would be awesome
<ikskuh> and enforce something like @as() or @intCast on them
<ikskuh> or just arithmetic types
ask6155 has joined #zig
deltamaniac[m] has quit [Quit: killed]
aterius has quit [Quit: killed]
alva has quit [Quit: killed]
return0e[m] has quit [Quit: killed]
bfredl has quit [Quit: killed]
alexnask[m] has quit [Quit: killed]
Bastian[m] has quit [Quit: killed]
juanfra__ has quit [Quit: killed]
ifreund_ has quit [Quit: killed]
BaroqueLarouche has quit [Quit: killed]
fengb has quit [Quit: killed]
Nypsie[m] has quit [Quit: killed]
Snektron has quit [Quit: killed]
<ask6155> Hello! I wanted to static link a c library with zig. Do I just do -llibx.a at the end?
<ifreund> ikskuh: good point on #6615, I'm starting to really like the idea
<ifreund> ask6155: with #6250 I think you can just pass the library to build-exe along with your root source file
<ifreund> zig build-exe foo.zig libx.a
fabio[m] has joined #zig
<ikskuh> ask6155: andrew told me that it's correct to link static libs as object files (if you have them locally in your repo)
<ask6155> How do I import the header file? c has "x.h" and <x.h> How do I tell zig with header file to include?
<ikskuh> ask6155: zig only knows <x.h>
<ikskuh> you have to add your include path manually
<ask6155> How do I do that?
<ifreund> -I
<ask6155> so I add -Ipath at the end of the zig command?
<ifreund> yes
<ask6155> okay thanks!
ask6155 has left #zig ["Later!"]
<ikskuh> ifreund: yeah, i also like this proposal very much
bfredl has joined #zig
alexnask[m] has joined #zig
juanfra__ has joined #zig
ifreund_ has joined #zig
alva has joined #zig
return0e[m] has joined #zig
aterius has joined #zig
Nypsie[m] has joined #zig
deltamaniac[m] has joined #zig
Bastian[m] has joined #zig
fengb has joined #zig
BaroqueLarouche has joined #zig
Snektron has joined #zig
msingle has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tundrax has quit [Remote host closed the connection]
dermetfan has quit [Ping timeout: 260 seconds]
msingle has quit [Ping timeout: 244 seconds]
tundrax has joined #zig
<tundrax> Is there a way to set function argument as optional?
<ikskuh> so that you can omit it?
<ikskuh> no
<ikskuh> but you can pass optionals:
_whitelogger has joined #zig
decentpenguin has joined #zig
wilsonk has joined #zig
tracernz has joined #zig
<tundrax> so `.{ }` is a tuple? there is no mention of tuples in docs
<ifreund> yeah, the docs are rather lacking on tuples
<redj> hi all, how would you differentiate between the user running a zig binary and that same binary being run via $() for using the output in a variable for example?
<earnestly> Is this a shell question? ;D
<ifreund> redj: File.isTty()?
<redj> ifreund: that should be it...
<redj> earnestly, ifreund: thanks, will try
<earnestly> Yeah the only way is to check if stdin is attached to a tty
<ifreund> tundrax: the tuple .{a,b,c} is like a struct { .@"0" = a, .@"1" = b, .@"2" = c, } that you can iterate over in a for loop
<ifreund> the language feature isn't very complete yet though, see https://github.com/ziglang/zig/issues/4335 and https://github.com/ziglang/zig/issues/4335
<g-w1> you could use isatty in std.os https://i.imgur.com/8cm1RMh.png also
<g-w1> thats what ls uses to print stuff line by line if ur in a shell script but all together if not
<ifreund> g-w1: that's what File.istTty() calls...
<g-w1> oh
<ifreund> more relevant may be File.supportsAnsiEscapeCodes()
<g-w1> cool
<tundrax> ifreund thanks, that's what i was looking for
msingle has joined #zig
<ifreund> no problem
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
mmohammadi981266 has joined #zig
mmohammadi981266 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
dch has joined #zig
mmohammadi981266 has joined #zig
mmohammadi981266 has quit [Client Quit]
mmohammadi981266 has joined #zig
xackus has joined #zig
dermetfan has joined #zig
meta_leap has quit [Quit: Leaving]
waleee-cl has joined #zig
osa1 has quit [Remote host closed the connection]
dermetfan has quit [Ping timeout: 240 seconds]
xd1le has quit [Remote host closed the connection]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
tundrax has quit [Remote host closed the connection]
osa1 has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
a_chou has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
<g-w1> I am getting a lot of undefined references to memcpy and memset when I try to link a zig library to a file in assembly that includes _start. It is not a compile time error, but a link time error. I thought all zig libraries were statically linked, so shouldn't this not be a problem?
hnOsmium0001 has joined #zig
<g-w1> Since zig ships with libc, shouldn't memcpy be in zig's libc. I am on arch linux.
marnix has quit [Ping timeout: 260 seconds]
marnix has joined #zig
<scientes> g-w1, llvm requires certain symbols (such as memcpy) to build anything, so those are linked to every binary
<scientes> sounds like the library has not been linked
<scientes> anyways, you need to include more details
<scientes> about how you are building these things
<g-w1> ok
<g-w1> heres my assembly. the important thing is that it has extern square https://paste.rs/Ft1
<g-w1> and my main.zig is just this export fn square(a: i64) i64 { return a * a; }
<g-w1> i just use nasm to build the assembly and zig build to build the zig to a lib
Akuli has joined #zig
<g-w1> ld to link them together
<scientes> it will probably fix it if you add a zig_panic function or build with --release-fast
<scientes> I think its the debug code that is pulling in those symbols
Guest19493 has quit [Quit: leaving]
WilhelmVonWeiner has joined #zig
<scientes> but otherwise, I am struggling to be a proper support person because I know a decent amount about zig 0.6.0, the pride of ownership just isn't there anymore
<g-w1> Ok. I still don't understand why the debug code cant be statically linked or those symbols cant be statically linked. well thanks anyways.
<g-w1> ill try --release-fast
<g-w1> it worked! thanks
<scientes> g-w1, feel free to ask more questions as you have them
<g-w1> cool thanks. I am writing a compiler in rust, but want to write the standard library in zig, just to learn it.
<g-w1> ill probably start working on the zig compiler after I feel done with mine.
wootehfoot has joined #zig
<ifreund> g-w1: got a link?
<kristoff_it> does anybody know of a simple way of causing a stderr write to fail?
<g-w1> github.com/g-w1/ezc
<g-w1> ifreund
<ifreund> kristoff_it: maybe pipe stderr to something and break the pipe?
<ifreund> just off the top of my head
<ifreund> g-w1: heh, haven't seen [] for comments before
<g-w1> yeah. i think imma change it to {} so i can use arrays
<ifreund> I also appreciate the usage of periods and commas to make things flow like english
<ifreund> do you have a use case for this language or is it just to learn/for fun?
dermetfan has joined #zig
<g-w1> Just to learn about compilers.
<ifreund> nice
<g-w1> I don't see a way to print a u8 to the terminal not as a number, but a character
<ifreund> {c}
<ifreund> see the doc comment for std.fmt.format
<g-w1> oh. ok. I was trying to read the docs for std.debug.print
<g-w1> thanks
<ifreund> no problem!
<nikki93> anyone try using llvm c api from zig? :o
<ifreund> nikki93: we have a wrapper for llvm that is used by the self hosted parts of the compiler. Have you seen that?
<nikki93> oo cool, will check it out
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
moinstar has quit [Quit: Leaving.]
cole-h has joined #zig
dermetfan has quit [Ping timeout: 240 seconds]
dermetfan has joined #zig
<tdeo> ifreund, nikki93: that's only used for the parts of LLVM that aren't exposed by llvm-c
<tdeo> using llvm-c should work fine using cImport though
<tdeo> it doesn't define any complex macros that you need to import as far as i know
<tdeo> though zig_clang.h *is* used for all of the clang api interaction since the c++ api is much more powerful than libclang's c api
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
msingle_ has joined #zig
msingle_ has quit [Read error: Connection reset by peer]
msingle has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
msingle has joined #zig
<nikki93> cool :O
<nikki93> might play around with making a language
<Piraty> congrats on LWN mention
<marler8997_> is Rocknest on here? I wanted to ask some clarifying questions on his proposal without littering the github comments too much
jayschwa has joined #zig
xackus has quit [Ping timeout: 260 seconds]
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
decentpenguin has quit [Ping timeout: 265 seconds]
decentpenguin has joined #zig
layneson has joined #zig
<kristoff_it> Piraty, thanks :D
layneson has quit [Ping timeout: 240 seconds]
marnix has quit [Ping timeout: 264 seconds]
omglasers2 has quit [Read error: Connection reset by peer]
jayschwa has quit [Remote host closed the connection]
osa1 has quit [Ping timeout: 272 seconds]
jeko has joined #zig
marnix has joined #zig
ur5us has joined #zig
cole-h has quit [Quit: Goodbye]
jjido has joined #zig
jjido has quit [Client Quit]
xackus has joined #zig
<nikki93> wonder if u could express a weird comptime ssa with zig struct literals
<nikki93> like each "member" is just result1 result2 and so on
<nikki93> and you reflect on it and unroll eval code
jayschwa has joined #zig
marnix has quit [Ping timeout: 258 seconds]
mmohammadi981266 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
<g-w1> what is the best local development setup for the compiler. Should I have 2 repos, one ziglang/zig and one g-w1/zig? I feel like that wouold be inneficient. Or just one and merge it with the compiler whenever a new pr gets merged. (I dont know if you can auto do that on github)? What are you doing.
<ifreund> just one local repo with two remotes
<ifreund> I call the ziglang/zig remote "upstream" and my fork "origin"
<g-w1> oh. Im not that good at git so ill have to figure it out :). Thanks
<ikskuh> ifreund: i don't want to talk about to active working copies :D
<ifreund> do you do that? :P
<ikskuh> no :D
<ifreund> good
<ikskuh> but i heard that people use that :D
<g-w1> so you git pull from upstream and git push from origin?
<g-w1> so you git pull from upstream and git push to origin?
<ifreund> g-w1: yes, the workflow is usually git checkout master, git pull upstream master, git checkout -b my-new-feature, git commit, git push origin my-new-feature
<ifreund> then open the PR on github
<g-w1> awesome thanks.
<BaroqueLarouche> fixed the zig new cache system on Windows: https://github.com/ziglang/zig/pull/6628
<ifreund> nice!
<ifreund> (to both of you)
<ikskuh> niiice!
<ifreund> g-w1: if you want to get really good at git I'd recommend reading this chapter on the lower level details: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
<g-w1> ok. i started reading that book. I don't understand why people don't reccomend it from the start. it's very good
<ifreund> knowing how it works makes using it much more intuitive imo
<ifreund> I've only read that one chapter tbh, the man pages are fine for the rest
wootehfoot has quit [Read error: Connection reset by peer]
jeko has quit [Remote host closed the connection]
THFKA4 has joined #zig
<u0jQx9gPyrYg> i changed my struct to use [32]u8 instead of u256 and now everything works as intended. thanks for pointing out the cause of my trouble. <3
<pixelherodev> :)
<redj> andrewrk: I'm wondering if I should have posted tese PRs against llvm11 branch instead of master.... sorry, should I change it? this would apply to the 3 PRs I just posted: https://github.com/ziglang/zig/pull/6629 <-- links to the other 2 in there
<andrewrk> redj, it looks like your branch is based on the llvm11 branch, so yes you should then make the PR against the matching branch
<redj> andrewrk: fixed
msingle has quit [Ping timeout: 260 seconds]
Akuli has quit [Quit: Leaving]
tdc has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
GrooveStomp has joined #zig
layneson has joined #zig
layneson has quit [Ping timeout: 240 seconds]
Baldr has joined #zig
Baldr has left #zig [#zig]
xackus has quit [Ping timeout: 264 seconds]
Baldr has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
<ifreund> tdeo: this seems like it might be progress? https://paste.rs/7Nl
<ifreund> I think what I've done so far probably isn't OK, but I made it to codegen
<tdeo> that's good
<ifreund> (yeah that's a stack overflow)
dermetfan has quit [Ping timeout: 260 seconds]
<tdeo> btw if you test with zig0 you don't have to wait for the self-hosted part to compile
Baldr has quit [Ping timeout: 256 seconds]
<ifreund> that'd probably be smart