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 joined #zig
steveno has quit [Ping timeout: 240 seconds]
steveno has joined #zig
steveno has quit [Remote host closed the connection]
Marumoto has quit [Ping timeout: 246 seconds]
darithorn has joined #zig
darithorn has quit [Quit: Leaving]
<diltsman> For the compiler_rt functions, are there any processor specific ones that have been done?
kristate has joined #zig
<emekankurumeh[m]> that last commit has got me excited
jevinski_ has quit [Read error: Connection reset by peer]
jevinskie has joined #zig
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 245 seconds]
schme245 has joined #zig
<schme245> I'm curious as to why there is no increment or decrement operators in Zig (++ and --)
<schme245> I'm sure this has been asked a million times but I couldn't find anything about it in the GitHub issues
<kristate> schme245: it's a flaw of C and is prone to undefined behavior
<schme245> flawed in what way? is it more prone to undefined behavior than `x += 1`?
<kristate> "it is not clear in what sequence the subtraction and increment operations should be performed. Such expressions generally invoke undefined behavior, and should be avoided."
<schme245> hah, I'd never thought to write something like `x - ++x` :D
<schme245> that clears thing up, thanks!
eagle2com has joined #zig
<kristate> schme245: cool
<kristate> you are very welcome
steveno has joined #zig
halosghost has joined #zig
<schme245> are there intrinsics for stuff like AES-NI instructions or is inline assembly the way to go?
Avila has joined #zig
steveno_ has joined #zig
steveno has quit [Ping timeout: 264 seconds]
Zaab1t has joined #zig
darithorn has joined #zig
MajorLag has quit [Ping timeout: 240 seconds]
steveno_ has quit [Ping timeout: 250 seconds]
MajorLag has joined #zig
Ichorio has joined #zig
schme245 has quit [Remote host closed the connection]
<donpdonp> scientes: the reasoning ive seen before against x++ is that its not a pure expression, it has a sideeffect
<halosghost> it's also, less general than += while saving exactly 1 character of typing (3 if you like spaces around +=, I suppose)
<halosghost> plus, not all languages (looking at you C) make it abundantly clear what the difference between pre and postfix is
<halosghost> so, that one (three) character(s) of savings hides a bunch of otherwise revealed intention, and offers no other features
<halosghost> I use ++ in C plenty, but I don't miss it in Zig
wootehfoot has joined #zig
eagle2com has quit [Ping timeout: 240 seconds]
return0e has quit [Remote host closed the connection]
return0e has joined #zig
return0e has quit [Remote host closed the connection]
return0e has joined #zig
<donpdonp> back to webasm: what Allocator's are available with --target-arch wasm32
<donpdonp> DirectAllocator for example throws /opt/zig/2019-01-29/lib/zig/std/heap.zig:116:21: error: Unsupported OS
<andrewrk> donpdonp, I'm pretty sure we can make direct allocator work on webasm
<donpdonp> andrewrk: roger.
<donpdonp> right now im carving out static chunks of ram with var ram = []u8{0} ** 256;
<andrewrk> donpdonp, there must be some kind of function you can call in wasm to allocate heap memory
<donpdonp> there is memory.grow which adds another 64k page to the heap.
<donpdonp> no idea how id call that from inside zig though
<andrewrk> memory.grow, what is that, an instruction?
<andrewrk> ok great
<andrewrk> I think we should be able to call that with inline assembly
* donpdonp nods
<andrewrk> unfortunately, unlike mmap, this is global, and so if any other allocator (such as libc) tries to "own" the memory block, it will conflicct
<andrewrk> hmm it's not so bad, because there is no shrink. so multiple allocators cannot clobber each other
schme245 has joined #zig
<andrewrk> donpdonp, good news by the way: llvm 8 rc1 is out; final release planned for feb 27. that's when zig officially gets wasm support in master branch
<andrewrk> (and that's when I will personally take steps to make sure it's working well)
<donpdonp> orly. i thought llvm7 was the bar for wasm. what does llmv8 add?
<andrewrk> The WebAssembly target is "experimental" in llvm7 and thus not enabled by default. So it is missing from, e.g. the apt packages in Debian & Ubuntu. LLVM 8 promotes the WebAssembly target to non-experimental status.
<donpdonp> also i think zig is a good match for wasm because its accustomed to be a low-level language, but i love it for its type/pointer handling.
<donpdonp> andrewrk: ah i see.
<donpdonp> im looking forward to webpages being able to use a variety of languages
<donpdonp> though my own project here is putting the 'wagon' go webasm interpreter into an irc bot :)
kristate has quit [Remote host closed the connection]
Zaabtop has joined #zig
<andrewrk> based on reading the wasm specs, it seems that zig's handling of out of memory conventions will be quite harmonious with web assembly
Zaabtop1 has joined #zig
Zaabtop1 has quit [Read error: Connection reset by peer]
Zaabtop has quit [Read error: Connection reset by peer]
Zaab1t has quit [Ping timeout: 240 seconds]
eagle2com has joined #zig
schme245 has quit [Remote host closed the connection]
steveno_ has joined #zig
marmotini_ has joined #zig
Zaab1t has joined #zig
schme245 has joined #zig
<schme245> andrewrk: quick question: are you interested in having symmetric / asymmetric crypto in the standard lib?
marmotini_ has quit [Ping timeout: 246 seconds]
<andrewrk> schme245, hmm I'm not sure I have a quick answer. It's definitely welcome at least before 1.0. When 1.0 nears, there is planned a standard library audit, and a lot of stuff will probably move to third party packages
<schme245> makes sense. I'm playing around with some stuff at the moment, if they turn out OK then maybe I'll shot a PR
<schme245> if they get scrapped in 1.0 that's fine by me :)
<schme245> (if they get in at all that is)
marmotini_ has joined #zig
eagle2com has quit [Ping timeout: 250 seconds]
<andrewrk> sounds good
Zaab1t has quit [Quit: bye bye friends]
steveno_ has quit [Ping timeout: 240 seconds]
marmotini_ has quit [Ping timeout: 240 seconds]
porky11 has joined #zig
<porky11> is there already some kind of ECS written in zig?
<andrewrk> porky11, what does ECS stand for?
<porky11> andrewrk, Entity Component System
<andrewrk> oh, yeah quite possibly. I know unique_id and MajorLag, and possibly also dbandstra are all working on games
<andrewrk> it's also a use case that people are talking about with respect to https://github.com/ziglang/zig/issues/130 which is the open issue for possibly introducing OOP (or similar), and has no accepted solution yet
<porky11> andrewrk, I also found this issue before writing here, but only one person mentions ECS once there
<andrewrk> porky11, I don't think you are going to find a high quality, stable, ready-for-everybody-to-use ECS package at this time
eagle2com has joined #zig
Avila has quit [Ping timeout: 250 seconds]
darithorn has quit [Quit: Leaving]
wootehfoot has quit [Read error: Connection reset by peer]
eagle2com has quit [Ping timeout: 250 seconds]
<MajorLag> I've only seen some simple demos of how ECS could be handled in zig, never a serious attempt.
darithorn has joined #zig
halosghost has quit [Quit: WeeChat 2.3]
<andrewrk> I'm about to do a short status update screen cast: https://www.twitch.tv/andrewrok
MajorLag has quit [Ping timeout: 264 seconds]
MajorLag has joined #zig
Ichorio has quit [Ping timeout: 244 seconds]
reductum has joined #zig
MajorLag has quit [Ping timeout: 264 seconds]
MajorLag has joined #zig
MajorLag has quit [Ping timeout: 268 seconds]
MajorLag has joined #zig
MajorLag has quit [Ping timeout: 240 seconds]
MajorLag has joined #zig
<andrewrk> now to fix the macos ci failure
<schme245> is there something like @ptrCast that casts to a slice?
eagle2com has joined #zig
<emekankurumeh[m]> does the window's ci run with windows 10?
<emekankurumeh[m]> schme245: i think `@ptrCast` should work on slices as well
<schme245> error: expected Pointer type, found '[]const u5'
<schme245> const pp = @ptrCast([]const u5, &p);
<schme245> you sure? I get this ^
<andrewrk> schme245, use slice syntax: p[0..]
<andrewrk> err, you'll need an end index too
<andrewrk> emekankurumeh[m], yes I believe so
<emekankurumeh[m]> if `p` is an array `&p` should work as well on HEAD
<schme245> `p` is a [32]u6
eagle2com has quit [Quit: WeeChat 2.3]
<schme245> there is no good reason for me to do this, I just wanted to know if it can be done :D
<andrewrk> schme245, you can slice and then ptr cast: @ptrCast([]const u5, p[0..])
<andrewrk> this is problematic however; you're relying on zig representing u6 and u5 the same way in memory, which is not guaranteed
<andrewrk> if you need to be able to do that cast, then I recommend using u8 instead of u6
<andrewrk> (and then not casting)
<schme245> error: expected Pointer type, found '[]const u5'
<schme245> const asdf = @ptrCast([]const u5, p[0..]);
<schme245> hmm
<andrewrk> hmm I thought I made @ptrCast allow casting between slice types
<schme245> ➜ des git:(master) ✗ zig version
<schme245> 0.3.0+5bf9ffdc
<andrewrk> schme245, ok try this: @bytesToSlice([]const u5, @sliceToBytes(&p))
<schme245> no dice
<andrewrk> &p should work in theory but if that's not implemented, p[0..]
<schme245> error: expected slice type, found '*const [32]u6'
<schme245> const asdf = @bytesToSlice([]const u5, @sliceToBytes(&p));
<andrewrk> I'll open an issue for that
Avila has joined #zig
<schme245> :+1:
<andrewrk> did that work for you?
<schme245> sorry, did what work?
<schme245> the @sliceToBytes(p[0..]) version?
<andrewrk> yes
<schme245> got this:
<schme245> error: expected '[]const u5' type, found '[]align(1) const []const u5'
<schme245> ^
<schme245> const asdf: []const u5 = @bytesToSlice([]const u5, @sliceToBytes(p[0..]));
<schme245> note: slice type child '[]const u5' cannot cast into slice type child 'u5'
<schme245> const asdf: []const u5 = @bytesToSlice([]const u5, @sliceToBytes(p[0..]));
<andrewrk> @bytesToSlice takes element type, not slice type
<schme245> that does the trick!
<andrewrk> that is a well-defined conversion, as long as you can comptime assert @sizeOf(u5) == @sizeOf(u6). which I'm pretty sure is going to be guaranteed in the language specification.
<schme245> neat!
<schme245> Zig is the first time I'm programming in a low-level language, I feel like I'm going mad with power, casting pointers left and right just to see what'll happen
<andrewrk> exciting :)
<schme245> yeah, really enjoying it so far, keep up the great work!
kristate has joined #zig
<andrewrk> alright that should fix the CI build
<kristate> andrewrk: thanks