ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
porky11 has quit [Quit: Leaving]
jmiven has quit [Quit: co'o]
jmiven has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<daurnimator> MajorLag: perhaps a union?
<daurnimator> nbjoerg: "the cfe experience"?
<nbjoerg> c/c++ frontend
<nbjoerg> aka clang
davr0s has joined #zig
suirad has joined #zig
<suirad> whats the most straightforward way to interact with c++ code from zig? Create a c wrapper for it?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<MajorLag> probably
<daurnimator> I forget the result from the discussion the other day: can you process the result of @embedFile at compile time?
<MajorLag> yes, with the standard comptime caveats.
<daurnimator> MajorLag: cool. confirmed :) https://ptpb.pw/kTnV
<MajorLag> I don't think your sample code is ensuring the file is processed at comptime, though I would expect it to be in release-fast.
<daurnimator> MajorLag: https://ptpb.pw/eKTr then?
<daurnimator> (added comptime to return of compileTimeParseFile)
<daurnimator> huh. maybe that doesn't work.... @compileLog(compileTimeParseFile("sample-file")); prints "runtime value"
<MajorLag> I wasn't even aware of that syntax. I'd have done `const pared_file_data = comptime compileTimeParseFile("sample-file"); std.debug.warn("FILE={}\n", parsed_file_data);`
<daurnimator> well this certainly is odd. https://ptpb.pw/m5Gu
<MajorLag> what's odd about it? there's no output in the paste
<daurnimator> MajorLag: compiling it prints `| (runtime value)`. Running it returns the correct thing.
<daurnimator> either the comptime block is happening at runtime; or @compileLog is printing the wrong thing
<MajorLag> well yeah, but running it may just mean it is processing it at runtime.
<daurnimator> MajorLag: shouldn't the `comptime` block make that not-possible?
<MajorLag> yes. I'm not sure why compilelog would think it is runtime, but it probably isn't. You could check the binary, see if the contents of sample-file appear in it.
<daurnimator> it does not.
<daurnimator> I guess I'll file a zig bug
<MajorLag> I don't think it is a bug, it's just that comptime vs runtime is not always easy to determine with how it currently works. At least I don't think so. But if you file a bug andrew should at least explain why it's doing what it is doing.
<MajorLag> I think what is happening is that x is a runtime value, populated by a function that just returns 111. What does compileLog say if you do it my way?
<daurnimator> MajorLag: ah. that works :)
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
<oats> what's the 'use' keyword do?
<MajorLag> adds everything in a namespace into the current one. Mostly useful for @cImports.
suirad_ has joined #zig
suirad has quit [Ping timeout: 256 seconds]
fsateler has quit [Quit: ZNC 1.7.1+deb2 - https://znc.in]
fsateler has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
<daurnimator> oh man. I just realised that zig treads a damn near perfect ground for implementing "declarative" data format specs. WebIDL, ASN1, WSDL..... could all be handled *really* well in zig
<daurnimator> (uh, a more modern example: protobufs)
<daurnimator> The other day I asked about using libraries at compile time (the example at the time was libpng). Did we get any conclusion on that?
<benjikun> is protobufs just like msgpack?
<daurnimator> benjikun: in what way?
<benjikun> just wondering, don't know what it is
<benjikun> is it readable or binary
<daurnimator> benjikun: it's a serialisation format that comes with a syntax for specifying its structs. see e.g. https://developers.google.com/protocol-buffers/docs/proto#simple
<benjikun> oh I see
<daurnimator> benjikun: ^^ that goes in a '.proto' file
<daurnimator> then each programming language has some sort of "generate a class from a .proto file" function
<benjikun> interesting
<daurnimator> statically compiled languages generally have a utility that generates source
<benjikun> have you used nim?
<daurnimator> dynamic language generally end up writing a .proto file parser that they use at runtime
<daurnimator> benjikun: not really. I did a tutorial or so but that's it
<benjikun> ah
fsateler has quit [Quit: ZNC 1.7.1+deb2 - https://znc.in]
fsateler has joined #zig
Zaab1t has joined #zig
c15ade4 has quit [Quit: WeeChat 2.0]
Zaab1t has quit [Ping timeout: 246 seconds]
<d_s> daurnimator: to generate code for protocol you specified in .proto file, you use protoc
<d_s> so each programming language doesn't parse .proto and gen code
<daurnimator> d_s: many do.
<d_s> so they do it wrong, there is no benefit to write own parser
<daurnimator> d_s: sure there is: being able to take .proto files at runtime
<d_s> protoc generates source code in target language that understand described protocol in .proto
<d_s> dynamic protocol?
<d_s> someone drink to much when impl. this idea of dynamic protocol
<d_s> show me such example
<daurnimator> d_s: e.g. I've done it using https://github.com/Neopallium/lua-pb
<d_s> the protocol desciption itself
<daurnimator> yes. it was for a work project where the .proto was provided at runtime
<d_s> such protocol which require making .proto ad-hoc
<daurnimator> yes
<d_s> show me desciption of such protocol
<daurnimator> d_s: we used it at $WORK to translate protobufs to json. it had to allow the user to upload a .proto file at runtime and not need a recompile/redeploy.
<d_s> oh, it must be so much fun to use product which chagnes protocol so frequently
<d_s> probably even without backward compatibility
<benjikun> toxic
<benjikun> daurnimator: Have you used terra before?
<benjikun> seems like something you'd give a go
allan0 has joined #zig
Zaab1t has joined #zig
Zaab1t has quit [Ping timeout: 264 seconds]
Zaab1t has joined #zig
porky11 has joined #zig
Zaab1t has quit [Ping timeout: 252 seconds]
porky11 has quit [Ping timeout: 250 seconds]
porky11 has joined #zig
Zaab1t has joined #zig
porky11 has quit [Read error: No route to host]
<daurnimator> benjikun: yeah... it's not really like what it seems
<daurnimator> benjikun: titan/pallene are what I *thought* terra was
Zaab1t has quit [Ping timeout: 264 seconds]
porky11 has joined #zig
Zaab1t has joined #zig
shollrollah951 has joined #zig
Zaab1t has quit [Ping timeout: 268 seconds]
davr0s has joined #zig
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…]
lqd has quit [Read error: Connection reset by peer]
lqd has joined #zig
davr0s has joined #zig
Zaab1t has joined #zig
porky11 has quit [Ping timeout: 250 seconds]
<MajorLag> @daurnimator: you can't call external libraries at comptime, nor is this a feature that's likely to be implemented.
<nbjoerg> it would be useful to have a builtin predicate for that?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
steveno has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
porky11 has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
qazo has quit [Ping timeout: 240 seconds]
Zaab1t has quit [Quit: bye bye friends]
Sahnvour has joined #zig
davr0s has joined #zig
<Sahnvour> hi andrewrk, this code `asm volatile ("" : : [_]"m"(i15(-3)) : "");` asserts in LLVM during codegen because i15 is not a "SimpleValueType". Should we forbid types that are not native with a compiler error + TODO ?
<andrewrk> Sahnvour, perhaps we can call gen_widen_or_shorten before passing the value to llvm
<andrewrk> this will emit a zext or sext instruction as appropriate, which should be semantically correct and have no downsides
<andrewrk> so you would figure out the power-of-two ZigType * to pass as an argument to that function
<andrewrk> does that make sense?
<Sahnvour> yep
<Sahnvour> I was wondering if that's OK to choose the type from codegen->builtin_types
<andrewrk> yes those types are handy aliases for the common primitive types
<andrewrk> all guaranteed to be populated at startup
<Sahnvour> we can safely assume all native types are power of two in size ? no exotic architectures ?
<andrewrk> Sahnvour, we can safely assume that "SimpleValueType" means "integer, pointer, or floating-point type whose bit width is a power of two greater than or equal to eight and less than or equal to a target-specific size limit."
<Sahnvour> thanks
<andrewrk> Sahnvour, also in case you didn't know we have get_int_type which accepts a bit width parameter
<andrewrk> this will return the same pointers as the types in codegen->builtin_types, when appropriate, or create new integer types if that size was never used before
<Sahnvour> cool
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
porky11 has quit [Ping timeout: 276 seconds]
qazo has joined #zig
Zaab1t has joined #zig
qazo has quit [Ping timeout: 244 seconds]
davr0s has joined #zig
porky11 has joined #zig
steveno_ has joined #zig
steveno has quit [Ping timeout: 250 seconds]
steveno_ has quit [Ping timeout: 268 seconds]
wootehfoot has joined #zig
<Sahnvour> how can I test compile_errors.zig alone (not running the full test suite) ?
<andrewrk> make install && bin/zig build --build-file ../build.zig test-compile-errors -Dskip-release
<andrewrk> for more options see: bin/zig build --build-file ../build.zig --help
<Sahnvour> thanks
hoppetosse has joined #zig
hoppetosse has quit [Ping timeout: 245 seconds]
steveno_ has joined #zig
Zaab1t has quit [Quit: bye bye friends]
wink_ has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
steveno_ has quit [Remote host closed the connection]
Thalheim has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
jjido has joined #zig
fsateler_ has joined #zig
davr0s has quit [Ping timeout: 268 seconds]
fsateler has quit [Ping timeout: 268 seconds]
MajorLag has quit [Ping timeout: 268 seconds]
mht has quit [Ping timeout: 268 seconds]
Sahnvour has quit [Remote host closed the connection]
jjido has quit [Remote host closed the connection]
porky11 has quit [Ping timeout: 250 seconds]
qazo has joined #zig
wootehfoot has quit [Quit: Leaving]
qazo has quit [Ping timeout: 264 seconds]
qazo has joined #zig
qazo has quit [Ping timeout: 264 seconds]
<benjikun> I wish there were more articles on zig; these wikipedia moderators want more before the zig page can be published
<andrewrk> benjikun, the articles listed under Reading and Viewing Material is not enough?
<andrewrk> that's 3 different authors
<andrewrk> I can find more
<benjikun> You can see the ones I've found in the references section
<benjikun> sdtimes, infoworld, and jaxenter
<benjikun> I'm not sure if the jaxenter one qualifies, but I added it still
<benjikun> If you see anything wrong on that page and or want to add anything, I'd appreciate it btw
<andrewrk> benjikun, I'm compiling a list of more links with little snippets that you can use if you want
<benjikun> thank you
shollrollah951 has quit [Quit: Leaving]
<benjikun> I wonder how many github repos use zig now
<andrewrk> benjikun, about 160
<benjikun> yeah I saw that before I think
<benjikun> it'd be nice to have the highlighting already
MajorLag has joined #zig
<benjikun> the wikipedia syntax highlighting stuff uses pygments
<benjikun> I'm not sure about how open they'd be to add zig
<andrewrk> sr.ht also uses pygments. I looked at the project page and they seem friendly and willing to add lots of languages
<andrewrk> "Well, why not write your own? Contributing to Pygments is easy and fun. Take a look at the docs on lexer development and contact details."
<benjikun> hmm
<andrewrk> benjikun, almost done with the list
<benjikun> mk