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/
<pixelherodev> Different incentive structures, I'd presume
<pixelherodev> Microsoft has no incentive to increase POSIX compatibility
<daurnimator> pixelherodev: I noticed https://github.com/ziglang/zig/pull/4256/files has a weird whitespace change
<daurnimator> pixelherodev: the windows kernel is perfectly capable of an openat operation
<pixelherodev> I didn't say they weren't
<pixelherodev> Microcontrollers do, because they don't have a preexisting brainwashed rabid fanbase that'll keep buying for no good reason, or the tremendous market power of MS
<daurnimator> infact I'd argue the win nt syscall for that is much better designed
<pixelherodev> So yet another reason for them not to support openat
<pixelherodev> daurnimator, that PR should be disregarded for now; the logic is wrong.
<pixelherodev> Going to fix it later
<daurnimator> I should follow up with cyphar about fixing the linux syscall...
metaleap has quit [Quit: Leaving]
<Snektron> interested in how the comptime fmt looks
<fengb> It’s just converting the output argument to comptime
<fengb> No real API changes, but it unblocks async os.write
<fengb> Which I probably should have attempted before my spirit journey :P
SyrupThinker has quit [Quit: ZNC 1.7.5 - https://znc.in]
SyrupThinker has joined #zig
<daurnimator> howso?
* daurnimator still liked stream mixins which gave us async write
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 240 seconds]
zfoo has joined #zig
seoushi has quit [Quit: WeeChat 2.7]
<pixelherodev> daurnimator, whatever ended up happening to mixins?
<daurnimator> pixelherodev: andrew didn't like that mixins weren't namespaced within an object which could result in different mixins being incompatible with each other if they both implemented the same method
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
<pixelherodev> :(
<pixelherodev> What if there was e.g. a `pub usingnamespace T as T1`?
<pixelherodev> That would be a simple tweak that should allow for mixins to be blended completely
<fengb> The method names collide
* daurnimator likes that
<pixelherodev> fengb, no, because it wouldn't be part of R
<pixelherodev> Where R is the struct containing that line
<pixelherodev> If you have `var r: R`, where R has `pub usingnamespace T as T1`, it'd be r.T1.method and not r.method
<fengb> Ah I see. So T1 would be a pointer to r still? But with new methods
<daurnimator> pixelherodev: you could already do that as `pub const T1 = T`. the issue is what gets passed as `self` when you do: `r.T1.method()`
<pixelherodev> Hmm, there might actually be a way to achieve something similar with just comptime logic...
<daurnimator> pixelherodev: there's also the issue of people taking T1 out of `r`... which would be solved with e.g. the `fixed` proposal
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
lunamn has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 260 seconds]
<Snektron> You could pass in a struct literal with references to the functions
<Snektron> Instead of implicitly using functions of the implementer
<Snektron> But that doesnt fix using namespace collisions
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
_Vi has quit [Ping timeout: 272 seconds]
seoushi has joined #zig
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
Aransentin has quit [Ping timeout: 260 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
lunamn_ has joined #zig
seoushi has quit [Ping timeout: 265 seconds]
lunamn has quit [Ping timeout: 265 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
dddddd has quit [Quit: Hasta otra..]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 260 seconds]
lunamn_ has quit [Quit: leaving]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
mahmudov has quit [Ping timeout: 240 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 260 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
leeward has quit [Remote host closed the connection]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
_whitelogger has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
ntgg has joined #zig
<ntgg> is there something like `switch(<u32 or whatever>) { 1 => .A, 2 => .B, else |val| => something }`?
NotNite has joined #zig
NotNite has quit [Quit: NotNite]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
NotNite has joined #zig
NotNite has quit [Client Quit]
ntgg has quit [Ping timeout: 260 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
metaleap has joined #zig
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
Snetry has quit [Ping timeout: 268 seconds]
Snetry has joined #zig
Snetry has quit [Ping timeout: 260 seconds]
<metaleap> ntgg: there is but it looks like this ;) switch(val) { 1 => .A, 2 => .B, else => something(val) }
Snetry has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
_whitelogger has joined #zig
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
Snetry has quit [Ping timeout: 268 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
Snetry has joined #zig
Snetry has quit [Ping timeout: 265 seconds]
<metaleap> i want to use a hashmap at comptime but on `.put()` FixedBufferAllocator we come to "lib/zig/std/heap.zig:620:9: error: cannot store runtime value in compile time variable"
<metaleap> so whats the preferred alloc for comptime guys?
Snetry has joined #zig
<metaleap> if using `std.heap.page_allocator` then "lib/zig/std/mem.zig:125:36: error: unable to evaluate constant expression"
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 260 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
mahmudov has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 268 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 268 seconds]
knebulae has quit [Quit: Leaving]
marijnfs_ has quit [Ping timeout: 240 seconds]
marijnfs has joined #zig
_Vi has joined #zig
Snetry has quit [Ping timeout: 260 seconds]
Snetry has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
marijnfs has joined #zig
mahmudov has quit [Ping timeout: 268 seconds]
marijnfs_ has quit [Ping timeout: 268 seconds]
metaleap has quit [Quit: Leaving]
metaleap has joined #zig
knebulae has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
marijnfs_ has quit [Remote host closed the connection]
dddddd has joined #zig
forgot_password has joined #zig
jzelinskie has quit []
jzelinskie has joined #zig
<forgot_password> Hey andrewrk, regarding the issue with Core Audio headers and `translate-c`: I removed the `-x c` flag in `codegen.cpp`, but the issue still persists. Do you have any idea why that is? I don't have a clue to be honest...
<mikdusan> forgot_password: is it failing via `zig translate-c` or @cImport ?
dingenskirchen has quit [Quit: dingenskirchen]
jessermeyer has joined #zig
<jessermeyer> Should taking the address of a temporary variable be disallowed? e.g. &@ptrCast(type_dst, identifier);
<jessermeyer> Is there any value allowing taking the address of a temporary?
<metaleap> totally
<metaleap> because while it goes dead when returning..
<metaleap> beforehand you can pass it around much
<jessermeyer> How is that valuable?
<metaleap> aah sorry, i thought
<jessermeyer> I can show how it's a footgun waiting to happen.
<metaleap> i read "a temporary" and thought "a local". my bad
<jessermeyer> Ah, got cha.
<jessermeyer> I submitted a proposal to consider this an error.
jessermeyer has quit [Remote host closed the connection]
chrisb has joined #zig
eddyb[legacy] has quit []
eddyb[legacy] has joined #zig
dingenskirchen has joined #zig
zfoo has quit [Remote host closed the connection]
<betawaffle> what is builtin.Target.Abi.code16 ?
mahmudov has joined #zig
bsrd has quit [Quit: WeeChat 2.7]
<pixelherodev> Anyone have good resources on recursive descent parsers?
chrisb has quit [Quit: leaving]
<forgot_password> mikdusan, hey, sorry for answering so late. I haven't tried `@cImport`, because I don't know the location of the headers. However, clang, by default, can resolve the files. So what I did was to first run the pre-processor via `clang -E` and then `zig translate-c` the output.
<forgot_password> When I run `clang -x c` on the output it works fine, but translate-c fails
<fengb> pixelherodev: I learned quite a bit following https://github.com/kanaka/mal
<pixelherodev> fengb, thanks!
<mikdusan> try --> zig translate-c foo.h -F`xcrun -show-sdk-path`/System/Library/Frameworks
<pixelherodev> Might try writing a LL parser first, as I think I understand it a bit more
<pixelherodev> this is for the LLVM backend; figured a real parser would be a better idea than fixing up the hacked together kludge
<forgot_password> When copy that 1 by 1 it says that it expected another argument after '-show-sdk-path'
<pixelherodev> Also improving the design a bit, so that the parser can be easily replaced without needing to tweak anything else
<forgot_password> Oh wait, now I know what `-F` does
<pixelherodev> That way, it can have e.g. an LLVM 9 parser and an LLVM 10 parser and swap them on demand
<forgot_password> I get the same error :/
<pixelherodev> And since the AST generation isn't part of the parser anymore, the same AST can be generated regardless of the parser
<mikdusan> forgot_password: don't use output from `clang -E`. use your header directly.
<forgot_password> Yeah I noticed my mistake as well, hehe... Now it cannot find TargetConditionals.h
<mikdusan> in case irc garbles the sigils: https://hastebin.com/okinazareb.sql
<forgot_password> No it works fine, I'm just using fish so I had to adjust something
<mikdusan> what is the .h file you're using?
<forgot_password> It just includes <CoreAudio/CoreAudio.h> and <AudioToolbox/AudioToolbox.h>
forgot-password has joined #zig
forgot_password has quit [Quit: Leaving]
Akuli has joined #zig
<forgot-password> A fews days ago I uploaded a link to a pastebin containing the errors, should I send it again?
<forgot-password> posted*, not uploaded
<wilsonk> I thought that three back-ticks was the markdown symbol to get code to show properly in an issue?
<mikdusan> ok so another path is needed:
<wilsonk> is is something else?
<forgot-password> wilsonk: It is, afaik
<forgot-password> Did you add a line break?
<wilsonk> weird
<forgot-password> Does it not show up at all or is it only missing syntax highlighting?
<wilsonk> yeah, line break didn't change anything
<wilsonk> just missing the highlighting
<forgot-password> You can add the language after the three ticks at the beginning
<wilsonk> maybe that takes a minute or two? Not sure
<forgot-password> Like "```zig\n code \n```"
<pixelherodev> Highlighting requires specifying the language, e.g. ```zig
<wilsonk> ah, ok
<forgot-password> mikdusan: That didn't change anything, sadly
<pixelherodev> GitHub also is more sensitive than most markdown parsers, and so requires empty lines before the opening ``` and after the closing ```
<wilsonk> yep that did it. Thanks
<mikdusan> forgot-password: when's the last time you updated xcode?
<forgot-password> Phew, is there a quick way to find that out?
<forgot-password> I mean I can update it now
<wilsonk> bbl
<mikdusan> forgot-password: no let's just check caches
<forgot-password> I'm running "Version 11.2.1 (11B500)" if that helps
<mikdusan> and output of `xcrun -show-sdk-path` ?
<forgot-password> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
<mikdusan> and include_dir value in zig-cache/native_libc.txt ?
<forgot-password> Running the command doesn't cause a zig-cache directory to appear, apparently
<mikdusan> ok how about ~/Library/Application Support/zig/stage1/native_libc.txt
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #zig
<forgot-password> "include_dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
<mikdusan> erase native_libc.txt
<mikdusan> run translate command again, with ONLY the -F (-I should not be needed)
<forgot-password> Wow, yeah, that worked
<forgot-password> Awesome, thank you very much!
<mikdusan> so long story short, you will always need -F for frameworks until we enhance zig to start figuring that out,
dingenskirchen1 is now known as dingenskirchen
<forgot-password> Okay, I assume that the `MacOSX10.14` directory was leftover from earlier zig installations?
<mikdusan> and anytime you upgrade xcode compiler or move stuff around that causes that cached path location to be wrong, the file has to be removed
<mikdusan> yup
<forgot-password> Alright
<forgot-password> I will try to remember the native_libc file when I hit such an issue again :)
<forgot-password> Thanks again :)
<mikdusan> fyi... we're on a track to make this outdating of cache less painful but not there yet
<forgot-password> Well, it's not that painful if you know what you need to do :p
forgot-password has quit [Quit: leaving]
ntgg has joined #zig
jessermeyer has joined #zig
<pixelherodev> Heh, figured out what to call the LLVM IR Zig library: ziggirat :P
metaleap has quit [Quit: Leaving]
<pixelherodev> Might be something better but I think this is sufficiently face-palmingly stupid
dimenus has quit [Remote host closed the connection]
<ntgg> is there something like `switch(some_number) { 1 => .A, 2 => .B, else |val| => something }`?
<pixelherodev> `switch (val) {1 => .A, 2 => .B, else => something}`
<pixelherodev> val is still usable there
<pixelherodev> e.g. `else => something(val)` is perfectly valid
ntgg has quit [Ping timeout: 240 seconds]
<pixelherodev> What's the build.zig equivalent of --pkg-begin --pkg-end?
<pixelherodev> Never mind, found it
<pixelherodev> Scrolling through build.zig is fun :P
<pixelherodev> Well, this is useful: `%s/std.debug.warn(".*"/\=submatch(0).", .{}"`
<pixelherodev> Though it probably would've been faster to type it manually than to figure out how to do that :P
<pixelherodev> Other neat Vim/Zig integration: if an error is returned all the way through main (e.g. `try a()` in main), it'll automatically jump to the *source* of the error if you run `:make run` (a build.zig run step)
<pixelherodev> This is *awesome*, and huge thanks to whoever set this up
decentpenguin has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
decentpenguin has quit [Quit: decentpenguin]
<pixelherodev> There a way to add arbitrary args to the Zig invocation of a exe in `build.zig`?
<BaroqueLarouche> for outputting raw file in the build system, does installRaw("kernel.bin") function to LibExeObjStep make sense ?
* pixelherodev shrugs
<pixelherodev> Read build.zig directly is my suggestion
<pixelherodev> It's what I'm doing
<BaroqueLarouche> I'm going to implement it, asking feedback for the function name and parameter
<pixelherodev> Ohh
<pixelherodev> Whoops
<pixelherodev> If you ask me, yeah
Akuli has quit [Quit: Leaving]
<mikdusan> pixelherodev: `zig build run -- myarg0 myarg1 ...` and add those args to your run command:
<mikdusan> `if (b.args) |args| run_cmd.addArgs(args);`
<pixelherodev> Not run though
<pixelherodev> I meant the zig invocation
<pixelherodev> Doesn't matter anyways
<pixelherodev> On a different note: `target triple\b|target datalayout\b|source_filename\b|[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*\b`
<pixelherodev> That's the *worst* regex I've ever personally used
dingenskirchen has quit [Quit: dingenskirchen]
<pixelherodev> Matches LLVM identifiers in my lexer :P
<pixelherodev> (I don't actually use regexes in the lexer, but in the docs)
dingenskirchen has joined #zig
<jessermeyer> Is this "has no member" error more likely a Zig .pdb error or VS .pdb parse issue?
<pixelherodev> I'd guess nnot
<pixelherodev> That's VS Code using debug info for a Windows DLL
<pixelherodev> Zig doesn't generate debug info for dx12, Microsoft does (AFAIK)
<jessermeyer> Isn't Zig providing debug info for it's structs?
<jessermeyer> its~
<jessermeyer> plot thickens
<pixelherodev> Ah wait I see what you mean
<jessermeyer> the function has a plausible address
<pixelherodev> You used translate-c
<jessermeyer> Yessir.
<pixelherodev> Check the header?
<jessermeyer> It looks fine.
<pixelherodev> I'm saying, the value shows up in the C header also?
<pixelherodev> Zig didn't magic it up?
<jessermeyer> By value you mean EnableDebugLayer?
<jessermeyer> Yeah it's all there and accounted for.
<pixelherodev> yeah
<jessermeyer> The whole bit looks like
<jessermeyer> const ID3D12DebugVtbl = extern struct { QueryInterface: fn ([*c]ID3D12Debug, [*c]const IID, [*c]?*c_void) callconv(.Stdcall) HRESULT, AddRef: fn ([*c]ID3D12Debug) callconv(.Stdcall) c_ulong, Release: fn ([*c]ID3D12Debug) callconv(.Stdcall) c_ulong, EnableDebugLayer: fn ([*c]ID3D12Debug) callconv(.Stdcall) void,};pub const ID3D12Debug =
<jessermeyer> extern struct { lpVtbl: [*c]ID3D12DebugVtbl,};
<jessermeyer> eh
<jessermeyer> That's hard to read.
<jessermeyer> But it's there properly.
<jessermeyer> And the last image shows that an address is being assigned there. It's just not showing up in the watch window.
<pixelherodev> I mean is it in DirectX.h or whatever it's called?
<jessermeyer> Originally, yes. d3d12sdklayers.h
<jessermeyer> I had to fix the macro tho, since translate-c couldn't handle the \ character.
<pixelherodev> Then I don't think that'd be on Zig
<pixelherodev> Unless it's a C++ header?
<pixelherodev> In which case, I wouldn't expect translate-c to even work
<jessermeyer> It's technically both but I'm using the C COM interface macros.
<jessermeyer> Nah it does. It's a very simple macro after the fix.
<jessermeyer> #define ID3D12Debug_EnableDebugLayer(This) ( (This)->lpVtbl -> EnableDebugLayer(This) )
<pixelherodev> No clue, sorry
<jessermeyer> Thanks for the sanity check :)
<jessermeyer> I'll wait until someone with some experience with the debug output shows up before filing an issue.
metaleap has joined #zig
<jessermeyer> Ok, I'm noticing a pattern.
<jessermeyer> functions whose return type is void are not discoverable by VS.
<jessermeyer> This smells more and more like a Zig debug output issue...
<jessermeyer> Going to risk an official issue post on Github...
<pixelherodev> That's not a risk
<pixelherodev> Worst case you're wrong and it's closed
<jessermeyer> :)
<jessermeyer> Yup, I think I have a mini repo.
NotNite has joined #zig
NotNite has quit [Client Quit]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
lunamn has joined #zig
<pixelherodev> It's safe to assume system LLD has the needed patches by now, correct?
ave_ has joined #zig
jessermeyer has quit [Remote host closed the connection]
_whitelogger has joined #zig
rjtobin has joined #zig
rjtobin has quit [Remote host closed the connection]
Cadey has joined #zig