ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
defenestrator_ has joined #zig
defenestrator has quit [Ping timeout: 260 seconds]
tridactyla has quit [Remote host closed the connection]
tridactyla has joined #zig
<andrewrk> defenestrator_, []u8
<andrewrk> string literals are [N]u8 where N is the length of the array. [N]u8 can implicitly cast to []const u8
<defenestrator_> So when I try, say "var string = "Hello world!"; var s: []u8 = undefined;" I have to say "s = string[0..];" instead of "s = string;", and I also can't assign a string literal directly to "s" either...is that correct?
<andrewrk> defenestrator_, https://clbin.com/EAs8u
<andrewrk> what are you trying to do?
<defenestrator_> I guess my larger question is initializing string pointers to string literals, e.g. in a struct:
<defenestrator_> https://clbin.com/rjpmo
<defenestrator_> I get "error: expected type '[]u8', found '[12]u8'"
davr0s has quit [Ping timeout: 252 seconds]
<andrewrk> defenestrator_, []u8 is a mutable pointer and a length. you can't mutate string literal data since it's stored in the constant section of the binary
<andrewrk> so your choices are: 1. make it string: []const u8 or 2. create a copy of the string literal on the heap and put that in the struct
<defenestrator_> Ok, thanks...so it looks like std.mem.dupe is the best way to do that if I need option 2?
<andrewrk> defenestrator_, yep, try that
<andrewrk> and then have a plan for freeing it, or use something like ArenaAllocator
<defenestrator_> Thanks!
cenomla has joined #zig
Tobba has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
cenomla has quit [Quit: cenomla]
defenestrator_ has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
ccll has joined #zig
ccll has quit [Client Quit]
arBmind has joined #zig
hoppetosse has joined #zig
arBmind has quit [Quit: Leaving.]
hoppetosse has quit [Ping timeout: 256 seconds]
MajorLag has joined #zig
hoppetosse has joined #zig
zesterer has joined #zig
steveno_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
zesterer has quit [Quit: zesterer]
zesterer has joined #zig
<GitHub197> [zig] andrewrk pushed 1 new commit to master: https://git.io/vAiB5
<GitHub197> zig/master 439621e Andrew Kelley: remove signal hanlding stuff from std.os.ChildProcess
steveno_ has quit [Ping timeout: 252 seconds]
steveno_ has joined #zig
zesterer has quit [Remote host closed the connection]
davr0s has joined #zig
<hoppetosse> andrewrk: what do you have in mind for packed enums?
<hoppetosse> What could the compiler do to non-packed enums?
<andrewrk> hoppetosse, I don't remember. packed enums might not make sense
<andrewrk> you can put a normal enum in a packed struct if you specify the enum tag type
<hoppetosse> We had a brief exchange about it in the enum array issue
<hoppetosse> We were talking about ordering and indexing of members, and I wasn't sure what the packed enum could be
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> hoppetosse, yeah I've been following along
<andrewrk> I've been really focused on coroutines
<hoppetosse> andrewrk: I'm excited to see that!
<hoppetosse> There's also been discussion about the function return syntax, how do you think generators are going to interact with that?
<andrewrk> where's the function return syntax discussion?
<hoppetosse> As for the async/await/promise stuff, it's looking great. I'm surprised you managed to get the clean keyword in there without cluttering it too much
<hoppetosse> It's the return type discussion
<hoppetosse> no-one's mentioned generators in there yet, I'm just bringing it up now
<andrewrk> thanks
zesterer has joined #zig
davr0s has joined #zig
<hoppetosse> andrewrk: I love what you've done with that => hahaha
<hoppetosse> I'll be honest, I was gonna suggest something like this back when people complained that the language was too noisy/full of sybols
<hoppetosse> I'd love to rid my code of some parentheses
<andrewrk> hoppetosse, bottom line is we solve this same disambiguation in other places with (), so we either need to require () in return types, or whatever fixes the return type issue will also let us drop () on if, while, switch, for
<hoppetosse> That sounds like a pretty good position to be in.
steveno_ has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hoppetosse> andrewrk: I've added some ideas for container initialization. I'm off to dinner in a bit, but I'll elaborate further
<andrewrk> thanks!
<hoppetosse> updated with a few more notes
hoppetosse has quit [Ping timeout: 248 seconds]
MajorLag2 has joined #zig
MajorLag has quit [Ping timeout: 245 seconds]
MajorLag2 has quit [Ping timeout: 245 seconds]
MajorLag has joined #zig
hoppetosse has joined #zig
<hoppetosse> andrewrk: the "fn foo() error { }" ambiguity is there because of the declaration syntax, correct?
<andrewrk> correct
<hoppetosse> in the "fn foo() A { }" example, there shouldn't be any ambiguity since you wouldn't expect an initialization there, so as long as A isn't error, it 's fine
<andrewrk> you could expect an initialization there
<andrewrk> fn foo() error{} {}
<andrewrk> error{} is an empty error set
<hoppetosse> ok, but not fn foo() UserStruct { }
<hoppetosse> I've been refining my thoughts, and I think I have something workable
<hoppetosse> I'll post it up now so I can be clearer
<andrewrk> ok
davr0s has joined #zig
<hoppetosse> Declaration syntax changes to use parentheses instead of curly brackets, and square brackets instead of parentheses. Initialization requires new (T) { .fields = t }
<hoppetosse> What I was trying to ask is, if there is no ambiguity caused by status quo initialization it can stay the same.
<hoppetosse> because if error {} is the only valid initialization, we can make it like a declaration instead and remove the ambiguity
<hoppetosse> ie: error sets are declared/initialized with parentheses
<hoppetosse> fn foo() error(NoMem)!void {}
<hoppetosse> Just like an enum's declaration is pretty much it's initialization, an error declaration is also its initialization
<hoppetosse> I'm sorry for how fragmented that came out.
<hoppetosse> updated with function declarations
<GitHub50> [zig] bnoordhuis opened pull request #796: allow implicit cast from &const to ?&const &const (master...fix731-more) https://git.io/vAPG1
<andrewrk> hoppetosse, a(b) is an explicit cast to type 'a'
<andrewrk> said another way, a(b) is a function call, and if a is a type then it's an explicit cast
<andrewrk> error(foo) already has meaning
hoppetosse has quit [Ping timeout: 268 seconds]
<MajorLag> Man, I'm getting real sick of "error: link failed". This is supposed to be fixed with the latest LLVM right?
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
<andrewrk> MajorLag, yeah, which is to be released something like tomorrow
<andrewrk> I'll merge llvm6 branch into master the same day
<andrewrk> have you been using the appveyor artifacts?
hoppetosse has joined #zig