ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
doublex has quit [Ping timeout: 250 seconds]
doublex has joined #zig
oats has joined #zig
<oats> Has anybody been able to compile thumbv6m-freestanding-none binaries with libopencm3?
_Vi has quit [Read error: Connection timed out]
<oats> ok, I got one compiling with libopencm3 lol
<oats> another question then, is there a way to inspect what's in the result of a cImport?
<oats> what fields it has, etc.
<oats> I'm importing some header files that define some pointer macros that don't seem to be in the imported C namespace
mahmudov has quit [Ping timeout: 240 seconds]
<via> oats: i'm curious, you are linking against opencm3 or you got it compiling direct with zig?
<oats> via: I'm linking the already compiled library
<oats> just importing the header files
doublex has quit [Read error: Connection reset by peer]
doublex has joined #zig
<oats> hmm, I think this is just a case of these macros not being supported
<oats> I used --verbose-cimport, and saw that the translated zig was in a file in zig-cache
<oats> it looks like the one I'm looking for just doesn't make it :P
<oats> memory-mapped IO macros and so on
lunamn has joined #zig
lunamn_ has quit [Ping timeout: 240 seconds]
doublex has quit [Ping timeout: 265 seconds]
mahmudov has joined #zig
porky11 has quit [Ping timeout: 245 seconds]
stratact has joined #zig
<via> oats: i was not having luck doing that, even the gpio headers wouldn't import properly
<via> i have to use c wrapper functions
THFKA4 has joined #zig
<oats> via: I got it built and running using no header files, just linking
<oats> might try to manually translate bits of the library for my tomu :P
<oats> maybe a little side-project
chemist69 has quit [Ping timeout: 246 seconds]
chemist69 has joined #zig
<andrewrk> companion_cube, whitequark is not interested in zig due to the lack of rust-like safety
return0e_ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
_whitelogger has joined #zig
_whitelogger has joined #zig
_whitelogger has joined #zig
_whitelogger has joined #zig
_Vi has joined #zig
<rifkik> Is there a type for Functions?
<rifkik> for example
<rifkik> opcodes[0xA9] = [_]fn{ ldaImm8, ldaImm16, ldaImm8, ldaImm16, ldaImm8 };
porky11 has joined #zig
_whitelogger has joined #zig
earnestly has joined #zig
porky11 has quit [Read error: No route to host]
porky11 has joined #zig
<mq32> andrewrk: i really find it interesting how superior some Rustaceans are. "rust is superior and all other languages are crap" or similar is the term i heard by a lot of people now and i find this saddening
<mq32> *Rusteceans -(are) +(feel)
_Vi has quit [Ping timeout: 246 seconds]
_Vi has joined #zig
<_Vi> By the way, Python - pythonista, Rust - rustacean, Zig - ?
* earnestly .oO(lol)
* earnestly refraims
<torque> I don't understand people's incessant need to label themselves
<torque> I don't think there's an reason to come up with a descriptor that implies some sort of allegiance to a specific programming language
<torque> I think it's weird and polarizing to do this actually, and I actively dislike it, thats my 2 cents thanks
dingenskirchen has joined #zig
<mq32> what torque said
<daurnimator> _Vi: ziguana
<mq32> daurnimator, i don't think that's a good idea: https://ziguana.com/
wootehfoot has joined #zig
<mq32> oh :D
<_Vi> Why `undeclared identifier 'timespec'` on WASI?
<_Vi> How do I save `std.mem.eql` curried with `u8` to a const to avoid typing `std.mem.eql(u8` all the time?
<mq32> just make a new function
<mq32> fn eql_u8(…) bool
<mikdusan> `fn curry_u8(a: var, b: var) bool { return std.mem.eql(u8, a, b); }`
<_Vi> How do I warn to stdout instead of stderr?
<_Vi> `getStdOut` returns `File` instead of `OutStream` that has `print`.
<mikdusan> the thing to note is warn() has a very specific contract. it doesn't make you `try`, that said:
<mikdusan> 1. `const out = try std.io.getStdOut()).outStream();`
<mikdusan> 2. try out.stream.print("{}\n", "hello");
<_Vi> OK, `.stream` was missing.
<Snektron> whats the point of a mascot for a programming language
<daurnimator> Snektron: plushies to sell? ;)
<daurnimator> Snektron: but also, people found go more approachable due to their use of the gopher in docs.
<mq32> Snektron, makes a nice impression and it's cool :D
_Vi has quit [Quit: _Vi]
Ichorio has joined #zig
samtebbs has joined #zig
<via> oats: do you have that up anywhere? i remember trying and failing to just do a miniblink style gpio on/off without c wrappers, so i'm interested in how you might have gotten it to work
<samtebbs> Should you 100% not be able to pass a `*std.io.seekable_stream.SeekableStream(std.os.SeekError,error{Unseekable,Unexpected,SystemResources,})` as a `*std.io.seekable_stream.SeekableStream(anyerror,anyerror)`, or is that a missing implicit cast?
<samtebbs> It means I have to create annoying boilerplate that wraps the more specific stream
Demos[m] has quit [Read error: Connection reset by peer]
fengb has quit [Remote host closed the connection]
jzck has quit [Remote host closed the connection]
vegai has quit [Remote host closed the connection]
D3zmodos has quit [Remote host closed the connection]
Snektron has quit [Remote host closed the connection]
BitPuffin has quit [Read error: Connection reset by peer]
dtz has quit [Read error: Connection reset by peer]
BitPuffin has joined #zig
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
Demos[m] has joined #zig
dtz has joined #zig
fengb has joined #zig
D3zmodos has joined #zig
jzck has joined #zig
vegai has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
_Vi has joined #zig
<daurnimator> samtebbs: why shouldn't you be able to?
<daurnimator> samtebbs: shouldn't std.os.SeekError cast implicitly to anyerror?
Snektron has joined #zig
porky11 has quit [Ping timeout: 245 seconds]
<samtebbs> daurnimator: That doesn't seem to be the case unfortunately
<samtebbs> You'd expect it to
<samtebbs> daurnimator: I had to do this to get around it: https://gist.github.com/SamTebbs33/bf3a9c27865214172c3e6dd28f21cee6
<rifkik> Continuing with my SNES emulator https://www.twitch.tv/altoverflow
mahmudov has quit [Ping timeout: 265 seconds]
rjtobin has joined #zig
kenaryn has joined #zig
<kenaryn> Hi people. Please does someone know how metabuild are defined? For example, I am using zig 0.5.0+dca6e74f's version; is 'dca6e74f' the last commit's date encrypted in hexadecimal format? Or is it more complicated than that?
<mikdusan> it's git commit hash from master branch
<kenaryn> Allright, thank you.
<nrdmn> what's still missing for https://github.com/ziglang/zig/issues/2097? '\u{XXXX}' character literals seem to work
<daurnimator> nrdmn: does `std.testing.expect('💩' == 128169);` pass?
<nrdmn> daurnimator: oh I see
porky11 has joined #zig
<fengb> Does daurnimator really remember poop by heart? :P
daurnimator has quit [Read error: Connection reset by peer]
daurnimator has joined #zig
_Vi has quit [Read error: Connection timed out]
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
mahmudov has joined #zig
<andrewrk> mq32, let's not be making general statements about groups of people please
<mq32> andrewrk, i didn't want to make a general statement about all, but only some
<scientes> mq32, you are still doing it
<scientes> stick to technical discussion
<scientes> and let fools be fools
<scientes> I am having a really hard time changing "case PrefixOpAddrOf" so that I can inspect AddrOf in the 2nd analyze phase
<scientes> to address &a[0] when a is a vector
<mq32> just want to clarify things: "some" as "80% of the people i met"
<scientes> mq32, yeah, but let them be fools, if that is what they are
<mq32> which is like... 5 or so
<mq32> yeah
<mq32> stuff done in zig today:
<mq32> 3D rendering with shadow mapping!
<scientes> that is really cool
<scientes> is the rendering written in zig?
<scientes> or I guess it is vulkan
<mq32> it's OpenGL ES 2.0, all written in Zig except for SDL
<scientes> there is just a bunch of code I don't really understand
<mq32> what's it about?
<scientes> taking the address of a vector is special
<scientes> &a[0]
<scientes> but you can only tell if it is a vector after types have been resolved
traviss has quit [Quit: Leaving]
Akuli has joined #zig
<scientes> there should be a way to get zig to not include a bunch of boiler plate and just look at the file provided, so that it is easier to use the debugger
<scientes> its hard to filter out all the debugger noise
<scientes> I'm trying to follow a specific AstNode through the compiler
ofelas has joined #zig
<n_1-c_k> How do you switch off colours in runtime error messages?
tdc has quit [Ping timeout: 240 seconds]
tdc has joined #zig
<mq32> n_1-c_k, i think there's a compiler flag for
<n_1-c_k> mq32, ...suppressing colour? I don't see it making any difference :(
<mq32> "zig build --color off" doesn't work?
<mq32> oh sorry
<mq32> runtime errors
<n_1-c_k> np
<andrewrk> n_1-c_k, I'd accept a patch to make std/debug.zig check @import("root") for a global configuration setting
<andrewrk> there is precedent for this
<n_1-c_k> andrewrk: if it's potentially doably by an inept novice, I might try!
<n_1-c_k> s/doably/doable/
<mq32> insert
<mq32> if(@hasDecl(@import("root"), "enable_colored_debug_output")) { if(!@import("root")."enable_colored_debug_output) return }
<mq32> or something like that
<mq32> there's probably a typeOf missing somewhere
<n_1-c_k> I recognize some of the words there, I'll give it a go, thx
waleee-cl has joined #zig
<andrewrk> n_1-c_k, ^
<n_1-c_k> ok...
<scientes> i'm struggling to change this so it creates a IrInstruction
<scientes> return ir_lval_wrap(irb, scope, ir_gen_node_extra(irb, expr_node, scope, LValPtr, nullptr), lval, result_loc);
<scientes> so that I can examine it in the analyze pass
<scientes> from PrefixOpAddrOf
<scientes> i mean ir_gen_node_extra makes a IrInstruction
<mq32> andrewrk, oh ok :D yeah, that's probably a better place
<mq32> i looked up how the code is colored and ignored that my whole screen was wapped in a if(tty_color) { }
<scientes> the issue seems to be this assumption that everything is a pointer
<scientes> *that all values
<scientes> so & doesn't have an instruction
<scientes> and instead everything is LValPtr
porky11 has quit [Remote host closed the connection]
Akuli has quit [Quit: Leaving]
samtebbs has quit [Quit: Lost terminal]
tdc has quit [Quit: Leaving]
doublex has joined #zig
SrMordred has joined #zig
<n_1-c_k> I'm attempting to follow CONTRIBUTING and falling at an early hurdle, https://paste.debian.net/plain/1104932 - ?
<andrewrk> n_1-c_k, CXX=clang-9 is suspect
<n_1-c_k> oh I got an error without that :(
<andrewrk> have a paste?
<n_1-c_k> sure, https://0x0.st/zwOs.txt
<n_1-c_k> so I added CXX=.. and got the 2nd error, in the debian.net paste
<andrewrk> you're on debian? you need the build-essential package
<n_1-c_k> oh! I'll try that, thanks
<n_1-c_k> Yes, I'm getting further now, thanks, I'll press on...
doublex has quit [Ping timeout: 245 seconds]
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
<n_1-c_k> My next hurdle, https://paste.debian.net/plain/1104934 - I guess that's something bad?
<nrdmn> n_1-c_k: what's your glibc version?
<n_1-c_k> nrdmn, that's the same as libc6 isn't it? It says, Version: 2.29-2
plumm has joined #zig
<nrdmn> hmm
<plumm> mikdusan: I am reading your zig compiler internals, for section 4.1 why are there 3 reset instructions?
<plumm> at the beginning*
<companion_cube> andrewrk: thanks for ref to your discussion with whitequark
doublex has joined #zig
<companion_cube> interesting conversation
<companion_cube> but when they mention formal methods, I agree with them
<companion_cube> perfection needs proof, especially if something as benign as an overflow gives the compiler the right to do anything
<companion_cube> seems like a good summary, yes?
doublex has quit [Ping timeout: 240 seconds]
<earnestly> If perfect software is software that is proven is true then no software is perfect
<earnestly> But you can proof the provable parts, and although that proof doesn't compose, it does provide some trust
<companion_cube> earnestly: there exists proven software
<companion_cube> of course you can mistrust the prover, but well, it's still way better
<companion_cube> (and way more effort)
<earnestly> Formally verified software exists, and that software still fails when it assumes the network is perfect. They of course have far less bugs than unverified software so it's not for nothing
<companion_cube> why would it assume the network is perfect?
<earnestly> When you do formal verification you have to make sweeping assumptions about the environment, about state
<companion_cube> it's clearly not for nothing indeed.
<companion_cube> yeah, although for a C compiler like compcert, these assumptions are quite minimal
<fengb> Formally verified architecture exists. I don’t believe implementations have been proven
<earnestly> companion_cube: When verifying a system you can only do small parts of it as to verify it completely would require you verify everything about its environment as well as proof does not compose
<earnestly> And the only programs which can be proven are total
<earnestly> I.e. not turing complete
<companion_cube> earnestly: http://compcert.inria.fr/
<earnestly> Yes, I'm aware of it
<companion_cube> a lot of useful things are not turing complete
<companion_cube> and the thing is proved end to end, not just locally
<earnestly> Yes I know
<companion_cube> (yeah, if it can't write a file, it'll fail, but that's pretty acceptable)
<companion_cube> reminds me of something
<companion_cube> tbh I think distributed systems are intrinsically harder
<earnestly> What robust, resilient software does, is as the article I linked describes. You design error recovery subsystems (i.e. erlang, NASA's curiosity, etc.) and then throw as many adhoc formal methods as you can stomach at it
<companion_cube> but stuff like memory bugs, array offsets errors, etc. are provable (http://why3.lri.fr/ eg)
<earnestly> companion_cube: rowhammer
<companion_cube> well if your point is that no software can be perfect, I think I agree
<earnestly> Right, I'm trying to emphasis that it's not a silver bullet which I think you know, but sometimes forget
<earnestly> emphasise*
<companion_cube> it's just that it gets you 99.9% of the way
<companion_cube> unlike tests, which may get you 50% of the way or something like that
<earnestly> Resilient software, or even "progress oblivious" software is also programmed in ways utterly alien to normal software too
<companion_cube> erlang like stuff is resilient only as much as the VM is correct, and writing a safe VM is more what Zig would/should excel at
<companion_cube> (like, writing a flawless GC — and there you can't just recover)
<earnestly> You can make Haskell software segfault by making the available stack size too small. All formally verified software has axioms, i.e. "assumed, tacit", etc. Sometimes those axioms are wrong, but even in mathematics, almost never questioned
<companion_cube> hmm a Coq proof shouldn't contained "assumed" at all
<earnestly> You have to, it would be too costly otherwise
<companion_cube> hmm, no?
<companion_cube> (as for the stack size, well, you can prove "terminates with correct result or crashes", which is a lot better than "anything goes because there might be UB")
<earnestly> You can't prove that, that's the point. You'd have to solve the halting problem
<companion_cube> wrong.
<earnestly> (You can formally reason about it though, and that's good to do anyway)
<companion_cube> you just have to prove the halting problem *in that particular case*
<earnestly> Sure but your inputs are arbitrary
<companion_cube> well, still ?
<companion_cube> you can prove that `λx. x+1` terminates, whatever x is ;)
<companion_cube> you can prove that a sort function terminates
<earnestly> Not when composed
<companion_cube> sure
<mikdusan> plumm: that has to do with result-location semantics and it's part of setting it up. but i admit not having grok'd how that works yet
<earnestly> Well, not without proving the composion
<companion_cube> the halting problem just prevents you from writing an algorithm that always decides termination
<companion_cube> yeah but that's what people do
<companion_cube> that's what compcert does
<companion_cube> (besides, here whitequark wasn't talking about proving correctness, but safety, which is less hard)
<earnestly> companion_cube: Well they are working on certifying coq, so we'll see
<companion_cube> wait, what
<companion_cube> what do you mean?
<companion_cube> ah, different thing, they're building another compiler. That's cool, a bit like cakeML, I guess.
<companion_cube> impressive team, too.
<kenaryn> earnestly perhaps you would be interested by F#, which is a formal concept-proof aiming at Coq replacement, and became a general purpose language. See more at: https://www.fstar-lang.org/
<companion_cube> you mean F* ? yeah…
<earnestly> I read F# and thought you meant F#, :P
<kenaryn> It involves Inria once again, like companion_cube talked about compcert
<kenaryn> nope... I said F*
<earnestly> All of this stuff comes from inria
<earnestly> F**
<companion_cube> (I'm just talking about the stuff I know)
<kenaryn> and I'm grateful for that, I added your links in my browser's favorites.
<kenaryn> sorry, it was F* from the beginning, not F#. I mispelled it. :)
<kenaryn> There is also another formal language to query a database and composed of structures embedded in the data itself, it is a direct concurrent of GraphQL, it is nammed Category Query Language.
<kenaryn> But unlike the former one, it is under a company's control which is in charge of the IDE intrisically associated with CQL.
wootehfoot has quit [Read error: Connection reset by peer]
<kenaryn> https://www.categoricaldata.net/ if you wish to check this out.
doublex has joined #zig
kenaryn has left #zig [""Good night from France!""]
doublex has quit [Ping timeout: 250 seconds]
doublex has joined #zig
doublex has quit [Ping timeout: 246 seconds]
doublex has joined #zig
Ichorio has quit [Ping timeout: 245 seconds]
rifkik has quit [Remote host closed the connection]
ltriant has joined #zig
return0e_ has quit [Remote host closed the connection]
plumm has quit [Ping timeout: 265 seconds]
doublex has quit [Ping timeout: 265 seconds]