ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
steveno_ has quit [Quit: Leaving]
Ichorio has quit [Ping timeout: 260 seconds]
<achambe>
andrewrk: do you have an idea of what you want to base a package manager on?
<achambe>
looking at buildbot at the moment for the less conventional platforms. Python support seems to be a common denominator.
<achambe>
oh, the travis build servers are actually pretty beefy.
cenomla has joined #zig
cenomla has quit [Quit: cenomla]
<GitHub65>
[zig] tgschultz opened pull request #939: DirectAllocator alignments > os.page_size on posix (master...large-alignment-directalloc) https://git.io/vpYj0
<alexnask>
@andrewrk Is there any way to inline varargs into a function call?
<alexnask>
Here is my usecase (this is a call function for DirectSound COM objects)
<alexnask>
Otherwise I'll probably switch on the args.len and repeat the call with multiple versions using indexing on the varargs
davr0s has joined #zig
heakins has quit [Ping timeout: 260 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<achambe>
neat, the compiler builds on openbsd
davr0s has joined #zig
alexnask has quit [Ping timeout: 255 seconds]
qazo has quit [Read error: Connection reset by peer]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<achambe>
andrewrk: trying to work out how to do another build profile for openbsd
<achambe>
since its nested inside linux on travis haha
<achambe>
painfully slow in qemu, but I generate an image that can be used for CI either in a VM, or launched on something like amazon/google cloud. And have a script that also runs the build under qemu
<GitHub58>
[zig] andrewchambers opened pull request #941: Openbsd ci (master...openbsd_ci) https://git.io/vpOLf
<achambe>
yup, it times out haha
<achambe>
andrewrk: I sent you an email, but I think I was mistaken in it
ofelas has quit [Quit: shutdown -h now]
davr0s has joined #zig
<alexnask>
2296 bytes for a fullscreen window + DirectSound initialization, things are getting pretty tight already :P
<alexnask>
@andrewrk The symbols produced through .def files have an underscore prefixed and for each one of them a jmp to the actual function is generated
<alexnask>
Actually, I'm pretty stupid, I guess this is expected with DLLs
Braedon has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Ichorio has joined #zig
<alexnask>
Are there any thoguhts on standarizing an Iterator interface type?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<alexnask>
Ir emoves the need for an interface implementation to include a vtable field
<alexnask>
Instead, the interface type holds a reference to the object (this is interface-dependant, you could store the object inline or have some small buffer optimization + heap allocation)
<alexnask>
+ a pointer to the vtable which is automatically generated for each object type passed in
<alexnask>
In this example, any type that has a 'fn next(&Self) ?T' method can be passed in to Iterator.init and have its vtable automatically generated at comptime.
<alexnask>
While the 'fn reset(&Self) void' function is optional
<alexnask>
method*
jjido has joined #zig
<alexnask>
This is a great way to separate the implementation type from the interface/vtable type, all the user has to do is write an implementation with the functions the interface require and then pass it in to the interface's init method
<alexnask>
(Also, the reverse, you can write an interface and have it accept types defined in other libraries, etc...)
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…]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Braedon has quit [Ping timeout: 260 seconds]
lorde_kumamon[m] has quit [*.net *.split]
dtz has quit [*.net *.split]
raytracer[m] has quit [*.net *.split]
davr0s has joined #zig
<andrewrk>
hi achambe
raytracer[m] has joined #zig
dtz has joined #zig
lorde_kumamon[m] has joined #zig
clebermatheus[m] has quit [Ping timeout: 240 seconds]
lorde_kumamon[m] has quit [Ping timeout: 256 seconds]
dtz has quit [Ping timeout: 256 seconds]
kammd[m] has quit [Ping timeout: 245 seconds]
raytracer[m] has quit [Ping timeout: 256 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
jjido has joined #zig
<MajorLag>
andrewrk: alignment > page size came up for me recently because I'm writing an allocator and stealing a concept from rpmalloc: if you align your span headers to i.e. a 64kb boundary then you can find them from any slice passed to free with a single instrution.
<andrewrk>
neat
<andrewrk>
I'm about to merge your time PR. just playing around with aux vectors and seeing if I can get the vdso hooked up
<MajorLag>
there's one more small thing I should do on that: change the Windows error checking to check for windows.FALSE instead of 0, just for clarity.
<andrewrk>
I've merged your changes in a branch, can you show me the diff and I'll apply it locally?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk>
random thought: std.debug.warn can be made simultaneously thread-safe and better performance by using writev
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
jjido has quit [Client Quit]
SimonNa has joined #zig
kammd[m] has joined #zig
lorde_kumamon[m] has joined #zig
dtz has joined #zig
clebermatheus[m] has joined #zig
raytracer[m] has joined #zig
davr0s has joined #zig
minxomat has joined #zig
minxomat has quit [Client Quit]
<alexnask>
Can I cast a slice from a type to another?
<alexnask>
Or should I initialize a new slice and set .ptr and .len correctly?
hryx has joined #zig
<achambe>
andrewrk: yeah, the qemu approach with ccache on travis sort of works haha. the bonus with how it is setup is that doing linux arm is probably really similar
<andrewrk>
achambe, awesome
<achambe>
the time limits on travis are the biggest risk, as it is currently it needs a few failed builds to warm that ccache cache
<andrewrk>
I think your build bot idea is going to be the realistic answer here
<achambe>
yeah
<andrewrk>
another nice thing about this is that I can use your script to do OpenBSD development in qemu
<achambe>
yeah, i know its not so easy for people who haven't installed it before.
<achambe>
I have automated a freebsd install in the past too, but lost the code unfortunately
<achambe>
i don't think it is urgent to merge or use it yet. but its a good reference for the future
<andrewrk>
achambe, yeah, even if we close it for tidyness, we can link to it from the open issue for openbsd support
<achambe>
openbsd is also slow changing enough i think the script will be valid in 1
<achambe>
year or more
<hryx>
Hello! Silly question: I'm having trouble initializing a two-dimensional array with the ** syntax. Is it possible to do so?
<andrewrk>
hi hryx
<hryx>
There are good examples of 1d arrays in the docs, but I didn't find much for 2d arrays
<GitHub27>
zig/master 371a3ad Andrew Kelley: Merge branch 'tgschultz-std.os.time'
<GitHub27>
zig/master 7af6ed3 Andrew Kelley: add alignment docs
qazo_ has joined #zig
qazo has quit [Ping timeout: 260 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<MajorLag>
Oh I see, you do the vDSO lookup in the bootstrap, that makes snese.
qazo has joined #zig
qazo_ has quit [Ping timeout: 248 seconds]
<andrewrk>
MajorLag, not quite - we copy the aux vectors in the bootstrap which gives us the VDSO address, but then we do the lookup in the first clock_gettime call
<GitHub159>
[zig] BraedonWooding opened pull request #944: Just a few std.mem changes (master...MemChanges) https://git.io/vpO1u
<hryx>
Must all struct methods have a `self` parameter? The Vec3 example in the docs has a `pub fn init()` which doesn't. Is `init` a specially-recognized method name?
<MajorLag>
no, init doesn't take a self parameter because it doesn't act on an existing struct instance, so it doesn't need one.
<MajorLag>
these aren't really 'methods', they're just regular functions in the struct's namespace.
<hryx>
Can any function inside a struct's namespace be defined either way, then (init isn't special)?
<hryx>
i.e., if I supply a `self`, it's a method, and if I don't, it's not?
<MajorLag>
there are no methods. As a convenience, you can call "instance.function()" and the instance will be passed as the first parameter implicitly, but otherwise they're all just regular functions
<hryx>
I see. I think what I was missing is that the example calls `Vec3.init(...)`, where Vec3 is the type name, not an instance of Vec3
<hryx>
Great, thanks MajorLag. I actually like the way it works, just got thrown off because the distinction between SomeType.func() and some_instance.func() wasn't too clear in the docs