ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
relatingdata has joined #zig
<relatingdata> Hi
<relatingdata> been playing with Zig for a couple of weeks and had a bit of time to look at some of the documentation over Easter :-
<relatingdata> :-) ;-)
<relatingdata> a few questions come to mind: is there any notion of C++ type operator overloading functions envisioned for Zig?
<relatingdata> having worked in many different languages in the past 40 odd years having a definite language indentation style is a definite advantage the one i have been favoring ober the last couple of years is https://en.wikipedia.org/wiki/Indentation_style#Lisp_style
<relatingdata> seems to work for me for C python and javascript :-
<relatingdata> :-)
<MajorLag> operator overloading: short answer is no. Longer answer at end of this issue https://github.com/zig-lang/zig/issues/871.
<MajorLag> As I understand it, there will be a zigfmt, but the compiler won't enforce an indentation style except in cases where it might cause confusion, like a bracketless if with two indented statements under it.
<relatingdata> ok understood
<relatingdata> the reason I was asking is that I deal a lot with vectors/matrices/tensors and also complex number both in f32 and f64 a lot of wich can be off loaded onto GPU in various ways Julia does this nicely in some ways but I am still looking for a way of doing this in a low level language
<relatingdata> Typescript type generics?
<MajorLag> There are generics, they work using the comptime functionality: https://ziglang.org/documentation/master/#Generic-Data-Structures
<MajorLag> I'm not familiar with typescript, anything special about their generics?
<relatingdata> No, must do more reading and much more coding to get familiar with the set of features of Zig :-)
relatingdata has quit [Ping timeout: 260 seconds]
relatingdata has joined #zig
return0e_ has joined #zig
<andrewrk> MajorLag, I have the static linux build working. I just need to integrate it with travis ci now
<relatingdata> how close is zig to generating web assembly from the llvm code?
<andrewrk> relatingdata, I believe it works now, but LLVM has webassembly as an experimental target (not included by default)
<andrewrk> I expect it to become default in llvm 7
<andrewrk> about 6 months from now
<relatingdata> so should I try to create something like https://webassembly.studio/ for zig ?
<andrewrk> sounds like a fun project
relatingdata has quit [Quit: Page closed]
return0e_ has quit []
tiehuis has joined #zig
<tiehuis> relatingdata: if you were interested in wasm compilation see here: https://gist.github.com/jfo/5c3c051a4090e604f8325e3fb4811d61
<tiehuis> you don't to patch the compiler anymore either, so the only main requirement now is to have LLVM compiled with WebAssembly support
<tiehuis> the static docker build has this enabled so that should actually work right now
<tiehuis> i'd also modified parcel to recognize zig files and get automatic conversion from js here: https://github.com/tiehuis/parcel/commit/19b211be190bf92c7891c372e4b5d300a2f433d0
<tiehuis> that was a WIP though and hadn't got the tests passing on that yet
tiehuis has quit [Quit: WeeChat 2.1]
kvuser7 has joined #zig
<kvuser7> Hi all, anyone have any ideas why one of my test passes, and the other fails, in this code? - https://pastebin.com/GcqRbqY5
<kvuser7> var buf_stream = io.BufferedInStream(io.FileInStream.Error).init(&file_in_stream.stream);const st = &buf_stream.stream;
<kvuser7> I see code like this in std/io_test.zig, where the stream is init'd in one line, then a reference to a member is done on another line, but if you do it all in one line "BufferedInStream(...).init(...).stream" it causes strange behavior
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hejsil has joined #zig
<Hejsil> kvuser7, this: https://github.com/zig-lang/zig/issues/591: Basicly, right now if you copy the interface field (aka `stream`) bad stuff happens
hoppetosse has joined #zig
davr0s has joined #zig
Braedon has joined #zig
<Braedon> mem.alloc() is used to assign ptrs right? That is pointers on the heap that aren't based off the stack?
Braedon has quit [Quit: Page closed]
Braedon has joined #zig
<Hejsil> Braedon, Simple answer: std.heap.c_allocator.alloc() and std.heap.c_allocator.create()
<Hejsil> Complicated answer. You should probably look into allocators and why they are useful
<Braedon> Ahh yeh that's what I was looking for
<Braedon> Yeh I was using a self made allocator
<Braedon> In my own code, and wanted to know if there was a std one
<Hejsil> std.heap.c_allocator is an allocator wrapping malloc/free from C's standard lib. Zig doesn't have a general purpose allocator yet
<Braedon> I think it should eventually have one, but yeh I had mine just wrapping around C's
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Braedon> Alignment in the call has to be passed in right? Probably best as @alignof(T)
davr0s has joined #zig
davr0s has quit [Client Quit]
Braedon has quit [Quit: Page closed]
Braedon has joined #zig
<Hejsil> Alignment of allocated memory?
davr0s has joined #zig
davr0s has quit [Client Quit]
<Braedon> The alignment field in the call type of u29.
<Braedon> *parameter not filed
<Braedon> *field
<Braedon> `fn cAlloc(self: &Allocator, n: usize, alignment: u29) ![]u8` is the type declaration
<MajorLag> The allocator implementation takes it that way, but the allocator interface takes a type and passes @alignOf(T) for you: `fn alloc(self: &Allocator, comptime T: type, n: usize) ![]T { return self.alignedAlloc(T, @alignOf(T), n); }`
<Braedon> Ahhh nice
man213 has joined #zig
<Braedon> I'm looking towards helping MacOS/Linux Dev with the compiler (got quite a bit of compiler building experience under my belt, though mainly toy languages).
<Braedon> Is there a todo list for each target? Like how there are milestones?
<MajorLag> andrewrk: Having that artifact avaialbe just like the windows one will be so slick.
Braedon has quit [Quit: Page closed]
Braedon has joined #zig
cenomla has quit [Quit: cenomla]
thejoshwolfe has quit [Quit: Leaving]
sandwit has joined #zig
Braedon has quit [Ping timeout: 260 seconds]
Hejsil has quit [Quit: Page closed]
hoppetosse has quit [Ping timeout: 256 seconds]
hoppetosse has joined #zig
kammd[m] has joined #zig
steveno_ has joined #zig
<kammd[m]> Hey guys is there any plan for hpux target??
<andrewrk> kammd[m], that is entirely decided by llvm
<andrewrk> oh that's an OS, not an architecture isn't it?
<andrewrk> you can write freestanding code for hpux today
<andrewrk> so the question is, is there a plan to flesh out the standard library for hpux
<kammd[m]> andrewrk: yeah arch is ia64
<andrewrk> you can also use libc on hpux now
<kammd[m]> andrewrk: hmm is there is any documentation on how I can try it out? just a pointer would be great..
<andrewrk> is ia64 the same thing as x86_64?
Hejsil has joined #zig
<kammd[m]> andrewrk: sadly nope.. Itanium
_whitelogger has joined #zig
Aequus has joined #zig
zolk3ri has joined #zig
<sandwit> I don't know how to express this without coming across as caring too much about frivolous things, but I feel like "const Name = struct" is valuing consistency too far above pragmatism? Pretty much everyone else does "struct Name {}" and that even leads to less noise on the screen imo.
<sandwit> though if struct is thought of as a type of sorts, then of course having the name on the left side does fit better
man213 has quit [Ping timeout: 260 seconds]
<andrewrk> another reason to support that would be for interdependent structs inside a function definition
<andrewrk> we could read the struct definitions out of order. whereas with const decls in a fn we have to do it in order
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
<MajorLag> for now, i'm still hoping for fn to go the struct route: const name =fn(...) ... {...}; Then I don't need to wrap inner functions in a struct.
<GitHub188> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxX3L
<GitHub188> zig/master aadc14f Andrew Kelley: upload static linux artifacts on successful travis build
<andrewrk> MajorLag, ^ this works. I'm hoping that travis CI will display the URL to the uploaded artifact
* hobomatic vibrates with anticipation
<Hejsil> MajorLag, one day, hopefully :)
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
davr0s has joined #zig
Ichorio has joined #zig
sandwit has left #zig ["Leaving"]
sandwit has joined #zig
davr0s has quit [Ping timeout: 248 seconds]
raytracer[m] has joined #zig
<GitHub183> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxXCI
<GitHub183> zig/master 65e4bb1 Andrew Kelley: travis artifacts: don't upload extra stuff
<andrewrk> MajorLag, argh. I think I have to implement something more complicated, because travis does not list the uploaded artifacts visibly. you'd have to click "download raw log" and then scroll to the bottom
cenomla has joined #zig
<MajorLag> apparenty it can be automatically pushed to github releases, but you need to jump through hoops with an api key
<GitHub106> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxXRA
<GitHub106> zig/master 21b47b3 Andrew Kelley: travis: don't upload build/ folder as artifacts
zolk3ri has quit [Ping timeout: 264 seconds]
cenomla has quit [Quit: cenomla]
zolk3ri has joined #zig
ofelas has quit [Quit: shutdown -h now]
hoppetosse has quit [Ping timeout: 264 seconds]
Hejsil has quit [Ping timeout: 260 seconds]
<andrewrk> MajorLag, I don't want to create a git tag for every commit
<MajorLag> can it be as simple as just having the build process push it over sftp or something?
<GitHub192> zig/master d1f8e72 Andrew Kelley: travis: don't upload other files as artifacts
<GitHub192> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxXo6
<andrewrk> MajorLag, https://clbin.com/pYdlf
<andrewrk> it's just a matter of exposing the URL to the most recent file
steveno_ has quit [Remote host closed the connection]
ofelas has joined #zig
MajorLag2 has joined #zig
MajorLag has quit [*.net *.split]
occivink has quit [*.net *.split]
occivink has joined #zig
MajorLag2 is now known as MajorLag
sandwit has left #zig ["Leaving"]
cenomla has joined #zig
cenomla has quit [Quit: cenomla]
cenomla has joined #zig
isd has joined #zig
<walac> hi there, was trying to build github.com/tiehuis/zligc, but it feels like there is a conflict between the builting https://irccloud.mozilla.com/pastebin/6ZUrSJ5y/
<walac> * conflict between builtin and zlibc symbols
<andrewrk> walac, are you using the build script?
<andrewrk> it looks like the build script only does addObject which would not produce builtin.o which is the conflicting object
<walac> andrewrk: nope, I implemented memcpy and a simple test, then ran ~/work/zig/build/zig test string.zig
<andrewrk> I see
<andrewrk> walac, I suggest following compiler_rt's pattern from zig: https://github.com/zig-lang/zig/blob/master/std/special/compiler_rt/index.zig#L5
<andrewrk> essentially, set the linkage to internal on all the exported functions when testing. This way the symbol does not conflict with another object file
<walac> andrewrk: thanks :)
jorge_ has joined #zig
jorge_ is now known as Guest59710
Guest59710 has quit [Client Quit]
brannock has joined #zig
<brannock> Would this kind of iterative development work on windows if I'm using Microsoft C compiler? http://tiehuis.github.io/iterative-replacement-of-c-with-zig
<andrewrk> brannock, in theory yes. there might be a bug or two currently
<andrewrk> or a missing feature such as https://github.com/zig-lang/zig/issues/538
hoppetosse has joined #zig
isd has quit [Ping timeout: 256 seconds]
<GitHub22> [zig] andrewrk pushed 1 new commit to master: https://git.io/vx1U8
<GitHub22> zig/master 9dfd1a7 Andrew Kelley: remove more signal handling stuff from std.os.ChildProcess...
isd has joined #zig
hoppetosse has quit [Ping timeout: 255 seconds]
isd has quit [Quit: Leaving.]
Braedon has joined #zig
<Braedon> How do you convert array literals to their generic array format? Like pass in "true" as []u8 rather than [4]u8?
<Braedon> A ptr cast?
<Braedon> More info: While I know I can probably create a c""/normal literal then do a memcpy to get it into proper array format (and do it at comptime so its not 'effecting runtime') I feel there must be a better way
Ichorio has quit [Ping timeout: 260 seconds]
<Braedon> No worries, I just realised I can implicitly cast to '[]const u8' duh
steveno_ has joined #zig
<andrewrk> Braedon, you can slice arrays with array[a..b] syntax
<andrewrk> if you slice a mutable array you get a mutable slice
<Braedon> It isn't a mutable array though