<dimenus>
however, i don't know why we need to generate .def/.lib files for libs that already exist
<dimenus>
since the linker will need to reconcile that anyway
<dimenus>
it's one of thing if we're not linking libc, but when we are
<dimenus>
it's better to just pass the full lib
<andrewrk>
dimenus, master branch doesn't have lib files available when cross compiling
<dimenus>
Zig automatically generates def files for symbols it needs that are defined in the standard lib, but a c library we might be linking with (this is a problem when statically linking) might require more
<dimenus>
andrewrk: sorry, I'm confused by the comment. I'm not referring to cross compiling here - just the issue I was encountering
<dimenus>
https://github.com/ziglang/zig/issues/2064 this issue at it's root is a full path problem, eg when we pass kernel32 / ntdll in link.cpp, we need to specify full paths
<dimenus>
but since we're linking libc in this scenario, better to just not generate lib/defs for those libraries anyway
<andrewrk>
dimenus, sorry I thought you meant "full lib" as in a .def file that was complete rather than the minimal ones zig generates
FireFox317 has quit [Ping timeout: 260 seconds]
<dimenus>
nope, I didn't modify any of that :P. when not linking libc - we still generate defs as expected
<dimenus>
**minimal defs
hio has quit [Quit: Connection closed for inactivity]
ltriant has quit [Ping timeout: 272 seconds]
ltriant has joined #zig
avoidr has quit [Remote host closed the connection]
fengb has joined #zig
ltriant has quit [Ping timeout: 245 seconds]
<dimenus>
hyrx/andrewk: is the type of an expression inferred upon assignment? or do eg variables tied to integer literals remain untyped until they're compared?
<hryx>
dimenus: integer literals have type comptime_int, so they're not untyped. And then they stay as that type until casted to another integer type. a comparison may cause an implicit cast
<hryx>
and likewise float literals have type comptime_float
<hryx>
I'm pretty sure all expressions always have types, even before they're bound to variables, then implicit casting takes care of turning it into the right type as needed
<emekankurumeh[m]>
andrewrk so what threading model are you using for mingw-w64 then? posix or windows?
kristoff_it has quit [Ping timeout: 245 seconds]
<andrewrk>
emekankurumeh[m], I'll push the branch
<andrewrk>
emekankurumeh[m], windows-libc branch
ltriant has joined #zig
fengb has quit [Ping timeout: 260 seconds]
<daurnimator>
andrewrk: mingw should not be any-windows-any... maybe it could be any-windows-gnu... though there is more than one way to gnu on windows.
<andrewrk>
I've only found one redistributable copy of windows.h & friends
<andrewrk>
I think this may be able to satisfy the msvc ABI as well
<daurnimator>
it's a superset of old msvc I believe.
<daurnimator>
i.e. there is more than the basics in there... but also new msvc has more things
darithorn has joined #zig
<daurnimator>
andrewrk: looking at your PR.... why is e.g. GL/gl.h in there? although OpenGL is part of the windows sdk, it's not part of the kernel32 (OpenGL is its own library included in the windows sdk)
<andrewrk>
zig is a self-contained cross compiling toolchain
<daurnimator>
yeah but we don't include *headers for every linux library*
<daurnimator>
why ship (e.g.) opengl for windows but not linux?
<andrewrk>
it would be more work (and therefore a future project) to separate optional components out of mingw-w64
<andrewrk>
I agree that a more minimal core + package manager is the better future, but this does represent an incremental improvement
<andrewrk>
this has always been a planned part of the zig package manager - ability to cross compile C libraries
<daurnimator>
my immediate reaction is bloat and setting bad expectations.....
<andrewrk>
you say the word bloat, but our hello world is still 6KB on linux, 4KB on windows. we're talking about a download tarball going from 30 MiB to 36 MiB and gaining the ability to cross compile for windows out of the box
<daurnimator>
andrewrk: if I proposed shipping GL headers for linux as well... what would be the response?
<andrewrk>
"wait for the zig package manager, it will solve that use case for you. in the mean time the workaround is to copy the library source code into your source repo, or otherwise fetch it as part of the build"
ltriant has quit [Ping timeout: 248 seconds]
ltriant has joined #zig
<darithorn>
are errors types going to be strongly typed eventually?
<andrewrk>
what does strongly typed mean?
<darithorn>
right now they evaluate to integers so you can use them for slices.
<darithorn>
it took me a second because my test passed that's using a slice even though it returned an error value
<darithorn>
it being a function that returns either an error or an index that i then use to slice an array
<andrewrk>
I'm not sure what you mean about errors evaluating to integers. there is no implicit cast from error sets to integers
<presiden>
darithorn, maybe pastebin some code so we can see what you mean?
<darithorn>
i figured out the issue. sorry, it was a bug in my own code
<darithorn>
my loop was supposed to be breaking out but it wasn't so it was getting run again and that's where i got confused
<darithorn>
maybe it's time to head to bed lol
laaron- has quit [Remote host closed the connection]
laaron has joined #zig
darithorn has quit [Quit: Leaving]
qazo has quit [Ping timeout: 268 seconds]
<andrewrk>
for me too
tankf33der has left #zig [#zig]
fsateler has quit [Ping timeout: 244 seconds]
fsateler has joined #zig
fsateler has quit [Ping timeout: 245 seconds]
ltriant has quit [Quit: leaving]
fsateler has joined #zig
hio has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 248 seconds]
<daurnimator>
Who was it that was playing around with zig and wasm?
fubd has joined #zig
<fubd>
daurnimator: i have been
<daurnimator>
fubd: have you tried to mix C code with it at all?
<fubd>
i did try importing the chipmunk c library (which compiles great with zig build, btw)...but then realized that @cImport won't work without libc
<fubd>
and mixing libc and wasm doesn't make sense, right?
<daurnimator>
uh, I'm not sure... for somethings it does (e.g. memcpy). for other things it doesn't (e.g. fopen)
<fubd>
yeah. that's where i got stuck
<fubd>
i assume we'll need a "libc" for wasm
<daurnimator>
fubd: well that's why we have the target wasm32-freestanding-musl
<daurnimator>
I think musl provides those routines
<fubd>
daurnimator: ah I see...I haven't tried to use musl yet
<fubd>
let me know if you figure out how to
avoidr has joined #zig
<daurnimator>
I had quick attempt but it failed with an error about missing clang builtin library. I'll need to try again with a zig binary downloaded
<fubd>
ok
<daurnimator>
Wasn't sure if I'm on well-trodden ground or if I'm the first to try...
<fubd>
daurnimator: haha, good luck :)
<fubd>
if you want to share a build.zig or anything when you hit snags, let me know
very-mediocre has quit [Read error: Connection reset by peer]
kristoff_it has joined #zig
HesamR has quit [Read error: Connection reset by peer]
very-mediocre has joined #zig
andersfr has joined #zig
very-mediocre has quit [Read error: Connection reset by peer]
Akuli has joined #zig
<diltsman>
Is there any read/write width guarantee on packed structs?
fengb has joined #zig
<andersfr>
what do you mean by width guarantee?
Tetralux_ has joined #zig
Tetralux has quit [Ping timeout: 248 seconds]
ntgg has joined #zig
<diltsman>
Meaning that it is guaranteed to read/write an aligned word or something like that, rather than the smallest piece (often byte) that is sufficiently wide.
<diltsman>
My use case is MMIO, but I just noticed in the documentation that it isn't viable for that yet.
<andersfr>
a struct can have a preferred alignment but since you are doing MMIO you will probable be placing it explicitly with an @intToPtr
<mq32>
but i think i'd prefer self-callable function pointers as well. imho this would be enough to have usable interfaces
<fengb>
I think it's just how Zig resolves ambiguity atm. The language can't really distinguish between `self.function(self)` vs `self.function(arg1)` on function pointers
<fengb>
Even with methods, it doesn't really know the difference, so if you call `self.init()` it'll throw an error with first argument doesn't match type
<ntgg>
mq32: That works, feels real awkward
halosghost has joined #zig
<mq32>
yeah
<ntgg>
Is there some sort of tracking issue for interfaces?
<fengb>
Those are more internals. I don't think any work has been done on binding self to function pointers
darithorn has joined #zig
<mq32>
i think this would be sufficient for most of the cases we require interfaces
<mq32>
just have a struct of function pointers or similar
<mq32>
so more or less the COM pattern from windows
<fengb>
We could have Lua style methods: self:method() => self.method(self)
<gonz_>
I think people should slow down a little bit
<gonz_>
Every time I check IRC there is some feature request/discussion
<gonz_>
Everyone wants small and simple + that one feature
<gonz_>
neglecting the fact that if everyone gets their way it's just C++ all over again
<mq32>
yeah that's true
<fengb>
I think discussing new features is fine. We shouldn't accept everything though :P
<mq32>
but hey, i can argument with zen of zig, so... :D
<gonz_>
I personally love traits/type classes, but maybe we just don't need them
<fengb>
I think self-binding is a natural question for people new to the language. I had the same question, but I actually prefer explicit self argument now
<fengb>
Oh traits and such. I'm gonna punt that back to #130
<mq32>
i really like the self-binding style as it removes redundancy (my variable is of type T; so i can call a function T.fun with just the variable)
<mq32>
reduces errors (by removing a redundant argumetn) and makes code more generic
<mq32>
but on the topic of feature discussions: i have trust in andrewrk that he only includes the features he thinks will benefit Zig
<fengb>
The problem with self-binding is that it's ambiguous atm. The compiler doesn't actually introspect the type
<gonz_>
I'm sure no one sets out to hurt their own creation
fengb has quit [Remote host closed the connection]
<gonz_>
The road to hell is paved with good intentions
fengb has joined #zig
<fengb>
Stroustrup? >_>
<mq32>
yeah, that's true
<mq32>
fengb, can you make an example on ambiguity?
<fengb>
The compiler doesn't know the difference between `self.func(self)` and `self.func(1)`
<fengb>
When func is a function pointer
<fengb>
Right now, it doesn't do anything fancy to do autobind, which is why you have to explicitly give it self
<mq32>
so the actual problem is that we are allowed to have fields called the same name as static members?
<companion_cube>
but you probably want self.vtable.func(self), if methods are in a static vtable (replaces n function pointers with one vtable pointer)
<fengb>
There's no syntax for the compiler to autobind
<mq32>
yeah, right
<mq32>
as you said, Lua does it by having a separate call operator for that
<fengb>
Yeah
<mq32>
i think that's a good, but not optimal solution
ltr- has joined #zig
<diltsman>
Why can't I just apply a bitwise not to an integer constant (0x1234)?
very-mediocre has quit [Read error: Connection reset by peer]
<diltsman>
I see that doing ~u32(0x1234) does work.
<diltsman>
I assume that it has something to do with the integer constant being of unknown widht.
<fengb>
Yeah, literals are all `comptime_int` until casted elsewhere
<diltsman>
What is the idiomatic way to doing the equivalent of this in C: if (!my_int)
<fengb>
if (my_int != 0)
<fengb>
Er... my_int == 0
very-mediocre has joined #zig
andersfr has joined #zig
fengb has quit [Remote host closed the connection]
darithorn has quit [Quit: Leaving]
samtebbs has quit [Quit: leaving]
fgenesis has joined #zig
andersfr has quit []
very-mediocre has quit [Read error: Connection reset by peer]
<andrewrk>
I got accepted into GitHub Sponsors. What this means for donations is compared to Patreon, GitHub will not take 10% in fees, and for the first year GitHub will match the donation, doubling its effectiveness
very-mediocre has joined #zig
FireFox317 has joined #zig
<FireFox317>
Congrats andrewrk with the Github sponsors thing!
<donpdonp>
right on. congrats andrewrk
<mikdusan>
nice!
<hryx>
congratulations andrewrk! For existing patrons, I assume you'd like them to redirect their funds from Patreon over to GitHub?
<andrewrk>
I do think it will be a better option - I'll send an email
darithorn has joined #zig
ntgg has quit [Quit: Lost terminal]
very-mediocre has quit [Read error: Connection reset by peer]
darithorn has quit [Quit: Leaving]
fengb has joined #zig
<fengb>
Congrats!
avoidr has joined #zig
<mq32>
nice thing, andrewrk! don't waste that money! :D
<dimenus>
does Github take anything?
<companion_cube>
not yet ;)
<torque>
they actually do sponsorship matching currently, I think?
<torque>
or is that only for select projects
<andrewrk>
yes they match for the first year, but even after that the only fee will be credit card processing. patreon takes something like 8%
<fengb>
That's a pretty big difference
<companion_cube>
it might change in the future though? I mean, they've been bought my microsoft
<andrewrk>
here's the way I see it: it's currently the best option
<companion_cube>
yeah that makes sense for now, sure
<andrewrk>
yeah, and they also didn't allow me to make extra tiers that was just to make there be more amount choices available
<andrewrk>
but they said that will be supported in about 3 months
<hryx>
ah, ok
<andrewrk>
hryx, thanks <3
<andrewrk>
btw I wonder if a good stream topic today would be trying to merge your PR
FireFox317 has quit [Ping timeout: 260 seconds]
ltr- has quit [Remote host closed the connection]
<hryx>
my pleasure :> and maybe! I imagine it would be mainly debugging?
<andrewrk>
I should do the stream on a windows machine
Akuli has quit [Quit: Leaving]
kristoff_it has quit [Ping timeout: 245 seconds]
<hryx>
phooey, I have a meeting during your stream. I'll have to watch the recording later
<andrewrk>
oh btw I'm doing it an hour early today - in 40 minutes
very-mediocre has joined #zig
<scientes>
How do i got about debugging why something is not comptime?
<andrewrk>
better error messages are planned in the future, but for now: @compileLog each value involved in the expression to find out if it is comptime
<andrewrk>
track down the value that is not comptime. it's probably a function call or a `var` instead of `const`
<scientes>
but can't var's be comptime?
<andrewrk>
yes `comptime var`
<lunamn>
is there a plan on adding sockaddr_un to std/os/bits/linux.zig's sockaddr? or is this going to be tackled on after coroutine rewrite?
<andrewrk>
lunamn, linux types and stuff should be added asap
<lunamn>
i see, was confused with the "this intentionally only has ip4 and ip6" comment while starting to write unix sockets
<andrewrk>
it takes someone to think about the best way to represent the ABI that will be as posix-compatible as possible
<andrewrk>
C sort of patches over this with the preprocessor, so we will have to be careful with how to represent the types in zig
<scientes>
oh yeah that part of POSIX is pretty ugly
fengb has quit [Ping timeout: 260 seconds]
very-mediocre has left #zig [#zig]
<andrewrk>
ok stream will actually be in 30 minutes from now. 1. Demo new Zig features from last week. 2. Merge pull requests. 3. Q & A. https://www.twitch.tv/andrewrok/
<scientes>
hmm, should i submit my pull request i have sitting here, that is ready to go?
darithorn has joined #zig
<andrewrk>
realistically I will be lucky if I am able to complete hryx's in the stream
<andrewrk>
live debugging is risky
<andrewrk>
most of the time I just sit there looking like an idiot :)
<scientes>
hehe
<companion_cube>
only to people who have never debuggued anything!
<scientes>
debugging is at least half of what it means to be a programmer
<mq32>
scientes: 80%
<companion_cube>
sometimes 80% is the time spent building 🙃
jjido has joined #zig
<mq32>
companion_cube, i work with C++Builder
<mq32>
one of my projects compiles like … 20 Minutes
<scientes>
my god, that can't possibly be fun
<mq32>
and i have a powerful 8 core processor :D
<scientes>
get an EPYX or Talos II
<mq32>
yeah, that's what real programmers want
<mq32>
MOAR COARS
<companion_cube>
heh, I use z3 and whenever I have to reinstall it, it takes a good 10 minutes
<mq32>
i really hope that Espressif will get their LLVM port for the ESP32 ready…
<mq32>
so i can use zig to develop instead of C
<scientes>
oh that looks cool
<scientes>
so gcc only right now?
<mq32>
yeah
<scientes>
you could also port zig to gcc haha
<mq32>
just use the LLVM→C compiler, then compile with GCC
<scientes>
that probably doesn't make much sense until stage2 however
<scientes>
mq32, is that in-tree? I've not seen a C backend
<mq32>
nah, it's not
<mq32>
it was, for some time
<mq32>
but it's not anymore
<mq32>
i'd like to have some C89/ANSI-C backend with optimizers
<mq32>
as the C backend i found is not optimizing well
<scientes>
yeah but optimized to what?
<mq32>
"less code"
<scientes>
I don't think you can really even optimize a c backend well
<mq32>
so, the backend i found outputs LLVM IR without any dead end elimination
<mq32>
so you have one stack variable for every LLVM value
<mq32>
memory reusing would be sufficient already
<scientes>
oh well then you can't generate c89----well I guess you could just randomly divide by zero or something
<scientes>
but I think you need __builtin_unreachable()
<halosghost>
hehe
<halosghost>
I like the idea of randomly dividing by zero
<scientes>
so then it just becomes a gcc backend, and in that case why not just use a LLVM-IR to GIMPLE translator
<mq32>
yeah
<mq32>
i'm doing a lot of stuff with old computers and the most modern language you can find is sometimes C :D
<scientes>
but i'm saying you can't optimize C
<mq32>
but would be nice to code newer languages on old platforms
<scientes>
only if you know what compiler you are using
Ichorio has joined #zig
<scientes>
that's why compiler keep support for old platforms for a long time
<mq32>
yeah, but i have the different problem
<mq32>
i have compilers that aren't maintained since early 90ies and don't optimize well
<scientes>
but what type of chip? This is why people still use the Z80, because it supports 8086 and thus has a decent compiler
<mq32>
different stuff
<scientes>
why can't you just use a ARM chip, so you get a super modern compiler?
<mq32>
because platform is fixed
<mq32>
in terms of: i want to code stuff for c64, …
<mq32>
but there are no compilers out there that support modern languages :(
<mq32>
got to go
<companion_cube>
andrewrk: why do you hate `:x` so much? ;-)
halosghost has quit [Quit: WeeChat 2.5]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
HesamR has joined #zig
<dimenus>
has anyone proposed that you just always null terminate string literals?
<companion_cube>
😱
HesamR has quit [Quit: Leaving]
<emekankurumeh[m]>
I think that's the current proposal dimenus
<emekankurumeh[m]>
that the type of string literals will be `[]const null u8`
jjido has joined #zig
jjido has quit [Client Quit]
<andrewrk>
dimenus, yeah that's planned. the type will be `*[N]null const u8`
<andrewrk>
companion_cube, you mean because I use :blk sometimes? I think :x is fine
<companion_cube>
no, I mean in vim :D
<companion_cube>
all these :wq
<andrewrk>
what does :x do?
<companion_cube>
same as :wq :)
<companion_cube>
only, so much more efficient to type!
<andrewrk>
:wq is actually easier for me to type! ironically, in dvorak, :wq means pressing the x key on the keyboard
<companion_cube>
^^
<companion_cube>
where were the questions asked, btw?
<andrewrk>
twitch chat
<companion_cube>
ah, I see. well maybe I should make myself an account then.
ntgg has quit [Ping timeout: 248 seconds]
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ichorio has quit [Ping timeout: 252 seconds]
kristoff_it has joined #zig
hio has quit [Quit: Connection closed for inactivity]
kristoff_it has quit [Ping timeout: 246 seconds]
darithorn has quit [Remote host closed the connection]