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 :-
<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
<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…]
<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.
<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
<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
<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