<pixelherodev>
pretty sure it's a bug in the error message
lunamn_ has joined #zig
ky0ko has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
<fengb>
/// is a doc comment which can only go right before a declaration. // is a regular comment
lunamn has quit [Ping timeout: 240 seconds]
keithdc has quit [Remote host closed the connection]
<pixelherodev>
Ah - maybe it's time to edit " eventually, it will become a compile error to have a doc comment in an unexpected place, such as in the middle of an expression, or just before a non-doc comment." in the docs :)
crimson_penguin has quit [Ping timeout: 264 seconds]
crimson_penguin has joined #zig
utzig has quit [Ping timeout: 276 seconds]
lunamn_ has quit [Ping timeout: 265 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
wootehfoot has quit [Read error: Connection reset by peer]
muffindrake has quit [Ping timeout: 246 seconds]
muffindrake has joined #zig
mla has joined #zig
reductum has joined #zig
chemist69 has quit [Ping timeout: 245 seconds]
chemist69 has joined #zig
_whitelogger has joined #zig
return0e has joined #zig
return0e_ has quit [Ping timeout: 240 seconds]
_whitelogger has joined #zig
mahmudov has quit [Ping timeout: 240 seconds]
doublex has quit [Remote host closed the connection]
doublex has joined #zig
<mq32>
nrdmn, thanks for the comments, gonna fix it now :)
<mq32>
fengb, a question on wasm: can i load wasm from a local html file or does this require a server?
<reductum>
mq32: for a while firefox would let you load it directly from local file, but now you need a server
<reductum>
I think chrome has required a server for a long time. I don't know about other browsers.
mahmudov has joined #zig
<mq32>
sad :(
<andrewrk>
this is a problematic restriction
<reductum>
Yes it's unfortunate.
<reductum>
What I do now is just `python3 -m http.server` in the dir with the wasm module.
<bgiannan>
andrewrk, any idea what that might be: https://0x0.st/z3-R.txt ? I could not managed what triggers it in my code yet.
<reductum>
If the zig stdlib included a similarly super basic http server, maybe that could be used.
<andrewrk>
bgiannan, you will actually get a better error if you don't do --verbose-ir. in your paste, the code doing verbose-ir itself crashed before the actual problem happened
<mq32>
reductum, would still require you to startup an http server to read the docs
<mq32>
which is just "not simple" ;)
<bgiannan>
andrewrk, i had not input at all without it
<bgiannan>
output rather
<reductum>
Oh I just got here. Were you talking about docs? I was talking about testing local wasm files in the browser.
<bgiannan>
i'll try and build zig myself so i can get a error stacktrace
<andrewrk>
bgiannan, that will help
<mq32>
reductum, yeah my big question was if i could run wasm in the docs
<mq32>
but i think that andrew would have already done this if it would be possible
<andrewrk>
mq32, unfortunately, being able to see it with file:/// is an important feature
<mq32>
yeah i'm totally with you there. not requiring a server is just too important
<andrewrk>
it's assumed that files on a server are there on purpose, for access by the web page
<andrewrk>
when looking at a file:/// URL, the browser assumes that the files are there intentionally as well, for css, images, and scripts
<daurnimator>
mq32: oh hey look more motivation to work on the zig http server :)
* daurnimator
really has too many tasks to get to
<andrewrk>
but when a script tries to access same such resources, now firefox changes its mind, and says the files are not there on purpose, accessing them is a security vulnerability
<daurnimator>
andrewrk: yes IIRC each file:// url is considered its own "origin"
<daurnimator>
so you have the same restrictions as if you try and go cross-domain
<daurnimator>
==> <img>, <style> and a few other tags have always worked cross-domain; so they work across file://
<andrewrk>
it's inconsistent and problematic. there should be a way to run web assembly without depending on this origin thing, just like it works for scripts, images, css
<daurnimator>
but XHRs, wasm, and most neer stuff... is blocked cross-domain as well. and hence blocked for file://
<reductum>
Chrome does the same.
<daurnimator>
andrewrk: browser developers consider allow cross-domain scripts, images and css to be a mistake; but they have to keep it around for compat.
<andrewrk>
it's a nice find that you can change it, but that doesn't really matter. the default is important
<reductum>
Yup agreed. I was more selfishly excited about that discovery for my own project :P
<andrewrk>
daurnimator, I don't think that's a valid excuse
<andrewrk>
wasm must be able to be executed in the same context as <script> if it is to succeed
<daurnimator>
andrewrk: true. but thats what they seem to think and I don't think I have a hope of changing their mind
<marijnfs>
What do you guys get when you add: var testval = [*c]u8 {0};
<andrewrk>
I don't either. but they're doing it wrong
<bgiannan>
huh trying to install llvm 9 from https://apt.llvm.org/ but apt complains about missing public keys
<andrewrk>
marijnfs, the expected outcome is a compile error. also, don't use c pointers
<andrewrk>
bgiannan, scroll down and look for "archive signature"
<marijnfs>
andrewrk: allright, I needed to pass a string to c. I guess I should use c"somethign".
<andrewrk>
there you go
<bgiannan>
i added `deb [trusted=yes]` and now it works
<andrewrk>
good night. I'll be happy to help you with the compiler crash tomorrow bgiannan
<daurnimator>
andrewrk: oh wow you haven't gone to sleep yet
<bgiannan>
andrewrk, good night
<daurnimator>
oh wait. I forgot I'm in a different timezone to normal
reductum has quit [Quit: WeeChat 2.6]
<mq32>
daurnimator, what timezone are you in?
<daurnimator>
mq32: currently germany
<mq32>
ah, so we have the same local time :D
<marijnfs>
Guten Tag
<marijnfs>
I'm importing a c header, but when I call a function with it, I get a segfault, 'c' seeming to be 0
<daurnimator>
marijnfs: what is 'c'?
<daurnimator>
(you're going to need to post code)
<marijnfs>
sure, whats the pastebin of choice here?
<marijnfs>
dammn, I realised zmq provides c bindings to c++, so I also need libc++
<marijnfs>
man these errors get cryptic, i guess it's hard to fix that
<daurnimator>
marijnfs: are you statically linking or dynamically? if the former, yes you'll need to link all libraries of your dependencies, pkg-config usually helps here. but for a dynamic lib, you shouldn't need it
FireFox317 has quit [Remote host closed the connection]
<marijnfs>
daurnimator: didn't set static linking explicitly, but did add linkSystemLibrary for the libraries
<daurnimator>
marijnfs: ah looks like static is the default for executables
<daurnimator>
marijnfs: however; linkSystemLibrary should use pkg-config to figure this out...
<daurnimator>
marijnfs: at least on my system its called libzmq not zmq
<marijnfs>
daurnimator: do you have examples of how to use pkg-config?
<daurnimator>
marijnfs: e.g. `pkg-config --libs --static libzmq`
<marijnfs>
interesting, do you call this stuff in a build.zig script?
<daurnimator>
marijnfs: build.zig calls it for you
<daurnimator>
though looking at the source of std/build.zig...... I think we don't pass --static?? that would be a bug to fi
<daurnimator>
x
knebulae has quit [Read error: Connection reset by peer]
<dingenskirchen>
that's the name of the clang folder
<dingenskirchen>
dunno why though.
<daurnimator>
I think its the "real" name of clang => C Front End
<daurnimator>
e.g. the clang mailing list is cfe-dev
<marijnfs>
bgiannan: i didn't need to add cfe
<marijnfs>
but llvm didn't find the clang library initially during configuration, had to add in manually
<marijnfs>
check if LLVM_EXTERNAL_CLANG_SOURCE_DIR is found
<marijnfs>
how do i get the compiletime size of a string
<mq32>
("foo").len
<marijnfs>
how do i get the compiletime size of a string
<marijnfs>
woops
<marijnfs>
mq32: thanks
<mq32>
1np
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
<marijnfs>
how do i make a string literal look like []u8
<marijnfs>
a found that making it const helps, but seems a bit hard to infer from expected type '[]u8', found '[11]u8
<marijnfs>
a hint system for the compiler would be cool, like how clang++ gives suggestions when you screw up common cases
<marijnfs>
I'm trying to make a function in build.zig that creates an executable and am trying to find the type of executable, but i see that addExecutable doesn't even define the return type. Is it infered?
keithdc has joined #zig
<daurnimator>
marijnfs: []u8 is a slice (pointer + length). [11]u8 is an actual array
<marijnfs>
daurnimator: I want to pass a ptr to the literal to C, so it needs to be ?*c_void
<marijnfs>
how do i do that?
<daurnimator>
marijnfs: address of operator (&) and then maybe a pointer cast?
<marijnfs>
daurnimator: that seems to almost work, but it discards const qualifier
<marijnfs>
ah found a hack, using ptrToInt and then intToPtr
wootehfoot has joined #zig
<bgiannan>
huh llvm make install complaining about missing ocamldoc...
<mq32>
oh wow. my GLes wrapper killes zig test :D
<bgiannan>
guess i can build llvm without ocaml/go bindings
Ichorio has joined #zig
lunamn has joined #zig
keithdc has quit [Ping timeout: 240 seconds]
mahmudov has quit [Ping timeout: 240 seconds]
dimenus has joined #zig
<dimenus>
does llvm have a standalone assembler (nasm syntax) or do you have to use clang?
_whitelogger has joined #zig
mahmudov has joined #zig
<riba>
cimport ignores conditional macros
<riba>
i defined the condition to be true using -D
<andrewrk>
I like how this error sets business exposes error codes that should not be
doublex has joined #zig
<ForLoveOfCats>
I'm experiencing the build.zig for the zig0 0.5.0 compiler crashing while linking in `std.build.LibExeObjStep.linkSystemLibrary` by hitting the `else => unreachable,` on line 1841. Thowing a warn in there to log the error reveals that it's throwing an `error.StreamTooLong` while linking LLVM `LLVM-9`. The build previously succeeded with an earlier master in the lead up to 0.5.0 however there have been several system updates since
<ForLoveOfCats>
then. I wanted to check here before opening a bug on GH.
<ForLoveOfCats>
Glad it's known and handled! Cheers!
* daurnimator
is currently at GSoC. Had a chat with a few zig targets including netbsd, freebsd and rtems. Hopefully they are interested and come on board to help us :)
utzig has joined #zig
sossy has quit [Ping timeout: 260 seconds]
<andrewrk>
nice daurnimator!
<andrewrk>
tell them to work on improving the widespread support of continuous integration services
<andrewrk>
I mean, support for their OS on these services
reductum has joined #zig
<marler8997_>
I remember it being ".zig-cache", but now it looks like it's "zig-cache"?
<marler8997_>
Am I remembering wrong, or did it actually change?
<andrewrk>
I don't think it was ever .zig-cache
<marler8997_>
oh ok, weird
<nrdmn>
I did some work on padding in std/fmt. I'm not sure if I'll find time to finish that
doublex has quit [Ping timeout: 250 seconds]
utzig has quit [Read error: Connection reset by peer]
doublex has joined #zig
utzig has joined #zig
utzig has quit [Read error: Connection reset by peer]
utzig has joined #zig
riba has quit [Ping timeout: 268 seconds]
cmrs has quit [Read error: Connection reset by peer]
ForLoveOfCats has quit [Quit: Konversation terminated!]
mahmudov has quit [Ping timeout: 268 seconds]
mahmudov has joined #zig
Akuli has quit [Quit: Leaving]
keithdc has quit [Ping timeout: 268 seconds]
utzig has quit [Read error: Connection reset by peer]
utzig has joined #zig
<marijnfs>
can you get return types at comptime?
<marijnfs>
my function should return whatever some specific functiohn returns
<tgschultz>
I think that might be much more complicated than what marijnfs is talking about. You can have the return type of a function be the result of a function call on any parameter passed to the function. `pub fn a(x: var) SpecialReturnType(@typeOf(x)) { ... }`
lunamn has quit [Ping timeout: 268 seconds]
lunamn has joined #zig
<tgschultz>
so if you want the return type to match another function, you just need to use @typeInfo to inspect the function and get its return type. However, if that function is generic that won't work.
<mq32>
tgschultz: probbaly just @typeOf(specificCall())
reductum has quit [Quit: WeeChat 2.6]
reductum has joined #zig
<wilsonk>
ah, ok...I guess I was reading more into that than was needed
reductum has quit [Client Quit]
reductum has joined #zig
reductum has quit [Client Quit]
reductum has joined #zig
reductum has quit [Client Quit]
reductum has joined #zig
reductum has quit [Quit: WeeChat 2.6]
wootehfoot has quit [Read error: Connection reset by peer]
ntgg has joined #zig
<ntgg>
is there a function that creates an iterator out of a slice?