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>
(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);`
<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?
<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