ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<Sahnvour> making progress in adding stacktrace for COFF, now I'll need to find out how/where to find the addres->source file relations
Sahnvour has quit [Quit: Page closed]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cenomla has quit [Quit: cenomla]
Ojoshuaolson1 has joined #zig
<Ojoshuaolson1> Zig's undocumented build system has impressive goals. Is there a good persistent place to list notable existing ones for intelligent discussion? Besides the mentions in https://github.com/zig-lang/zig/issues/204#issuecomment-291786367, I'd add Qt's Qbs, the defunct Tup, and especially build2 (build2.org/faq.xhtml).
<Ojoshuaolson1> That issue is closed, btw. Zig forum one day? :P
<GitHub124> [zig] andrewrk closed pull request #860: doc: fix typo and tighten wording in error sections (master...patch-1) https://git.io/vx0IY
<GitHub115> [zig] andrewrk pushed 2 new commits to master: https://git.io/vx0cT
<GitHub115> zig/master c0a69a5 Andrew Kelley: Merge pull request #860 from jayschwa/patch-1...
<GitHub115> zig/master 3e836f5 Jay Weisskopf: doc: fix typo and tighten wording in error sections...
<Ojoshuaolson1> I'll assume someone saw this. I understand this wouldn't belong in an issue tracker.
<Ojoshuaolson1> kthxbai
Ojoshuaolson1 has quit [Quit: Page closed]
m6w6 has quit [Quit: ZNC - http://znc.in]
hobomatic has quit [Read error: Connection reset by peer]
m6w6 has joined #zig
hoppetosse has joined #zig
tiehuis has joined #zig
Sahnvour has joined #zig
tiehuis has quit [Quit: WeeChat 2.1]
hobomatic has joined #zig
hoppetosse has quit [Ping timeout: 240 seconds]
davr0s has joined #zig
davr0s has quit [Read error: Connection reset by peer]
davr0s has joined #zig
steveno_ has joined #zig
hoppetosse has joined #zig
hopppetosse has joined #zig
hoppetosse has quit [Ping timeout: 246 seconds]
hoppetosse has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hopppetosse has quit [Ping timeout: 240 seconds]
davr0s has joined #zig
hoppetosse has quit [Ping timeout: 265 seconds]
hoppetosse has joined #zig
steveno_ has quit [Ping timeout: 276 seconds]
steveno_ has joined #zig
<andrewrk> Sahnvour, exciting
<andrewrk> Sahnvour, I think there are a couple approaches you could take. The most straightforward way would be https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/getting-started-debug-interface-access-sdk
<andrewrk> this is unfortunate because it depends on some DLLs that ship with MSVC. But maybe that's OK for debug mode. Or maybe we try to parse pdb files
<Sahnvour> oh, I assumed the solution would have to be in pure Zig
<andrewrk> that would be better. unfortunately microsoft decided to provide an API for debug info instead of documenting the format
<Sahnvour> I think they open-source'd it not so long ago to help the llvm folks
<Sahnvour> wait, I was thinking that Zig emitted the debug information directly in some COFF section, but it's using pdb files after all ?
<andrewrk> correct
<andrewrk> this is provided by LLVM and LLD
<Sahnvour> ok
MajorLag2 has joined #zig
MajorLag has quit [Ping timeout: 276 seconds]
<andrewrk> best possible scenario: we are able to understand debug info with no external dependencies on DLLs
<Sahnvour> indeed
<Sahnvour> if llvm has an implementation for reading/writing this format, would it be possible to make use of it, by embedding it inside the zig compiler as some kind of builtins ?
<andrewrk> the problem with that is that userland programs written in zig need this code embedded in them to print their own stack traces
<andrewrk> we don't want userland programs written in zig to depend on llvm
<Sahnvour> maybe I'm missing something but I was thinking about building it right into the zig executable (on windows), statically linked and all (given that there effectively is such a library in llvm)
<andrewrk> so let's say it's in the zig executable. and now we have a hello world zig program which calls @panic
<andrewrk> we build hello world with zig, and then run it
<andrewrk> and it should print a stack trace
<andrewrk> zig.exe is independent from helloworld.exe
<Sahnvour> oh, right
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
MajorLag has joined #zig
MajorLag2 has quit [Ping timeout: 276 seconds]
<Sahnvour> I'm not sure it would be doable to use the DIA lib, as it relies on COM and proprietary extensions of msvc (`__uuidof`)
<Sahnvour> also LLVM has some documentation on the pdb format https://llvm.org/docs/PDB/index.html , I'll have a look at it to see if it helps getting started
<andrewrk> excellent
davr0s has joined #zig
noonien has joined #zig
<andrewrk> a recording of the talk I did last week is uploaded: https://www.recurse.com/events/localhost-andrew-kelley
hoppetosse has quit [Ping timeout: 260 seconds]
Ichorio has joined #zig
isd has joined #zig
jab has joined #zig
tset has joined #zig
tset has quit [Client Quit]
test324 has joined #zig
test324 has quit [Client Quit]
MajorLag2 has joined #zig
MajorLag has quit [Ping timeout: 276 seconds]
halosghost has joined #zig
<halosghost> o/
<halosghost> how's it going everyone?
<isd> \o
<andrewrk> hello
<halosghost> andrewrk: I'm really interested in zig; everything you're aiming at (C without the warts, manual memory management, seamless C interop, great cross compilation story) is deeply exciting
<halosghost> I'm also super excited that 0.2.0 cleaned up a lot of the syntactic noise by replacing sigils with clearer keywords
<halosghost> I do have a question though: is there a specific motivation for the layouting of blocks (e.g., the for loop syntax being `for (collection) |member|` instead of being some variant of `for member in collection`)?
<andrewrk> halosghost, only to be consistent with other syntax. switching on a union(enum) unwraps the payload: Foo => |payload| {}
<andrewrk> unwrapping a nullable or error union: if (foo()) |value| {} else |err| {}
<andrewrk> suspending a coroutine gives you the promise handle: suspend |p| { }
<halosghost> cool, that's an awesome reason
<halosghost> internal consistency is very much a soft spot of mine
* halosghost is minorly tempted to flood the zig issue tracker with all the things I desire in a language
<halosghost> oh, that reminds me
<halosghost> am I correct in thinking that https://ziglang.org/documentation/master/#IntType exposes LLVM's arbitrarily-sized fixed-width integers?
<andrewrk> yes
<halosghost> I cannot describe how excited that makes me
<andrewrk> feel free to open as many high quality and well articulated issues as you want. I recommend searching a bit first; many ideas have been proposed and some are still open, some are closed
<halosghost> sure
<ltr_> nice talk andrewrk
<andrewrk> thanks ltr_
<andrewrk> halosghost, what project are you considering working on in zig?
<halosghost> there's not a specific project
<halosghost> C is the language with which I am most familiar
<halosghost> and most of my personal projects are written in C
<halosghost> the possibility of moving to a safer language without all the baggage that a lot of the current options offer sounds really great
<andrewrk> cool
<andrewrk> zig is a bit young, but the more people trying to use it the faster it will mature
<halosghost> yeah
<ltr_> andrewrk: what are you using for autocomplete and aid while coding?
<andrewrk> vim and grep
<andrewrk> it's not ideal
steveno_ has quit [Quit: Leaving]
<andrewrk> I'm trying to get the self hosted compiler off the ground so that I can implement all the fun features there instead of in c++: doc generation, language server, multithreaded compilation, caching build artifacts, watching file system for changes and auto-rebuilding
<andrewrk> language server being the one that is relevant to autocomplete and coding aid
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ltr_> thats sounds right
hoppetosse has joined #zig
davr0s has joined #zig
faa5e has joined #zig
<faa5e> Have you considered (for recursive functions) to have functions that use the heap instead of the stack?
<faa5e> This means that some memory is allocated before the (recusive) function is called and the memory is released after the function returns.
<faa5e> It does mean that a function call can result in an allocation error.
<andrewrk> faa5e, yes - in fact this is how coroutines work
<andrewrk> the current syntax for this is
<andrewrk> async<allocator> function()
<andrewrk> and it returns error!promise, that is, it can either return error.OutOfMemory or the coroutine handle
<andrewrk> and then the caller must ensure that the handle is either canceled or awaited
<faa5e> Hi Andrew, I was just watching your presentation and heard you answer the questions about recursive functions and running out of heap.
<faa5e> I have worked on a recursive decent parser that sometimes ran out of heap and rewrote it to one using the heap with some C++ classes.
<andrewrk> neat! I'm working on the same thing with the self-hosted parser
<andrewrk> the c++ parser is recursive descent but the self hosted one is a state machine
<faa5e> (It also used goto statements for continueing after returning from a call.)
<faa5e> The parser can be found at http://www.iwriteiam.nl/MM.html
<faa5e> It sound very interesting with what you are doing with zig. I am going to have look into it.
<andrewrk> faa5e, welcome to the community
<andrewrk> what are you potentially working on in zig?
faa5e has quit [Quit: Page closed]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hoppetosse> andrewrk: what's tiehuis' handle on irc?
<hoppetosse> I've been working on his zligc project
<andrewrk> it's tiehuis
<andrewrk> he's around every few days
<isd> So I'm toying with getting some bare metal bringup code working with zig on x86_64, and am struggling with a linker error.
<hoppetosse> I wasn't sure if I'd seen that here or only on github
<andrewrk> isd, I can help
<isd> ls
<isd> (oops, reflexes)
<isd> Not sure how to get the linker to see the symbol defined in main.zig.
<andrewrk> isd, ah I think I know what's going on
<andrewrk> are you trying to make an OS?
<isd> Yeah, that's the notion
<isd> (this is a simplification from the original code)
<andrewrk> isd, oh! you just need to export zig_main
<andrewrk> export fn zig_main instead of pub fn zig_main
<isd> Aha. I thought it might be something like that, but couldn't find docs about how it worked
davr0s has joined #zig
<andrewrk> another tip: zig supports module level assembly if you want that
<andrewrk> you could also use a naked function for the entry point
<isd> what do you mean by naked function?
<andrewrk> it's equivalent to an assembly label
<isd> Aha, that would simplify the build.zig a bit. Nice.
<andrewrk> be warned: there are some missing compile errors for naked functions. the only thing it's safe to do is inline assembly and function calls
<andrewrk> if you make stack variables it'll segfault (since naked functions don't increment the stack pointer)
<andrewrk> you can also do
<andrewrk> ^ module level assembly example
Hejsil has joined #zig
Hejsil has quit [Ping timeout: 260 seconds]
itsMontoya has joined #zig
<itsMontoya> Hi guys
<itsMontoya> Hey question, is there a way to handle errors without try?
<andrewrk> hi itsMontoya
<andrewrk> there is also `catch`
<andrewrk> catch |err| expression
<andrewrk> where expression can return a type that is the same as the type of the LHS of the catch ("default") or a `noreturn` type (such as calling @panic)
<andrewrk> sorry let me give a better syntax example: foo() catch |e| expression
<andrewrk> and then the most powerful one is `if`
<andrewrk> if (foo()) |value| then_expression else |err| else_expression
<hoppetosse> andrewrk: I hadn't seen the latest youtube video
<hoppetosse> awesome!
<halosghost> andrewrk: and blocks are expressions?
<andrewrk> correct
<halosghost> cool
<andrewrk> in order to return an expression from a block you must label the block and then use `break :label value`
<halosghost> hmm, interesting
<andrewrk> there's a proposal to add a `result` keyword for returning a value from a block: https://github.com/zig-lang/zig/issues/732
<halosghost> I wonder if that's a reasonable time to lift a syntax choice from rust
<halosghost> rather than adding a new keyword
<andrewrk> halosghost, are you referring to the "leave a semicolon off" to have a block return the expression?
<halosghost> in rust, iirc, if the last line of a block doesn't have a semi-colon, its value becomes the returned value of the block
<halosghost> yeah
<halosghost> thoughts?
<andrewrk> zig used to have that, and removed it to have more consistent syntax
<Sahnvour> I like how zig allows idioms (or plans to) that we struggle to emulate in C++ even with modern standards :)
<andrewrk> Sahnvour, which one are you referring to?
<Sahnvour> wrt the issue 629, this is something we're doing with "immediately invoked lambda expressions" for example
<Sahnvour> which is already wuite convenient but do not feel like a native feature of the language
Ichorio has quit [Ping timeout: 240 seconds]
<halosghost> andrewrk: fernuff
<andrewrk> ah yes
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<isd> Is there any documentation re: what syntax zig accepts for inline assembly? I'm trying to reproduce stuff I've gotten working in both C and Rust and struggling to satisfy the compiler
<andrewrk> isd, ah I'm sorry this is a poorly documented, error prone situation right now. The best we have are examples.
<andrewrk> look for the asm keyword in https://github.com/AndreaOrru/zen/ and zig standard library
<andrewrk> it's a subset of gcc/clang's inline assembly syntax. the constraint syntax is documented by LLVM: http://llvm.org/docs/LangRef.html#inline-assembler-expressions
<andrewrk> improvements planned: https://github.com/zig-lang/zig/issues/215
davr0s has joined #zig
halosghost has quit [Quit: WeeChat 2.1]
<hoppetosse> "We will have a zigfmt. It will have no configuration options"
<hoppetosse> =)
Sahnvour has quit [Ping timeout: 260 seconds]
<isd> Thought: I think it might make for mor readable code if @IntType took a custom enum (Signed or Unsigned) instead of a bool as it's first argument.
Sahnvour has joined #zig
<itsMontoya> I'm getting -- Could NOT find LLVM (missing: LLVM_INCLUDE_DIRS)
<itsMontoya> I git pulled
<itsMontoya> and was trying to build the updated repo
<andrewrk> isd, there are 2 issues related to this: https://github.com/zig-lang/zig/issues/745 and https://github.com/zig-lang/zig/issues/383
<andrewrk> also I agree with you, and related to your suggestion is https://github.com/zig-lang/zig/issues/683
<andrewrk> itsMontoya, did you pull from a much older version that depended on LLVM 5?
<andrewrk> what os/distro are you on?
<itsMontoya> arch
<itsMontoya> Let me see what my current version is
<itsMontoya> one moment
<itsMontoya> Hmm this is weird, I could have sworn I had it installed
<itsMontoya> but I don't see it
<itsMontoya> My Clang is 6.0 I believe
<itsMontoya> clang version 6.0.0 (tags/RELEASE_600/final)
<andrewrk> thats good and you also need llvm 6.0.0
<andrewrk> maybe there is a dev package
<andrewrk> with the .h files
<itsMontoya> Ok cool, it works now
<itsMontoya> I could have sworn at one point llvm and clang were paired for AUR
<itsMontoya> Maybe I just never installed it on my most recent dev build
<itsMontoya> If I get comfortable enough with zig, it would be fun to port whiskey to zig
<itsMontoya> And see how fast it is
<itsMontoya> Made it further, make failed with "make[2]: *** No rule to make target '/usr/lib/libclangFrontend.a', needed by 'zig'. Stop."
<itsMontoya> I'll try to google it
cenomla has joined #zig
benaiah has joined #zig
CurtisF has joined #zig
isd has quit [Quit: Leaving.]
Sahnvour has quit [Quit: Page closed]
hoppetosse has quit [Ping timeout: 268 seconds]
noonien has quit [Quit: Connection closed for inactivity]
<andrewrk> itsMontoya, ah neat. I'm looking at whiskey